##// END OF EJS Templates
dispatch: make cmdalias forward command attributes to function...
Yuya Nishihara -
r28621:d856e85a default
parent child Browse files
Show More
@@ -437,9 +437,6 b' class cmdalias(object):'
437 self.args = []
437 self.args = []
438 self.opts = []
438 self.opts = []
439 self.help = ''
439 self.help = ''
440 self.norepo = True
441 self.optionalrepo = False
442 self.inferrepo = False
443 self.badalias = None
440 self.badalias = None
444 self.unknowncmd = False
441 self.unknowncmd = False
445
442
@@ -501,12 +498,6 b' class cmdalias(object):'
501 self.fn, self.opts = tableentry
498 self.fn, self.opts = tableentry
502
499
503 self.args = aliasargs(self.fn, args)
500 self.args = aliasargs(self.fn, args)
504 if not self.fn.norepo:
505 self.norepo = False
506 if self.fn.optionalrepo:
507 self.optionalrepo = True
508 if self.fn.inferrepo:
509 self.inferrepo = True
510 if self.help.startswith("hg " + cmd):
501 if self.help.startswith("hg " + cmd):
511 # drop prefix in old-style help lines so hg shows the alias
502 # drop prefix in old-style help lines so hg shows the alias
512 self.help = self.help[4 + len(cmd):]
503 self.help = self.help[4 + len(cmd):]
@@ -520,6 +511,14 b' class cmdalias(object):'
520 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
511 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
521 % (self.name, cmd))
512 % (self.name, cmd))
522
513
514 def __getattr__(self, name):
515 adefaults = {'norepo': True, 'optionalrepo': False, 'inferrepo': False}
516 if name not in adefaults:
517 raise AttributeError(name)
518 if self.badalias or util.safehasattr(self, 'shell'):
519 return adefaults[name]
520 return getattr(self.fn, name)
521
523 def __call__(self, ui, *args, **opts):
522 def __call__(self, ui, *args, **opts):
524 if self.badalias:
523 if self.badalias:
525 hint = None
524 hint = None
General Comments 0
You need to be logged in to leave comments. Login now