Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 14888:946f4381c1cb
alias: pass local ui to shell alias
This avoids an additional config read
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Jul 2011 18:03:37 -0500 |
parents | d6ba373c9a8f |
children | ebdfdba0faaf |
comparison
equal
deleted
inserted
replaced
14887:d6ba373c9a8f | 14888:946f4381c1cb |
---|---|
479 lui = ui.copy() | 479 lui = ui.copy() |
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(lui, ui, args): |
485 norepo = commands.norepo | 485 norepo = commands.norepo |
486 options = {} | 486 options = {} |
487 | 487 |
488 try: | 488 try: |
489 args = fancyopts.fancyopts(args, commands.globalopts, options) | 489 args = fancyopts.fancyopts(args, commands.globalopts, options) |
490 except fancyopts.getopt.GetoptError: | 490 except fancyopts.getopt.GetoptError: |
491 return | 491 return |
492 | 492 |
493 if not args: | 493 if not args: |
494 return | 494 return |
495 | |
496 path, lui = _getlocal(ui, [options['repository']]) | |
497 | 495 |
498 cmdtable = commands.table.copy() | 496 cmdtable = commands.table.copy() |
499 addaliases(lui, cmdtable) | 497 addaliases(lui, cmdtable) |
500 | 498 |
501 cmd = args[0] | 499 cmd = args[0] |
531 rpath = _earlygetopt(["-R", "--repository", "--repo"], args) | 529 rpath = _earlygetopt(["-R", "--repository", "--repo"], args) |
532 path, lui = _getlocal(ui, rpath) | 530 path, lui = _getlocal(ui, rpath) |
533 | 531 |
534 # Now that we're operating in the right directory/repository with | 532 # Now that we're operating in the right directory/repository with |
535 # the right config settings, check for shell aliases | 533 # the right config settings, check for shell aliases |
536 shellaliasfn = _checkshellalias(ui, args) | 534 shellaliasfn = _checkshellalias(lui, ui, args) |
537 if shellaliasfn: | 535 if shellaliasfn: |
538 return shellaliasfn() | 536 return shellaliasfn() |
539 | 537 |
540 # Configure extensions in phases: uisetup, extsetup, cmdtable, and | 538 # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
541 # reposetup. Programs like TortoiseHg will call _dispatch several | 539 # reposetup. Programs like TortoiseHg will call _dispatch several |