From 41774ba9cceb2a8ba6c15b3f256a04898d811fd4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 7 Jul 2020 10:12:09 -0700 Subject: [PATCH] Fix additional Mercurial/Python compatibility issues in "arc land" Summary: Ref PHI1805. Under some combination of versions (Python 3.8?), "arc-ls-markers" is running into additional Python runtime issues. Sprinkle more "b" around to resolve them? Also clean up a couple of plain "arc" issues. Test Plan: Landed a change in Mercurial. Some of this works fine without changes in Python 3.7/2.7 against Mercurial 4.7/5.4, so this may not be exhaustive. Differential Revision: https://secure.phabricator.com/D21393 --- src/land/engine/ArcanistMercurialLandEngine.php | 6 +++--- support/hg/arc-hg.py | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php index 0fb8c6a9..59ccabab 100644 --- a/src/land/engine/ArcanistMercurialLandEngine.php +++ b/src/land/engine/ArcanistMercurialLandEngine.php @@ -116,7 +116,7 @@ final class ArcanistMercurialLandEngine throw new PhutilArgumentUsageException( pht( 'Symbol "%s" is ambiguous.', - $symbol)); + $raw_symbol)); } $marker = head($named_markers); @@ -493,6 +493,7 @@ final class ArcanistMercurialLandEngine } protected function selectIntoCommit() { + $api = $this->getRepositoryAPI(); $log = $this->getLogEngine(); if ($this->getIntoEmpty()) { @@ -508,7 +509,6 @@ final class ArcanistMercurialLandEngine if ($this->getIntoLocal()) { // If we're running under "--into-local", just make sure that the // target identifies some actual commit. - $api = $this->getRepositoryAPI(); $local_ref = $this->getIntoRef(); // TODO: This error handling could probably be cleaner, it will just @@ -834,7 +834,7 @@ final class ArcanistMercurialLandEngine try { foreach ($body as $command) { - $this->newPasthru('%Ls', $command); + $this->newPassthru('%Ls', $command); } } finally { foreach ($tail as $command) { diff --git a/support/hg/arc-hg.py b/support/hg/arc-hg.py index 94e4d3b1..9bf18aa0 100644 --- a/support/hg/arc-hg.py +++ b/support/hg/arc-hg.py @@ -31,9 +31,9 @@ command = registrar.command(cmdtable) @command( b'arc-ls-markers', [(b'', b'output', b'', - _('file to output refs to'), _('FILE')), + _(b'file to output refs to'), _(b'FILE')), ] + cmdutil.remoteopts, - _('[--output FILENAME] [SOURCE]')) + _(b'[--output FILENAME] [SOURCE]')) def lsmarkers(ui, repo, source=None, **opts): """list markers @@ -166,7 +166,7 @@ def localmarkers(ui, repo): 'isClosed': False, 'isTip': False, 'isCurrent': True, - 'description': repo['.'].description(), + 'description': repo[b'.'].description(), }) return markers @@ -181,7 +181,7 @@ def remotemarkers(ui, repo, source, opts): remote = hg.peer(repo, opts, source) with remote.commandexecutor() as e: - branchmap = e.callcommand('branchmap', {}).result() + branchmap = e.callcommand(b'branchmap', {}).result() for branch_name in branchmap: for branch_node in branchmap[branch_name]: @@ -189,11 +189,12 @@ def remotemarkers(ui, repo, source, opts): 'type': 'branch', 'name': branch_name, 'node': node.hex(branch_node), + 'description': None, }) with remote.commandexecutor() as e: - remotemarks = bookmarks.unhexlifybookmarks(e.callcommand('listkeys', { - 'namespace': 'bookmarks', + remotemarks = bookmarks.unhexlifybookmarks(e.callcommand(b'listkeys', { + b'namespace': b'bookmarks', }).result()) for mark in remotemarks: @@ -201,6 +202,7 @@ def remotemarkers(ui, repo, source, opts): 'type': 'bookmark', 'name': mark, 'node': node.hex(remotemarks[mark]), + 'description': None, }) return markers