changeset 30937:a9aa67ba3f96

debugcommands: move 'debugnamecomplete' in the new module
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 01 Feb 2017 17:41:12 +0100
parents 8de38479d60b
children 23c801570449
files mercurial/commands.py mercurial/debugcommands.py
diffstat 2 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
     with repo.wlock(False):
         return cmdutil.copy(ui, repo, pats, opts)
 
-@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,
--- 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 @@
         if ui.verbose:
             printrecords(2)
 
+@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')),