mercurial/localrepo.py
changeset 7016 58dcf10eea2b
parent 7009 3d54cf97598d
child 7064 582dac23ebac
equal deleted inserted replaced
7009:3d54cf97598d 7016:58dcf10eea2b
   219         for x in self.status()[:5]:
   219         for x in self.status()[:5]:
   220             if '.hgtags' in x:
   220             if '.hgtags' in x:
   221                 raise util.Abort(_('working copy of .hgtags is changed '
   221                 raise util.Abort(_('working copy of .hgtags is changed '
   222                                    '(please commit .hgtags manually)'))
   222                                    '(please commit .hgtags manually)'))
   223 
   223 
   224         parents = self[None].parents()
   224         self._tag(names, node, message, local, user, date)
   225         parent = None
       
   226         # use tip instead of the parent rev if there's no working copy
       
   227         # (avoid creating a new head)
       
   228         if len(parents) == 1 and parents[0].node() == nullid:
       
   229             parent = self['tip'].node()
       
   230         self._tag(names, node, message, local, user, date, parent=parent)
       
   231 
   225 
   232     def tags(self):
   226     def tags(self):
   233         '''return a mapping of tag to node'''
   227         '''return a mapping of tag to node'''
   234         if self.tagscache:
   228         if self.tagscache:
   235             return self.tagscache
   229             return self.tagscache