diff --git a/contrib/bash_completion b/contrib/bash_completion --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -110,7 +110,7 @@ shopt -s extglob _hg_labels() { - local labels="$(_hg_cmd debuglabelcomplete "$cur")" + local labels="$(_hg_cmd debugnamecomplete "$cur")" local IFS=$'\n' COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur")) } diff --git a/contrib/zsh_completion b/contrib/zsh_completion --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -163,7 +163,7 @@ typeset -A _hg_cmd_globals } _hg_labels() { - labels=("${(f)$(_hg_cmd debuglabelcomplete)}") + labels=("${(f)$(_hg_cmd debugnamecomplete)}") (( $#labels )) && _describe -t labels 'labels' labels } diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2344,18 +2344,23 @@ def debugknown(ui, repopath, *ids, **opt @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') diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -90,6 +90,7 @@ Show debug commands if there are no othe debugknown debuglabelcomplete debuglocks + debugnamecomplete debugobsolete debugpathcomplete debugpushkey @@ -247,6 +248,7 @@ Show all commands + options 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 @@ Test debugpathcomplete $ 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 diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -780,9 +780,9 @@ Test list of internal help commands 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)