Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jul 19 07:56:40 2006 -0700 +++ b/mercurial/commands.py Fri Jul 21 01:40:07 2006 +0200 @@ -2651,7 +2651,7 @@ very useful to compare different revision, to go back to significant earlier versions or to mark branch points as releases, etc. - If no revision is given, the tip is used. + If no revision is given, the parent of the working directory is used. To facilitate version control, distribution, and merging of tags, they are stored as a file named ".hgtags" which is managed @@ -2671,7 +2671,12 @@ if rev_: r = hex(repo.lookup(rev_)) else: - r = hex(repo.changelog.tip()) + p1, p2 = repo.dirstate.parents() + if p1 == nullid: + raise util.Abort(_('no revision to tag')) + if p2 != nullid: + raise util.Abort(_('outstanding uncommited merges')) + r = hex(p1) repo.tag(name, r, opts['local'], opts['message'], opts['user'], opts['date'])