comparison mercurial/commands.py @ 4558:a73d80d6385a

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.
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 12 Jun 2007 17:39:57 +0200
parents 0c61124ad877
children 6a8e1dd18ba2
comparison
equal deleted inserted replaced
4557:050fa240db9c 4558:a73d80d6385a
2995 2995
2996 norepo = ("clone init version help debugancestor debugcomplete debugdata" 2996 norepo = ("clone init version help debugancestor debugcomplete debugdata"
2997 " debugindex debugindexdot debugdate debuginstall") 2997 " debugindex debugindexdot debugdate debuginstall")
2998 optionalrepo = ("paths serve showconfig") 2998 optionalrepo = ("paths serve showconfig")
2999 2999
3000 def run(): 3000 def dispatch(args):
3001 try: 3001 try:
3002 u = ui.ui(traceback='--traceback' in sys.argv[1:]) 3002 u = ui.ui(traceback='--traceback' in args)
3003 except util.Abort, inst: 3003 except util.Abort, inst:
3004 sys.stderr.write(_("abort: %s\n") % inst) 3004 sys.stderr.write(_("abort: %s\n") % inst)
3005 return -1 3005 return -1
3006 sys.exit(cmdutil.runcatch(u, sys.argv[1:])) 3006 return cmdutil.runcatch(u, args)
3007 3007
3008 def run():
3009 sys.exit(dispatch(sys.argv[1:]))