Show More
@@ -384,7 +384,7 b' class cmdalias(object):' | |||
|
384 | 384 | self.cmdname = '' |
|
385 | 385 | self.definition = definition |
|
386 | 386 | self.fn = None |
|
387 | self.args = [] | |
|
387 | self.givenargs = [] | |
|
388 | 388 | self.opts = [] |
|
389 | 389 | self.help = '' |
|
390 | 390 | self.badalias = None |
@@ -432,7 +432,7 b' class cmdalias(object):' | |||
|
432 | 432 | % (self.name, inst)) |
|
433 | 433 | return |
|
434 | 434 | self.cmdname = cmd = args.pop(0) |
|
435 | args = map(util.expandpath, args) | |
|
435 | self.givenargs = args | |
|
436 | 436 | |
|
437 | 437 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): |
|
438 | 438 | if _earlygetopt([invalidarg], args): |
@@ -448,7 +448,6 b' class cmdalias(object):' | |||
|
448 | 448 | else: |
|
449 | 449 | self.fn, self.opts = tableentry |
|
450 | 450 | |
|
451 | self.args = aliasargs(self.fn, args) | |
|
452 | 451 | if self.help.startswith("hg " + cmd): |
|
453 | 452 | # drop prefix in old-style help lines so hg shows the alias |
|
454 | 453 | self.help = self.help[4 + len(cmd):] |
@@ -462,6 +461,11 b' class cmdalias(object):' | |||
|
462 | 461 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") |
|
463 | 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 | 469 | def __getattr__(self, name): |
|
466 | 470 | adefaults = {'norepo': True, 'optionalrepo': False, 'inferrepo': False} |
|
467 | 471 | if name not in adefaults: |
@@ -525,6 +525,24 b' invalid global arguments for normal comm' | |||
|
525 | 525 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
526 | 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 | 546 | This should show id: |
|
529 | 547 | |
|
530 | 548 | $ hg --config alias.log='id' log |
General Comments 0
You need to be logged in to leave comments.
Login now