Patchwork [2,of,6] debugcommands: move 'debugpvec' in the new module

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 14, 2017, 6:36 p.m.
Message ID <e4f463fec5ef6ec538e0.1487097379@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18483/
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 1486025987 -3600
#      Thu Feb 02 09:59:47 2017 +0100
# Node ID e4f463fec5ef6ec538e007686e0374a90cc59aa4
# Parent  34832654f1a3c94a314aca08623db19ce52c055d
# EXP-Topic debugcommands
debugcommands: move 'debugpvec' in the new module

Patch

diff -r 34832654f1a3 -r e4f463fec5ef mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 01 17:48:30 2017 +0100
+++ b/mercurial/commands.py	Thu Feb 02 09:59:47 2017 +0100
@@ -46,7 +46,6 @@  from . import (
     obsolete,
     patch,
     phases,
-    pvec,
     pycompat,
     repair,
     revlog,
@@ -1860,27 +1859,6 @@  def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
-@command('debugpvec', [], _('A B'))
-def debugpvec(ui, repo, a, b=None):
-    ca = scmutil.revsingle(repo, a)
-    cb = scmutil.revsingle(repo, b)
-    pa = pvec.ctxpvec(ca)
-    pb = pvec.ctxpvec(cb)
-    if pa == pb:
-        rel = "="
-    elif pa > pb:
-        rel = ">"
-    elif pa < pb:
-        rel = "<"
-    elif pa | pb:
-        rel = "|"
-    ui.write(_("a: %s\n") % pa)
-    ui.write(_("b: %s\n") % pb)
-    ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
-    ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
-             (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
-              pa.distance(pb), rel))
-
 @command('debugrebuilddirstate|debugrebuildstate',
     [('r', 'rev', '', _('revision to rebuild to'), _('REV')),
      ('', 'minimal', None, _('only rebuild files that are inconsistent with '
diff -r 34832654f1a3 -r e4f463fec5ef mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Wed Feb 01 17:48:30 2017 +0100
+++ b/mercurial/debugcommands.py	Thu Feb 02 09:59:47 2017 +0100
@@ -43,6 +43,7 @@  from . import (
     merge as mergemod,
     obsolete,
     policy,
+    pvec,
     pycompat,
     repair,
     revlog,
@@ -1435,6 +1436,27 @@  def debugpushkey(ui, repopath, namespace
             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)
+    cb = scmutil.revsingle(repo, b)
+    pa = pvec.ctxpvec(ca)
+    pb = pvec.ctxpvec(cb)
+    if pa == pb:
+        rel = "="
+    elif pa > pb:
+        rel = ">"
+    elif pa < pb:
+        rel = "<"
+    elif pa | pb:
+        rel = "|"
+    ui.write(_("a: %s\n") % pa)
+    ui.write(_("b: %s\n") % pb)
+    ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth))
+    ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") %
+             (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec),
+              pa.distance(pb), rel))
+
 @command('debugupgraderepo', [
     ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
     ('', 'run', False, _('performs an upgrade')),