forked from M-Labs/artiq
master,client: support scanning specific repo revisions
This commit is contained in:
parent
671a3f1833
commit
400b414885
@ -87,8 +87,11 @@ def get_argparser():
|
||||
"what",
|
||||
help="select object to show: schedule/log/devices/parameters")
|
||||
|
||||
subparsers.add_parser("scan-repository",
|
||||
help="trigger a repository rescan")
|
||||
parser_scan = subparsers.add_parser("scan-repository",
|
||||
help="trigger a repository (re)scan")
|
||||
parser_scan.add_argument("revision", default=None, nargs="?",
|
||||
help="use a specific repository revision "
|
||||
"(defaults to head)")
|
||||
|
||||
return parser
|
||||
|
||||
@ -145,7 +148,7 @@ def _action_del_parameter(remote, args):
|
||||
|
||||
|
||||
def _action_scan_repository(remote, args):
|
||||
remote.scan_async()
|
||||
remote.scan_async(args.revision)
|
||||
|
||||
|
||||
def _show_schedule(schedule):
|
||||
|
@ -57,33 +57,34 @@ class Repository:
|
||||
self.backend = backend
|
||||
self.log_fn = log_fn
|
||||
|
||||
self.head_rev = self.backend.get_head_rev()
|
||||
self.backend.request_rev(self.head_rev)
|
||||
self.cur_rev = self.backend.get_head_rev()
|
||||
self.backend.request_rev(self.cur_rev)
|
||||
self.explist = Notifier(dict())
|
||||
|
||||
self._scanning = False
|
||||
|
||||
def close(self):
|
||||
# The object cannot be used anymore after calling this method.
|
||||
self.backend.release_rev(self.head_rev)
|
||||
self.backend.release_rev(self.cur_rev)
|
||||
|
||||
@asyncio.coroutine
|
||||
def scan(self):
|
||||
def scan(self, new_cur_rev=None):
|
||||
if self._scanning:
|
||||
return
|
||||
self._scanning = True
|
||||
|
||||
new_head_rev = self.backend.get_head_rev()
|
||||
wd, _ = self.backend.request_rev(new_head_rev)
|
||||
self.backend.release_rev(self.head_rev)
|
||||
self.head_rev = new_head_rev
|
||||
if new_cur_rev is None:
|
||||
new_cur_rev = self.backend.get_head_rev()
|
||||
wd, _ = self.backend.request_rev(new_cur_rev)
|
||||
self.backend.release_rev(self.cur_rev)
|
||||
self.cur_rev = new_cur_rev
|
||||
new_explist = yield from _scan_experiments(wd, self.log_fn)
|
||||
|
||||
_sync_explist(self.explist, new_explist)
|
||||
self._scanning = False
|
||||
|
||||
def scan_async(self):
|
||||
asyncio.async(self.scan())
|
||||
def scan_async(self, new_cur_rev=None):
|
||||
asyncio.async(self.scan(new_cur_rev))
|
||||
|
||||
|
||||
class FilesystemBackend:
|
||||
|
Loading…
Reference in New Issue
Block a user