# HG changeset patch # User Thomas Arendsen Hein # Date 1181662797 -7200 # Node ID a73d80d6385a463149a2f21b7c4165cf368849d7 # Parent 050fa240db9cebc0fb6238c09de40fcfb867bb95 Revive commands.dispatch as a simple way to call hg from other pythons scripts. This was already used by hg-ssh and others and is really convenient if you just want a native equivalent of calling the command line version. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2997,11 +2997,13 @@ norepo = ("clone init version help debug " debugindex debugindexdot debugdate debuginstall") optionalrepo = ("paths serve showconfig") -def run(): +def dispatch(args): try: - u = ui.ui(traceback='--traceback' in sys.argv[1:]) + u = ui.ui(traceback='--traceback' in args) except util.Abort, inst: sys.stderr.write(_("abort: %s\n") % inst) return -1 - sys.exit(cmdutil.runcatch(u, sys.argv[1:])) - + return cmdutil.runcatch(u, args) + +def run(): + sys.exit(dispatch(sys.argv[1:]))