exchange: use command executor for pushkey
Differential Revision: https://phab.mercurial-scm.org/D3315
--- a/mercurial/debugcommands.py Fri Apr 13 11:30:44 2018 -0700
+++ b/mercurial/debugcommands.py Fri Apr 13 11:45:38 2018 -0700
@@ -1832,7 +1832,14 @@
target = hg.peer(ui, {}, repopath)
if keyinfo:
key, old, new = keyinfo
- r = target.pushkey(namespace, key, old, new)
+ with target.commandexecutor() as e:
+ r = e.callcommand('pushkey', {
+ 'namespace': namespace,
+ 'key': key,
+ 'old': old,
+ 'new': new,
+ }).result()
+
ui.status(pycompat.bytestr(r) + '\n')
return not r
else:
--- a/mercurial/exchange.py Fri Apr 13 11:30:44 2018 -0700
+++ b/mercurial/exchange.py Fri Apr 13 11:45:38 2018 -0700
@@ -1212,10 +1212,14 @@
outdated = [c for c in outdated if c.node() not in pheads]
# fallback to independent pushkey command
for newremotehead in outdated:
- r = pushop.remote.pushkey('phases',
- newremotehead.hex(),
- ('%d' % phases.draft),
- ('%d' % phases.public))
+ with pushop.remote.commandexecutor() as e:
+ r = e.callcommand('pushkey', {
+ 'namespace': 'phases',
+ 'key': newremotehead.hex(),
+ 'old': '%d' % phases.draft,
+ 'new': '%d' % phases.public
+ }).result()
+
if not r:
pushop.ui.warn(_('updating %s to public failed!\n')
% newremotehead)
@@ -1270,7 +1274,16 @@
action = 'export'
elif not new:
action = 'delete'
- if remote.pushkey('bookmarks', b, old, new):
+
+ with remote.commandexecutor() as e:
+ r = e.callcommand('pushkey', {
+ 'namespace': 'bookmarks',
+ 'key': b,
+ 'old': old,
+ 'new': new,
+ }).result()
+
+ if r:
ui.status(bookmsgmap[action][0] % b)
else:
ui.warn(bookmsgmap[action][1] % b)