Patchwork [3,of,6,V2] debugcommands: move 'debugnamecomplete' in the new module

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 14, 2017, 3:29 p.m.
Message ID <9b33954135851e92ae9c.1487086162@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18474/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Pierre-Yves David - Feb. 14, 2017, 3:29 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1485967272 -3600
#      Wed Feb 01 17:41:12 2017 +0100
# Node ID 9b33954135851e92ae9ce7f52af861fc7f008e78
# Parent  e0ef20f46903d4a65f87fc98c3c6894ba6c327fc
# EXP-Topic debugcommands
debugcommands: move 'debugnamecomplete' in the new module

Patch

diff -r e0ef20f46903 -r 9b3395413585 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)
 
-@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 e0ef20f46903 -r 9b3395413585 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)
 
+@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')),