[PATCH 5 of 6] debugcommands: move 'debugnamecomplete' in the new module

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1485967272 -3600
#      Wed Feb 01 17:41:12 2017 +0100
# Node ID c2262623d403dfb29714683a0c749336d17092cd
# Parent  185400e8b627ee92e3fb7c8a806363e7164ebaf7
# EXP-Topic debugcommands
debugcommands: move 'debugnamecomplete' in the new module

diff -r 185400e8b627 -r c2262623d403 mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 01 17:40:20 2017 +0100
+++ b/mercurial/commands.py	Wed Feb 01 17:41:12 2017 +0100
@@ -1862,26 +1862,6 @@ def copy(ui, repo, *pats, **opts):
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
- at command('debugnamecomplete', [], _('NAME...'))
-def debugnamecomplete(ui, repo, *args):
-    '''complete "names" - tags, open branch names, bookmark names'''
-
-    names = set()
-    # since we previously only listed open branches, we will handle that
-    # specially (after this for loop)
-    for name, ns in repo.names.iteritems():
-        if name != 'branches':
-            names.update(ns.listnames(repo))
-    names.update(tag for (tag, heads, tip, closed)
-                 in repo.branchmap().iterbranches() if not closed)
-    completions = set()
-    if not args:
-        args = ['']
-    for a in args:
-        completions.update(n for n in names if n.startswith(a))
-    ui.write('\n'.join(sorted(completions)))
-    ui.write('\n')
-
 @command('debuglocks',
          [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
           ('W', 'force-wlock', None,
diff -r 185400e8b627 -r c2262623d403 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Wed Feb 01 17:40:20 2017 +0100
+++ b/mercurial/debugcommands.py	Wed Feb 01 17:41:12 2017 +0100
@@ -1142,6 +1142,26 @@ def debugmergestate(ui, repo, *args):
         if ui.verbose:
             printrecords(2)
 
+ at command('debugnamecomplete', [], _('NAME...'))
+def debugnamecomplete(ui, repo, *args):
+    '''complete "names" - tags, open branch names, bookmark names'''
+
+    names = set()
+    # since we previously only listed open branches, we will handle that
+    # specially (after this for loop)
+    for name, ns in repo.names.iteritems():
+        if name != 'branches':
+            names.update(ns.listnames(repo))
+    names.update(tag for (tag, heads, tip, closed)
+                 in repo.branchmap().iterbranches() if not closed)
+    completions = set()
+    if not args:
+        args = ['']
+    for a in args:
+        completions.update(n for n in names if n.startswith(a))
+    ui.write('\n'.join(sorted(completions)))
+    ui.write('\n')
+
 @command('debugupgraderepo', [
     ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
     ('', 'run', False, _('performs an upgrade')),


More information about the Mercurial-devel mailing list