##// END OF EJS Templates
completion: add a debuglabelcomplete command...
Bryan O'Sullivan -
r18790:1e28a7f5 default
parent child Browse files
Show More
@@ -88,20 +88,6 b' shopt -s extglob'
88 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
88 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
89 }
89 }
90
90
91 _hg_tags()
92 {
93 local tags="$(_hg_cmd tags -q)"
94 local IFS=$'\n'
95 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur"))
96 }
97
98 _hg_branches()
99 {
100 local branches="$(_hg_cmd branches -q)"
101 local IFS=$'\n'
102 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
103 }
104
105 _hg_bookmarks()
91 _hg_bookmarks()
106 {
92 {
107 local bookmarks="$(_hg_cmd bookmarks -q)"
93 local bookmarks="$(_hg_cmd bookmarks -q)"
@@ -111,9 +97,9 b' shopt -s extglob'
111
97
112 _hg_labels()
98 _hg_labels()
113 {
99 {
114 _hg_tags
100 local labels="$(_hg_cmd debuglabelcomplete "$cur")"
115 _hg_branches
101 local IFS=$'\n'
116 _hg_bookmarks
102 COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$labels' -- "$cur"))
117 }
103 }
118
104
119 # this is "kind of" ugly...
105 # this is "kind of" ugly...
@@ -2072,6 +2072,22 b' def debugknown(ui, repopath, *ids, **opt'
2072 flags = repo.known([bin(s) for s in ids])
2072 flags = repo.known([bin(s) for s in ids])
2073 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
2073 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
2074
2074
2075 @command('debuglabelcomplete', [], _('LABEL...'))
2076 def debuglabelcomplete(ui, repo, *args):
2077 '''complete "labels" - tags, open branch names, bookmark names'''
2078
2079 labels = set()
2080 labels.update(t[0] for t in repo.tagslist())
2081 labels.update(repo[n].branch() for n in repo.heads())
2082 labels.update(repo._bookmarks.keys())
2083 completions = set()
2084 if not args:
2085 args = ['']
2086 for a in args:
2087 completions.update(l for l in labels if l.startswith(a))
2088 ui.write('\n'.join(sorted(completions)))
2089 ui.write('\n')
2090
2075 @command('debugobsolete',
2091 @command('debugobsolete',
2076 [('', 'flags', 0, _('markers flag')),
2092 [('', 'flags', 0, _('markers flag')),
2077 ] + commitopts2,
2093 ] + commitopts2,
General Comments 0
You need to be logged in to leave comments. Login now