477 |
477 |
478 def hook(self, name, throw=False, **args): |
478 def hook(self, name, throw=False, **args): |
479 return hook.hook(self.ui, self, name, throw, **args) |
479 return hook.hook(self.ui, self, name, throw, **args) |
480 |
480 |
481 @unfilteredmethod |
481 @unfilteredmethod |
482 def _tag(self, names, node, message, local, user, date, extra={}): |
482 def _tag(self, names, node, message, local, user, date, extra={}, |
|
483 editor=False): |
483 if isinstance(names, str): |
484 if isinstance(names, str): |
484 names = (names,) |
485 names = (names,) |
485 |
486 |
486 branches = self.branchmap() |
487 branches = self.branchmap() |
487 for name in names: |
488 for name in names: |
537 |
538 |
538 if '.hgtags' not in self.dirstate: |
539 if '.hgtags' not in self.dirstate: |
539 self[None].add(['.hgtags']) |
540 self[None].add(['.hgtags']) |
540 |
541 |
541 m = matchmod.exact(self.root, '', ['.hgtags']) |
542 m = matchmod.exact(self.root, '', ['.hgtags']) |
542 tagnode = self.commit(message, user, date, extra=extra, match=m) |
543 tagnode = self.commit(message, user, date, extra=extra, match=m, |
|
544 editor=editor) |
543 |
545 |
544 for name in names: |
546 for name in names: |
545 self.hook('tag', node=hex(node), tag=name, local=local) |
547 self.hook('tag', node=hex(node), tag=name, local=local) |
546 |
548 |
547 return tagnode |
549 return tagnode |
548 |
550 |
549 def tag(self, names, node, message, local, user, date): |
551 def tag(self, names, node, message, local, user, date, editor=False): |
550 '''tag a revision with one or more symbolic names. |
552 '''tag a revision with one or more symbolic names. |
551 |
553 |
552 names is a list of strings or, when adding a single tag, names may be a |
554 names is a list of strings or, when adding a single tag, names may be a |
553 string. |
555 string. |
554 |
556 |
572 if '.hgtags' in x: |
574 if '.hgtags' in x: |
573 raise util.Abort(_('working copy of .hgtags is changed ' |
575 raise util.Abort(_('working copy of .hgtags is changed ' |
574 '(please commit .hgtags manually)')) |
576 '(please commit .hgtags manually)')) |
575 |
577 |
576 self.tags() # instantiate the cache |
578 self.tags() # instantiate the cache |
577 self._tag(names, node, message, local, user, date) |
579 self._tag(names, node, message, local, user, date, editor=editor) |
578 |
580 |
579 @filteredpropertycache |
581 @filteredpropertycache |
580 def _tagscache(self): |
582 def _tagscache(self): |
581 '''Returns a tagscache object that contains various tags related |
583 '''Returns a tagscache object that contains various tags related |
582 caches.''' |
584 caches.''' |