comparison mercurial/commands.py @ 2647:46182568b4ce

change 'hg tag' to tag the parent rev instead of tip
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 21 Jul 2006 01:40:07 +0200
parents 001703ec311d
children f47432ae5376
comparison
equal deleted inserted replaced
2640:02b6fa7bbfbf 2647:46182568b4ce
2649 2649
2650 Tags are used to name particular revisions of the repository and are 2650 Tags are used to name particular revisions of the repository and are
2651 very useful to compare different revision, to go back to significant 2651 very useful to compare different revision, to go back to significant
2652 earlier versions or to mark branch points as releases, etc. 2652 earlier versions or to mark branch points as releases, etc.
2653 2653
2654 If no revision is given, the tip is used. 2654 If no revision is given, the parent of the working directory is used.
2655 2655
2656 To facilitate version control, distribution, and merging of tags, 2656 To facilitate version control, distribution, and merging of tags,
2657 they are stored as a file named ".hgtags" which is managed 2657 they are stored as a file named ".hgtags" which is managed
2658 similarly to other project files and can be hand-edited if 2658 similarly to other project files and can be hand-edited if
2659 necessary. The file '.hg/localtags' is used for local tags (not 2659 necessary. The file '.hg/localtags' is used for local tags (not
2669 if opts['rev']: 2669 if opts['rev']:
2670 rev_ = opts['rev'] 2670 rev_ = opts['rev']
2671 if rev_: 2671 if rev_:
2672 r = hex(repo.lookup(rev_)) 2672 r = hex(repo.lookup(rev_))
2673 else: 2673 else:
2674 r = hex(repo.changelog.tip()) 2674 p1, p2 = repo.dirstate.parents()
2675 if p1 == nullid:
2676 raise util.Abort(_('no revision to tag'))
2677 if p2 != nullid:
2678 raise util.Abort(_('outstanding uncommited merges'))
2679 r = hex(p1)
2675 2680
2676 repo.tag(name, r, opts['local'], opts['message'], opts['user'], 2681 repo.tag(name, r, opts['local'], opts['message'], opts['user'],
2677 opts['date']) 2682 opts['date'])
2678 2683
2679 def tags(ui, repo): 2684 def tags(ui, repo):