comparison mercurial/localrepo.py @ 31669:a719f3315366

tags: move 'repo.tag' in the 'tags' module Similar logic, pretty much nobody use this method (that creates a tag) so we move it into the 'tags' module were it belong.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 27 Mar 2017 15:58:31 +0200
parents 7d0459706716
children e6fd7930cf0b
comparison
equal deleted inserted replaced
31668:7d0459706716 31669:a719f3315366
648 replacing code that is expected to call a hook. 648 replacing code that is expected to call a hook.
649 """ 649 """
650 return hook.hook(self.ui, self, name, throw, **args) 650 return hook.hook(self.ui, self, name, throw, **args)
651 651
652 def tag(self, names, node, message, local, user, date, editor=False): 652 def tag(self, names, node, message, local, user, date, editor=False):
653 '''tag a revision with one or more symbolic names. 653 tagsmod.tag(self, names, node, message, local, user, date,
654 654 editor=editor)
655 names is a list of strings or, when adding a single tag, names may be a
656 string.
657
658 if local is True, the tags are stored in a per-repository file.
659 otherwise, they are stored in the .hgtags file, and a new
660 changeset is committed with the change.
661
662 keyword arguments:
663
664 local: whether to store tags in non-version-controlled file
665 (default False)
666
667 message: commit message to use if committing
668
669 user: name of user to use if committing
670
671 date: date tuple to use if committing'''
672
673 if not local:
674 m = matchmod.exact(self.root, '', ['.hgtags'])
675 if any(self.status(match=m, unknown=True, ignored=True)):
676 raise error.Abort(_('working copy of .hgtags is changed'),
677 hint=_('please commit .hgtags manually'))
678
679 self.tags() # instantiate the cache
680 tagsmod._tag(self.unfiltered(), names, node, message, local, user, date,
681 editor=editor)
682 655
683 @filteredpropertycache 656 @filteredpropertycache
684 def _tagscache(self): 657 def _tagscache(self):
685 '''Returns a tagscache object that contains various tags related 658 '''Returns a tagscache object that contains various tags related
686 caches.''' 659 caches.'''