debugnamecomplete: rename from debuglabelcomplete
authorSean Farley <sean.michael.farley@gmail.com>
Fri, 17 Oct 2014 13:41:29 -0700
changeset 23762 0390cc327dd5
parent 23761 19d6271a70db
child 23763 7ad155e13f0f
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.
contrib/bash_completion
contrib/zsh_completion
mercurial/commands.py
tests/test-completion.t
tests/test-help.t
--- a/contrib/bash_completion	Mon Dec 22 09:07:37 2014 -0800
+++ b/contrib/bash_completion	Fri Oct 17 13:41:29 2014 -0700
@@ -110,7 +110,7 @@
 
 _hg_labels()
 {
-    local labels="$(_hg_cmd debuglabelcomplete "$cur")"
+    local labels="$(_hg_cmd debugnamecomplete "$cur")"
     local IFS=$'\n'
     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur"))
 }
--- a/contrib/zsh_completion	Mon Dec 22 09:07:37 2014 -0800
+++ b/contrib/zsh_completion	Fri Oct 17 13:41:29 2014 -0700
@@ -163,7 +163,7 @@
 }
 
 _hg_labels() {
-  labels=("${(f)$(_hg_cmd debuglabelcomplete)}")
+  labels=("${(f)$(_hg_cmd debugnamecomplete)}")
   (( $#labels )) && _describe -t labels 'labels' labels
 }
 
--- 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')
 
--- a/tests/test-completion.t	Mon Dec 22 09:07:37 2014 -0800
+++ b/tests/test-completion.t	Fri Oct 17 13:41:29 2014 -0700
@@ -90,6 +90,7 @@
   debugknown
   debuglabelcomplete
   debuglocks
+  debugnamecomplete
   debugobsolete
   debugpathcomplete
   debugpushkey
@@ -247,6 +248,7 @@
   debugknown: 
   debuglabelcomplete: 
   debuglocks: force-lock, force-wlock
+  debugnamecomplete: 
   debugobsolete: flags, record-parents, rev, date, user
   debugpathcomplete: full, normal, added, removed
   debugpushkey: 
@@ -321,16 +323,16 @@
   $ hg debugpathcomplete -r F
   Fum
 
-Test debuglabelcomplete
+Test debugnamecomplete
 
-  $ hg debuglabelcomplete
+  $ hg debugnamecomplete
   Fum
   default
   fee
   fie
   fo
   tip
-  $ hg debuglabelcomplete f
+  $ hg debugnamecomplete f
   fee
   fie
   fo
--- a/tests/test-help.t	Mon Dec 22 09:07:37 2014 -0800
+++ b/tests/test-help.t	Fri Oct 17 13:41:29 2014 -0700
@@ -780,9 +780,9 @@
                  dump an index DAG as a graphviz dot file
    debuginstall  test Mercurial installation
    debugknown    test whether node ids are known to a repo
-   debuglabelcomplete
-                 complete "labels" - tags, open branch names, bookmark names
    debuglocks    show or modify state of locks
+   debugnamecomplete
+                 complete "names" - tags, open branch names, bookmark names
    debugobsolete
                  create arbitrary obsolete marker
    debugoptDEP   (no help text available)