diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -683,6 +683,12 @@ def debugancestor(ui, repo, *args): a = r.ancestor(lookup(rev1), lookup(rev2)) ui.write("%d:%s\n" % (r.rev(a), hex(a))) +def debugcommands(ui, cmd='', *args): + for cmd, vals in util.sort(table.iteritems()): + cmd = cmd.split('|')[0].strip('^') + opts = ', '.join([i[1] for i in vals[1]]) + ui.write('%s: %s\n' % (cmd, opts)) + def debugcomplete(ui, cmd='', **opts): """returns the completion list associated with the given command""" @@ -3134,6 +3140,7 @@ table = { _('[OPTION]... [SOURCE]... DEST')), "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')), "debugcheckstate": (debugcheckstate, []), + "debugcommands": (debugcommands, [], _('[COMMAND]')), "debugcomplete": (debugcomplete, [('o', 'options', None, _('show the command options'))], @@ -3416,6 +3423,6 @@ table = { "version": (version_, []), } -norepo = ("clone init version help debugcomplete debugdata" +norepo = ("clone init version help debugcommands debugcomplete debugdata" " debugindex debugindexdot debugdate debuginstall debugfsinfo") optionalrepo = ("identify paths serve showconfig debugancestor") diff --git a/tests/test-debugcomplete b/tests/test-debugcomplete --- a/tests/test-debugcomplete +++ b/tests/test-debugcomplete @@ -36,4 +36,8 @@ echo echo '% Show an error if we use --options with an ambiguous abbreviation' hg debugcomplete --options s +echo +echo '% Show all commands + options' +hg debugcommands + exit 0 diff --git a/tests/test-debugcomplete.out b/tests/test-debugcomplete.out --- a/tests/test-debugcomplete.out +++ b/tests/test-debugcomplete.out @@ -60,6 +60,7 @@ diff % Show debug commands if there are no other candidates debugancestor debugcheckstate +debugcommands debugcomplete debugconfig debugdata @@ -160,3 +161,69 @@ rawcommit % Show an error if we use --options with an ambiguous abbreviation hg: command 's' is ambiguous: serve showconfig status + +% Show all commands + options +add: include, exclude, dry-run +annotate: rev, follow, text, user, date, number, changeset, line-number, include, exclude +clone: noupdate, rev, pull, uncompressed, ssh, remotecmd +commit: addremove, close-branch, include, exclude, message, logfile, date, user +diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude +export: output, switch-parent, text, git, nodates +init: ssh, remotecmd +log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, prune, patch, git, limit, no-merges, style, template, include, exclude +merge: force, rev +parents: rev, style, template +pull: update, force, rev, ssh, remotecmd +push: force, rev, ssh, remotecmd +remove: after, force, include, exclude +serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, webdir-conf, pid-file, stdio, templates, style, ipv6, certificate +status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, include, exclude +update: clean, date, rev +addremove: similarity, include, exclude, dry-run +archive: no-decode, prefix, rev, type, include, exclude +backout: merge, parent, rev, include, exclude, message, logfile, date, user +bisect: reset, good, bad, skip, command, noupdate +branch: force, clean +branches: active +bundle: force, rev, base, all, type, ssh, remotecmd +cat: output, rev, decode, include, exclude +copy: after, force, include, exclude, dry-run +debugancestor: +debugcheckstate: +debugcommands: +debugcomplete: options +debugdata: +debugdate: extended +debugfsinfo: +debugindex: +debugindexdot: +debuginstall: +debugrawcommit: parent, files, message, logfile, date, user +debugrebuildstate: rev +debugrename: rev +debugsetparents: +debugstate: nodates +debugwalk: include, exclude +grep: print0, all, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude +heads: rev, active, style, template +help: +identify: rev, num, id, branch, tags +import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity +incoming: force, newest-first, bundle, rev, patch, git, limit, no-merges, style, template, ssh, remotecmd +locate: rev, print0, fullpath, include, exclude +manifest: rev +outgoing: force, rev, newest-first, patch, git, limit, no-merges, style, template, ssh, remotecmd +paths: +recover: +rename: after, force, include, exclude, dry-run +resolve: all, list, mark, unmark, include, exclude +revert: all, date, rev, no-backup, include, exclude, dry-run +rollback: +root: +showconfig: untrusted +tag: force, local, rev, remove, message, date, user +tags: +tip: patch, git, style, template +unbundle: update +verify: +version: