[PATCH 2 of 6] debugcommands: move 'debugknown' in the new module

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Feb 13 11:07:12 EST 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1485966826 -3600
#      Wed Feb 01 17:33:46 2017 +0100
# Node ID f25d7b04bb99f20965efa0bf042b485d8bcd58b8
# Parent  d5a3d757ac5cd896ae3f6ea9b7e01dc655a8d6f0
# EXP-Topic debugcommands
debugcommands: move 'debugknown' in the new module

diff -r d5a3d757ac5c -r f25d7b04bb99 mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 01 17:31:05 2017 +0100
+++ b/mercurial/commands.py	Wed Feb 01 17:33:46 2017 +0100
@@ -1863,19 +1863,6 @@ def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
- at command('debugknown', [], _('REPO ID...'), norepo=True)
-def debugknown(ui, repopath, *ids, **opts):
-    """test whether node ids are known to a repo
-
-    Every ID must be a full-length hex node id string. Returns a list of 0s
-    and 1s indicating unknown/known.
-    """
-    repo = hg.peer(ui, opts, repopath)
-    if not repo.capable('known'):
-        raise error.Abort("known() not supported by target repository")
-    flags = repo.known([bin(s) for s in ids])
-    ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
-
 @command('debuglabelcomplete', [], _('LABEL...'))
 def debuglabelcomplete(ui, repo, *args):
     '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
diff -r d5a3d757ac5c -r f25d7b04bb99 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Wed Feb 01 17:31:05 2017 +0100
+++ b/mercurial/debugcommands.py	Wed Feb 01 17:33:46 2017 +0100
@@ -1023,6 +1023,19 @@ def debuginstall(ui, **opts):
 
     return problems
 
+ at command('debugknown', [], _('REPO ID...'), norepo=True)
+def debugknown(ui, repopath, *ids, **opts):
+    """test whether node ids are known to a repo
+
+    Every ID must be a full-length hex node id string. Returns a list of 0s
+    and 1s indicating unknown/known.
+    """
+    repo = hg.peer(ui, opts, repopath)
+    if not repo.capable('known'):
+        raise error.Abort("known() not supported by target repository")
+    flags = repo.known([bin(s) for s in ids])
+    ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
+
 @command('debugupgraderepo', [
     ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
     ('', 'run', False, _('performs an upgrade')),


More information about the Mercurial-devel mailing list