mercurial/commands.py
changeset 2656 e57df017640d
parent 2655 ddf404954092
parent 2642 f47432ae5376
child 2662 2c5d5cf35034
equal deleted inserted replaced
2655:ddf404954092 2656:e57df017640d
  2664 
  2664 
  2665     Tags are used to name particular revisions of the repository and are
  2665     Tags are used to name particular revisions of the repository and are
  2666     very useful to compare different revision, to go back to significant
  2666     very useful to compare different revision, to go back to significant
  2667     earlier versions or to mark branch points as releases, etc.
  2667     earlier versions or to mark branch points as releases, etc.
  2668 
  2668 
  2669     If no revision is given, the tip is used.
  2669     If no revision is given, the parent of the working directory is used.
  2670 
  2670 
  2671     To facilitate version control, distribution, and merging of tags,
  2671     To facilitate version control, distribution, and merging of tags,
  2672     they are stored as a file named ".hgtags" which is managed
  2672     they are stored as a file named ".hgtags" which is managed
  2673     similarly to other project files and can be hand-edited if
  2673     similarly to other project files and can be hand-edited if
  2674     necessary.  The file '.hg/localtags' is used for local tags (not
  2674     necessary.  The file '.hg/localtags' is used for local tags (not
  2684     if opts['rev']:
  2684     if opts['rev']:
  2685         rev_ = opts['rev']
  2685         rev_ = opts['rev']
  2686     if rev_:
  2686     if rev_:
  2687         r = hex(repo.lookup(rev_))
  2687         r = hex(repo.lookup(rev_))
  2688     else:
  2688     else:
  2689         r = hex(repo.changelog.tip())
  2689         p1, p2 = repo.dirstate.parents()
       
  2690         if p1 == nullid:
       
  2691             raise util.Abort(_('no revision to tag'))
       
  2692         if p2 != nullid:
       
  2693             raise util.Abort(_('outstanding uncommitted merges'))
       
  2694         r = hex(p1)
  2690 
  2695 
  2691     repo.tag(name, r, opts['local'], opts['message'], opts['user'],
  2696     repo.tag(name, r, opts['local'], opts['message'], opts['user'],
  2692              opts['date'])
  2697              opts['date'])
  2693 
  2698 
  2694 def tags(ui, repo):
  2699 def tags(ui, repo):