D3315: exchange: use command executor for pushkey

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Apr 13 19:15:36 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3315

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -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)
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -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:



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list