Changeset View
Changeset View
Standalone View
Standalone View
support/hg/arc-hg.py
Show All 25 Lines | |||||
_ = i18n._ | _ = i18n._ | ||||
cmdtable = {} | cmdtable = {} | ||||
command = registrar.command(cmdtable) | command = registrar.command(cmdtable) | ||||
@command( | @command( | ||||
b'arc-ls-markers', | b'arc-ls-markers', | ||||
[(b'', b'output', b'', | [(b'', b'output', b'', | ||||
_('file to output refs to'), _('FILE')), | _(b'file to output refs to'), _(b'FILE')), | ||||
] + cmdutil.remoteopts, | ] + cmdutil.remoteopts, | ||||
_('[--output FILENAME] [SOURCE]')) | _(b'[--output FILENAME] [SOURCE]')) | ||||
def lsmarkers(ui, repo, source=None, **opts): | def lsmarkers(ui, repo, source=None, **opts): | ||||
"""list markers | """list markers | ||||
Show the current branch heads and bookmarks in the local working copy, or | Show the current branch heads and bookmarks in the local working copy, or | ||||
a specified path/URL. | a specified path/URL. | ||||
Markers are printed to stdout in JSON. | Markers are printed to stdout in JSON. | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | if not saw_active: | ||||
markers.append({ | markers.append({ | ||||
'type': 'commit', | 'type': 'commit', | ||||
'name': None, | 'name': None, | ||||
'node': node.hex(active_node), | 'node': node.hex(active_node), | ||||
'isActive': False, | 'isActive': False, | ||||
'isClosed': False, | 'isClosed': False, | ||||
'isTip': False, | 'isTip': False, | ||||
'isCurrent': True, | 'isCurrent': True, | ||||
'description': repo['.'].description(), | 'description': repo[b'.'].description(), | ||||
}) | }) | ||||
return markers | return markers | ||||
def remotemarkers(ui, repo, source, opts): | 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) | ||||
with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
branchmap = e.callcommand('branchmap', {}).result() | branchmap = e.callcommand(b'branchmap', {}).result() | ||||
for branch_name in branchmap: | for branch_name in branchmap: | ||||
for branch_node in branchmap[branch_name]: | for branch_node in branchmap[branch_name]: | ||||
markers.append({ | markers.append({ | ||||
'type': 'branch', | 'type': 'branch', | ||||
'name': branch_name, | 'name': branch_name, | ||||
'node': node.hex(branch_node), | 'node': node.hex(branch_node), | ||||
'description': None, | |||||
}) | }) | ||||
with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
remotemarks = bookmarks.unhexlifybookmarks(e.callcommand('listkeys', { | remotemarks = bookmarks.unhexlifybookmarks(e.callcommand(b'listkeys', { | ||||
'namespace': 'bookmarks', | b'namespace': b'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]), | ||||
'description': None, | |||||
}) | }) | ||||
return markers | return markers |