[PATCH 09 of 12] debuglabelcomplete: use labels instead of hardcoding tags and bookmarks

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 21 02:57:31 CDT 2014



On 08/18/2014 02:18 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1396319547 18000
> #      Mon Mar 31 21:32:27 2014 -0500
> # Node ID 186ccd3d9042c0c5ec8cb9b9b4d58a7386ea1c65
> # Parent  5e3722e0076cc2a3c92758ff762e2916ce05e569
> debuglabelcomplete: use labels instead of hardcoding tags and bookmarks
>
> This allows bash completion for arbitrary labels.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2293,12 +2293,12 @@ 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())
> +    for namespace, l in repo.alllabels().iteritems():
> +        labels.update(name for name, node in l.iteritems())

if you are going to drop the value anyway. use iterkeys()


>       labels.update(tag for (tag, heads, tip, closed)
>                     in repo.branchmap().iterbranches() if not closed)
>       completions = set()
>       if not args:
>           args = ['']
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list