Mercurial > hg
comparison mercurial/dispatch.py @ 14887:d6ba373c9a8f
aliases: drop cwd manipulation
Already done in _dispatch
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Jul 2011 16:06:54 -0500 |
parents | 9a3831d64ae2 |
children | 946f4381c1cb |
comparison
equal
deleted
inserted
replaced
14886:9a3831d64ae2 | 14887:d6ba373c9a8f |
---|---|
480 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | 480 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
481 | 481 |
482 return path, lui | 482 return path, lui |
483 | 483 |
484 def _checkshellalias(ui, args): | 484 def _checkshellalias(ui, args): |
485 cwd = os.getcwd() | |
486 norepo = commands.norepo | 485 norepo = commands.norepo |
487 options = {} | 486 options = {} |
488 | 487 |
489 try: | 488 try: |
490 args = fancyopts.fancyopts(args, commands.globalopts, options) | 489 args = fancyopts.fancyopts(args, commands.globalopts, options) |
492 return | 491 return |
493 | 492 |
494 if not args: | 493 if not args: |
495 return | 494 return |
496 | 495 |
497 _parseconfig(ui, options['config']) | |
498 if options['cwd']: | |
499 os.chdir(options['cwd']) | |
500 | |
501 path, lui = _getlocal(ui, [options['repository']]) | 496 path, lui = _getlocal(ui, [options['repository']]) |
502 | 497 |
503 cmdtable = commands.table.copy() | 498 cmdtable = commands.table.copy() |
504 addaliases(lui, cmdtable) | 499 addaliases(lui, cmdtable) |
505 | 500 |
506 cmd = args[0] | 501 cmd = args[0] |
507 try: | 502 try: |
508 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict")) | 503 aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict")) |
509 except (error.AmbiguousCommand, error.UnknownCommand): | 504 except (error.AmbiguousCommand, error.UnknownCommand): |
510 commands.norepo = norepo | 505 commands.norepo = norepo |
511 os.chdir(cwd) | |
512 return | 506 return |
513 | 507 |
514 cmd = aliases[0] | 508 cmd = aliases[0] |
515 fn = entry[0] | 509 fn = entry[0] |
516 | 510 |
517 if cmd and hasattr(fn, 'shell'): | 511 if cmd and hasattr(fn, 'shell'): |
518 d = lambda: fn(ui, *args[1:]) | 512 d = lambda: fn(ui, *args[1:]) |
519 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {}) | 513 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {}) |
520 | 514 |
521 commands.norepo = norepo | 515 commands.norepo = norepo |
522 os.chdir(cwd) | |
523 | 516 |
524 _loaded = set() | 517 _loaded = set() |
525 def _dispatch(req): | 518 def _dispatch(req): |
526 args = req.args | 519 args = req.args |
527 ui = req.ui | 520 ui = req.ui |