equal
deleted
inserted
replaced
19 class AmbiguousCommand(Exception): |
19 class AmbiguousCommand(Exception): |
20 """Exception raised if command shortcut matches more than one command.""" |
20 """Exception raised if command shortcut matches more than one command.""" |
21 class ParseError(Exception): |
21 class ParseError(Exception): |
22 """Exception raised on errors in parsing the command line.""" |
22 """Exception raised on errors in parsing the command line.""" |
23 |
23 |
24 def runcatch(ui, args, argv0=None): |
24 def runcatch(ui, args): |
25 def catchterm(*args): |
25 def catchterm(*args): |
26 raise util.SignalInterrupt |
26 raise util.SignalInterrupt |
27 |
27 |
28 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
28 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
29 num = getattr(signal, name, None) |
29 num = getattr(signal, name, None) |
33 try: |
33 try: |
34 # enter the debugger before command execution |
34 # enter the debugger before command execution |
35 if '--debugger' in args: |
35 if '--debugger' in args: |
36 pdb.set_trace() |
36 pdb.set_trace() |
37 try: |
37 try: |
38 return dispatch(ui, args, argv0=argv0) |
38 return dispatch(ui, args) |
39 finally: |
39 finally: |
40 ui.flush() |
40 ui.flush() |
41 except: |
41 except: |
42 # enter the debugger when we hit an exception |
42 # enter the debugger when we hit an exception |
43 if '--debugger' in args: |
43 if '--debugger' in args: |
275 argcount -= 1 |
275 argcount -= 1 |
276 else: |
276 else: |
277 pos += 1 |
277 pos += 1 |
278 return values |
278 return values |
279 |
279 |
280 def dispatch(ui, args, argv0=None): |
280 def dispatch(ui, args): |
281 # remember how to call 'hg' before changing the working dir |
|
282 util.set_hgexecutable(argv0) |
|
283 |
|
284 # read --config before doing anything else |
281 # read --config before doing anything else |
285 # (e.g. to change trust settings for reading .hg/hgrc) |
282 # (e.g. to change trust settings for reading .hg/hgrc) |
286 config = earlygetopt(['--config'], args) |
283 config = earlygetopt(['--config'], args) |
287 if config: |
284 if config: |
288 ui.updateopts(config=parseconfig(config)) |
285 ui.updateopts(config=parseconfig(config)) |