Patchwork [1,of,6] debugcommands: move 'debugpushkey' in the new module

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 14, 2017, 6:36 p.m.
Message ID <34832654f1a3c94a314a.1487097378@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18485/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 14, 2017, 6:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1485967710 -3600
#      Wed Feb 01 17:48:30 2017 +0100
# Node ID 34832654f1a3c94a314aca08623db19ce52c055d
# Parent  0df669daeeb0c94785bc05436b90a15ac0780372
# EXP-Topic debugcommands
debugcommands: move 'debugpushkey' in the new module

Patch

diff -r 0df669daeeb0 -r 34832654f1a3 mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 01 17:47:35 2017 +0100
+++ b/mercurial/commands.py	Wed Feb 01 17:48:30 2017 +0100
@@ -1860,27 +1860,6 @@  def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
-@command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
-def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
-    '''access the pushkey key/value protocol
-
-    With two args, list the keys in the given namespace.
-
-    With five args, set a key to new if it currently is set to old.
-    Reports success or failure.
-    '''
-
-    target = hg.peer(ui, {}, repopath)
-    if keyinfo:
-        key, old, new = keyinfo
-        r = target.pushkey(namespace, key, old, new)
-        ui.status(str(r) + '\n')
-        return not r
-    else:
-        for k, v in sorted(target.listkeys(namespace).iteritems()):
-            ui.write("%s\t%s\n" % (k.encode('string-escape'),
-                                   v.encode('string-escape')))
-
 @command('debugpvec', [], _('A B'))
 def debugpvec(ui, repo, a, b=None):
     ca = scmutil.revsingle(repo, a)
diff -r 0df669daeeb0 -r 34832654f1a3 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Wed Feb 01 17:47:35 2017 +0100
+++ b/mercurial/debugcommands.py	Wed Feb 01 17:48:30 2017 +0100
@@ -1414,6 +1414,27 @@  def debugpathcomplete(ui, repo, *specs, 
     ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
     ui.write('\n')
 
+@command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
+def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
+    '''access the pushkey key/value protocol
+
+    With two args, list the keys in the given namespace.
+
+    With five args, set a key to new if it currently is set to old.
+    Reports success or failure.
+    '''
+
+    target = hg.peer(ui, {}, repopath)
+    if keyinfo:
+        key, old, new = keyinfo
+        r = target.pushkey(namespace, key, old, new)
+        ui.status(str(r) + '\n')
+        return not r
+    else:
+        for k, v in sorted(target.listkeys(namespace).iteritems()):
+            ui.write("%s\t%s\n" % (k.encode('string-escape'),
+                                   v.encode('string-escape')))
+
 @command('debugupgraderepo', [
     ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
     ('', 'run', False, _('performs an upgrade')),