Show More
@@ -384,7 +384,7 b' class cmdalias(object):' | |||||
384 | self.cmdname = '' |
|
384 | self.cmdname = '' | |
385 | self.definition = definition |
|
385 | self.definition = definition | |
386 | self.fn = None |
|
386 | self.fn = None | |
387 | self.args = [] |
|
387 | self.givenargs = [] | |
388 | self.opts = [] |
|
388 | self.opts = [] | |
389 | self.help = '' |
|
389 | self.help = '' | |
390 | self.badalias = None |
|
390 | self.badalias = None | |
@@ -432,7 +432,7 b' class cmdalias(object):' | |||||
432 | % (self.name, inst)) |
|
432 | % (self.name, inst)) | |
433 | return |
|
433 | return | |
434 | self.cmdname = cmd = args.pop(0) |
|
434 | self.cmdname = cmd = args.pop(0) | |
435 | args = map(util.expandpath, args) |
|
435 | self.givenargs = args | |
436 |
|
436 | |||
437 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): |
|
437 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): | |
438 | if _earlygetopt([invalidarg], args): |
|
438 | if _earlygetopt([invalidarg], args): | |
@@ -448,7 +448,6 b' class cmdalias(object):' | |||||
448 | else: |
|
448 | else: | |
449 | self.fn, self.opts = tableentry |
|
449 | self.fn, self.opts = tableentry | |
450 |
|
450 | |||
451 | self.args = aliasargs(self.fn, args) |
|
|||
452 | if self.help.startswith("hg " + cmd): |
|
451 | if self.help.startswith("hg " + cmd): | |
453 | # drop prefix in old-style help lines so hg shows the alias |
|
452 | # drop prefix in old-style help lines so hg shows the alias | |
454 | self.help = self.help[4 + len(cmd):] |
|
453 | self.help = self.help[4 + len(cmd):] | |
@@ -462,6 +461,11 b' class cmdalias(object):' | |||||
462 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") |
|
461 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") | |
463 | % (self.name, cmd)) |
|
462 | % (self.name, cmd)) | |
464 |
|
463 | |||
|
464 | @property | |||
|
465 | def args(self): | |||
|
466 | args = map(util.expandpath, self.givenargs) | |||
|
467 | return aliasargs(self.fn, args) | |||
|
468 | ||||
465 | def __getattr__(self, name): |
|
469 | def __getattr__(self, name): | |
466 | adefaults = {'norepo': True, 'optionalrepo': False, 'inferrepo': False} |
|
470 | adefaults = {'norepo': True, 'optionalrepo': False, 'inferrepo': False} | |
467 | if name not in adefaults: |
|
471 | if name not in adefaults: |
@@ -525,6 +525,24 b' invalid global arguments for normal comm' | |||||
525 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
525 | (use "hg help" for the full list of commands or "hg -v" for details) | |
526 | [255] |
|
526 | [255] | |
527 |
|
527 | |||
|
528 | environment variable changes in alias commands | |||
|
529 | ||||
|
530 | $ cat > $TESTTMP/setcount.py <<EOF | |||
|
531 | > import os | |||
|
532 | > def uisetup(ui): | |||
|
533 | > os.environ['COUNT'] = '2' | |||
|
534 | > EOF | |||
|
535 | ||||
|
536 | $ cat >> $HGRCPATH <<'EOF' | |||
|
537 | > [extensions] | |||
|
538 | > setcount = $TESTTMP/setcount.py | |||
|
539 | > [alias] | |||
|
540 | > showcount = log -T "$COUNT\n" -r . | |||
|
541 | > EOF | |||
|
542 | ||||
|
543 | $ COUNT=1 hg showcount | |||
|
544 | 2 | |||
|
545 | ||||
528 | This should show id: |
|
546 | This should show id: | |
529 |
|
547 | |||
530 | $ hg --config alias.log='id' log |
|
548 | $ hg --config alias.log='id' log |
General Comments 0
You need to be logged in to leave comments.
Login now