client: add --async option to scan-repository, recommend usage in git post-receive

This commit is contained in:
Sebastien Bourdeauducq 2016-04-04 22:17:39 +08:00
parent 7453d85d5e
commit 3efb841557
2 changed files with 7 additions and 2 deletions

View File

@ -96,6 +96,8 @@ def get_argparser():
parser_scan_repos = subparsers.add_parser( parser_scan_repos = subparsers.add_parser(
"scan-repository", help="trigger a repository (re)scan") "scan-repository", help="trigger a repository (re)scan")
parser_scan_repos.add_argument("--async", action="store_true",
help="trigger scan and return immediately")
parser_scan_repos.add_argument("revision", default=None, nargs="?", parser_scan_repos.add_argument("revision", default=None, nargs="?",
help="use a specific repository revision " help="use a specific repository revision "
"(defaults to head)") "(defaults to head)")
@ -159,7 +161,10 @@ def _action_scan_devices(remote, args):
def _action_scan_repository(remote, args): def _action_scan_repository(remote, args):
remote.scan_repository(args.revision) if args.async:
remote.scan_repository_async(args.revision)
else:
remote.scan_repository(args.revision)
def _action_ls(remote, args): def _action_ls(remote, args):

View File

@ -93,7 +93,7 @@ There should be no errors displayed, and if you start the GUI again you should n
First, another small configuration step is needed. We must tell Git to make the master rescan the repository when new data is added to it. Create a file ``~/artiq-master/repository/hooks/post-receive`` with the following contents: :: First, another small configuration step is needed. We must tell Git to make the master rescan the repository when new data is added to it. Create a file ``~/artiq-master/repository/hooks/post-receive`` with the following contents: ::
#!/bin/sh #!/bin/sh
artiq_client scan-repository artiq_client scan-repository --async
Then set the execution permission on it: :: Then set the execution permission on it: ::