[issue95] tagging a specific revision barfs with tag: invalid arguments

Benoit Boissinot benoit.boissinot at ens-lyon.fr
Sun Dec 25 21:15:26 UTC 2005


On 12/25/05, Muli Ben-Yehuda <mercurial-bugs at selenic.com> wrote:
> New submission from Muli Ben-Yehuda <mulix at mulix.org>:
>
> Trying to add a tag for a specific revision fails with 'tag: invalid arguments'.
>
> Depending on whether I specify '-r rev' or just 'rev' I get a different debug
> message (it's not clear which is the right form):
>
> muli at rhun:~/iommu/dma_ops/hg$ hg --debug tag K7
> bbf2d4386fcc5b4bb79e4bc94d8b812837376371
> tag() got multiple values for keyword argument 'rev'
> tag: invalid arguments
> hg tag [OPTION]... NAME [REV]
> ....

the following patch fixes it (bundle attached)
> muli at rhun:~/iommu/dma_ops/hg$ hg --debug tag K7 -r
> bbf2d4386fcc5b4bb79e4bc94d8b812837376371
> tag() takes at most 4 non-keyword arguments (5 given)
> tag: invalid arguments
> hg tag [OPTION]... NAME [REV]

options should be placed before the arguments

Merry Xmas,

Benoit

# HG changeset patch
# User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
# Node ID e7852c3d58e7a0f50eafd54be787ca6fd0a82037
# Parent  dca956c9767d6b6814a7b5fb6cdb005cc7511133
fix 'hg tag <tagname> <revision>

fix a collision with the option keyword rev and the option
name
update the tests

diff -r dca956c9767d -r e7852c3d58e7 mercurial/commands.py
--- a/mercurial/commands.py	Thu Dec 22 13:18:44 2005 -0600
+++ b/mercurial/commands.py	Sun Dec 25 22:07:35 2005 +0100
@@ -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>.
@@ -2038,9 +2038,9 @@
     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))
+        rev_ = opts['rev']
+    if rev_:
+        r = hex(repo.lookup(rev_))
     else:
         r = hex(repo.changelog.tip())
 
diff -r dca956c9767d -r e7852c3d58e7 tests/test-tag
--- a/tests/test-tag	Thu Dec 22 13:18:44 2005 -0600
+++ b/tests/test-tag	Sun Dec 25 22:07:35 2005 +0100
@@ -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'
diff -r dca956c9767d -r e7852c3d58e7 tests/test-tag.out
--- a/tests/test-tag.out	Thu Dec 22 13:18:44 2005 -0600
+++ b/tests/test-tag.out	Sun Dec 25 22:07:35 2005 +0100
@@ -18,5 +18,8 @@
 
 abort: working copy of .hgtags is changed (please commit .hgtags manually)
 failed
+acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
+acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
+f7712f94a3b991e5b388de7957aaeb5ce5babc63 bleah1
 abort: '\n' cannot be used in a tag name
 abort: ':' cannot be used in a tag name
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.hg
Type: application/octet-stream
Size: 1085 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20051225/c0de66d7/attachment-0001.obj>


More information about the Mercurial mailing list