diff mercurial/commands.py @ 23762:0390cc327dd5

debugnamecomplete: rename from debuglabelcomplete Now that we have decided on the use of 'name' instead of 'label' we rename this function accordingly. The old method 'debuglabelcomplete' has been left as a deprecated command so that current scripts don't break.
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 17 Oct 2014 13:41:29 -0700
parents 3a4d8a6ce432
children 7ad155e13f0f
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Dec 22 09:07:37 2014 -0800
+++ b/mercurial/commands.py	Fri Oct 17 13:41:29 2014 -0700
@@ -2344,18 +2344,23 @@
 
 @command('debuglabelcomplete', [], _('LABEL...'))
 def debuglabelcomplete(ui, repo, *args):
-    '''complete "labels" - tags, open branch names, bookmark names'''
-
-    labels = set()
-    labels.update(t[0] for t in repo.tagslist())
-    labels.update(repo._bookmarks.keys())
-    labels.update(tag for (tag, heads, tip, closed)
-                  in repo.branchmap().iterbranches() if not closed)
+    '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
+    debugnamecomplete(ui, repo, *args)
+
+@command('debugnamecomplete', [], _('NAME...'))
+def debugnamecomplete(ui, repo, *args):
+    '''complete "names" - tags, open branch names, bookmark names'''
+
+    names = set()
+    names.update(t[0] for t in repo.tagslist())
+    names.update(repo._bookmarks.keys())
+    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(l for l in labels if l.startswith(a))
+        completions.update(n for n in names if n.startswith(a))
     ui.write('\n'.join(sorted(completions)))
     ui.write('\n')