Changeset View
Changeset View
Standalone View
Standalone View
support/hg/arc-hg.py
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | def remotemarkers(ui, repo, source, opts): | ||||
| # Disable status output from fetching a remote. | # Disable status output from fetching a remote. | ||||
| ui.quiet = True | ui.quiet = True | ||||
| markers = [] | markers = [] | ||||
| source, branches = hg.parseurl(ui.expandpath(source)) | source, branches = hg.parseurl(ui.expandpath(source)) | ||||
| remote = hg.peer(repo, opts, source) | remote = hg.peer(repo, opts, source) | ||||
| bundle, remotebranches, cleanup = bundlerepo.getremotechanges( | with remote.commandexecutor() as e: | ||||
| ui, | branchmap = e.callcommand('branchmap', {}).result() | ||||
| repo, | |||||
| remote) | for branch_name in branchmap: | ||||
| for branch_node in branchmap[branch_name]: | |||||
| try: | |||||
| for n in remotebranches: | |||||
| ctx = bundle[n] | |||||
| markers.append({ | markers.append({ | ||||
| 'type': 'branch', | 'type': 'branch', | ||||
| 'name': ctx.branch(), | 'name': branch_name, | ||||
| 'node': node.hex(ctx.node()), | 'node': node.hex(branch_node), | ||||
| }) | }) | ||||
| finally: | |||||
| cleanup() | |||||
| with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
| remotemarks = bookmarks.unhexlifybookmarks(e.callcommand('listkeys', { | remotemarks = bookmarks.unhexlifybookmarks(e.callcommand('listkeys', { | ||||
| 'namespace': 'bookmarks', | 'namespace': 'bookmarks', | ||||
| }).result()) | }).result()) | ||||
| for mark in remotemarks: | for mark in remotemarks: | ||||
| markers.append({ | markers.append({ | ||||
| 'type': 'bookmark', | 'type': 'bookmark', | ||||
| 'name': mark, | 'name': mark, | ||||
| 'node': node.hex(remotemarks[mark]), | 'node': node.hex(remotemarks[mark]), | ||||
| }) | }) | ||||
| return markers | return markers | ||||