Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 2034:5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
make debugcomplete print one item per line (this is not needed for the
bash_completion script, but should be easier to use in other scripts)
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 01 Apr 2006 22:50:12 +0200 |
parents | e3280d350792 |
children | 107dc72880f8 |
comparison
equal
deleted
inserted
replaced
2033:e3280d350792 | 2034:5e7aff1b6ae1 |
---|---|
1270 """find the ancestor revision of two revisions in a given index""" | 1270 """find the ancestor revision of two revisions in a given index""" |
1271 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "") | 1271 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "") |
1272 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | 1272 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
1273 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | 1273 ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
1274 | 1274 |
1275 def debugcomplete(ui, cmd): | 1275 def debugcomplete(ui, cmd='', **opts): |
1276 """returns the completion list associated with the given command""" | 1276 """returns the completion list associated with the given command""" |
1277 | |
1278 if opts['options']: | |
1279 options = [] | |
1280 otables = [globalopts] | |
1281 if cmd: | |
1282 aliases, entry = find(cmd) | |
1283 otables.append(entry[1]) | |
1284 for t in otables: | |
1285 for o in t: | |
1286 if o[0]: | |
1287 options.append('-%s' % o[0]) | |
1288 options.append('--%s' % o[1]) | |
1289 ui.write("%s\n" % "\n".join(options)) | |
1290 return | |
1291 | |
1277 clist = findpossible(cmd).keys() | 1292 clist = findpossible(cmd).keys() |
1278 clist.sort() | 1293 clist.sort() |
1279 ui.write("%s\n" % " ".join(clist)) | 1294 ui.write("%s\n" % "\n".join(clist)) |
1280 | 1295 |
1281 def debugrebuildstate(ui, repo, rev=None): | 1296 def debugrebuildstate(ui, repo, rev=None): |
1282 """rebuild the dirstate as it would look like for the given revision""" | 1297 """rebuild the dirstate as it would look like for the given revision""" |
1283 if not rev: | 1298 if not rev: |
1284 rev = repo.changelog.tip() | 1299 rev = repo.changelog.tip() |
2851 _('forcibly copy over an existing managed file')), | 2866 _('forcibly copy over an existing managed file')), |
2852 ('I', 'include', [], _('include names matching the given patterns')), | 2867 ('I', 'include', [], _('include names matching the given patterns')), |
2853 ('X', 'exclude', [], _('exclude names matching the given patterns'))], | 2868 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
2854 _('hg copy [OPTION]... [SOURCE]... DEST')), | 2869 _('hg copy [OPTION]... [SOURCE]... DEST')), |
2855 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), | 2870 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
2856 "debugcomplete": (debugcomplete, [], _('debugcomplete CMD')), | 2871 "debugcomplete": |
2872 (debugcomplete, | |
2873 [('o', 'options', None, _('show the command options'))], | |
2874 _('debugcomplete [-o] CMD')), | |
2857 "debugrebuildstate": | 2875 "debugrebuildstate": |
2858 (debugrebuildstate, | 2876 (debugrebuildstate, |
2859 [('r', 'rev', '', _('revision to rebuild to'))], | 2877 [('r', 'rev', '', _('revision to rebuild to'))], |
2860 _('debugrebuildstate [-r REV] [REV]')), | 2878 _('debugrebuildstate [-r REV] [REV]')), |
2861 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | 2879 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |