1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

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
This commit is contained in:
epriestley 2020-07-07 10:12:09 -07:00
parent a28e76b7b3
commit 41774ba9cc
2 changed files with 11 additions and 9 deletions

View file

@ -116,7 +116,7 @@ final class ArcanistMercurialLandEngine
throw new PhutilArgumentUsageException( throw new PhutilArgumentUsageException(
pht( pht(
'Symbol "%s" is ambiguous.', 'Symbol "%s" is ambiguous.',
$symbol)); $raw_symbol));
} }
$marker = head($named_markers); $marker = head($named_markers);
@ -493,6 +493,7 @@ final class ArcanistMercurialLandEngine
} }
protected function selectIntoCommit() { protected function selectIntoCommit() {
$api = $this->getRepositoryAPI();
$log = $this->getLogEngine(); $log = $this->getLogEngine();
if ($this->getIntoEmpty()) { if ($this->getIntoEmpty()) {
@ -508,7 +509,6 @@ final class ArcanistMercurialLandEngine
if ($this->getIntoLocal()) { if ($this->getIntoLocal()) {
// If we're running under "--into-local", just make sure that the // If we're running under "--into-local", just make sure that the
// target identifies some actual commit. // target identifies some actual commit.
$api = $this->getRepositoryAPI();
$local_ref = $this->getIntoRef(); $local_ref = $this->getIntoRef();
// TODO: This error handling could probably be cleaner, it will just // TODO: This error handling could probably be cleaner, it will just
@ -834,7 +834,7 @@ final class ArcanistMercurialLandEngine
try { try {
foreach ($body as $command) { foreach ($body as $command) {
$this->newPasthru('%Ls', $command); $this->newPassthru('%Ls', $command);
} }
} finally { } finally {
foreach ($tail as $command) { foreach ($tail as $command) {

View file

@ -31,9 +31,9 @@ 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
@ -166,7 +166,7 @@ def localmarkers(ui, repo):
'isClosed': False, 'isClosed': False,
'isTip': False, 'isTip': False,
'isCurrent': True, 'isCurrent': True,
'description': repo['.'].description(), 'description': repo[b'.'].description(),
}) })
return markers return markers
@ -181,7 +181,7 @@ def remotemarkers(ui, repo, source, opts):
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]:
@ -189,11 +189,12 @@ def remotemarkers(ui, repo, source, opts):
'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:
@ -201,6 +202,7 @@ def remotemarkers(ui, repo, source, opts):
'type': 'bookmark', 'type': 'bookmark',
'name': mark, 'name': mark,
'node': node.hex(remotemarks[mark]), 'node': node.hex(remotemarks[mark]),
'description': None,
}) })
return markers return markers