fix 'hg tag <tagname> <revision>
- fix a collision with the option keyword rev and the option
name
- update the tests
--- a/mercurial/commands.py Thu Dec 22 13:18:44 2005 -0600
+++ b/mercurial/commands.py Tue Dec 27 12:52:10 2005 -0600
@@ -2019,7 +2019,7 @@
for f in changes:
ui.write(format % f)
-def tag(ui, repo, name, rev=None, **opts):
+def tag(ui, repo, name, rev_=None, **opts):
"""add a tag for the current tip or a given revision
Name a particular revision using <name>.
@@ -2037,10 +2037,10 @@
"""
if name == "tip":
raise util.Abort(_("the name 'tip' is reserved"))
- if 'rev' in opts:
- rev = opts['rev']
- if rev:
- r = hex(repo.lookup(rev))
+ if opts['rev']:
+ rev_ = opts['rev']
+ if rev_:
+ r = hex(repo.lookup(rev_))
else:
r = hex(repo.changelog.tip())
--- a/tests/test-tag Thu Dec 22 13:18:44 2005 -0600
+++ b/tests/test-tag Tue Dec 27 12:52:10 2005 -0600
@@ -11,6 +11,13 @@
echo foo >> .hgtags
hg tag -d "0 0" "bleah2" || echo "failed"
+hg revert .hgtags
+hg tag -d "0 0" -r 0 "bleah0"
+hg tag -l -d "0 0" "bleah1" 1
+
+cat .hgtags
+cat .hg/localtags
+
hg tag -l 'xx
newline'
hg tag -l 'xx:xx'
--- a/tests/test-tag.out Thu Dec 22 13:18:44 2005 -0600
+++ b/tests/test-tag.out Tue Dec 27 12:52:10 2005 -0600
@@ -18,5 +18,8 @@
abort: working copy of .hgtags is changed (please commit .hgtags manually)
failed
+acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
+acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
+863197ef03781c4fc00276d83eb66c4cb9cd91df bleah1
abort: '\n' cannot be used in a tag name
abort: ':' cannot be used in a tag name