Mercurial adds multiple tags
A. Klitzing
aklitzing at online.de
Sun Feb 22 16:22:23 CST 2009
Hi there,
I found a strange behaviour of mercurial with tags.
It don't care if it is a local or a global tag.
If you provide the revision as hex on "hg tags -r" it will add two lines
if there is an existing tag with that name.
Same behaviour is with an extension if you use repo like
repo[opts.get('rev')]
before you call commands.tag().
If you don't use repo[] it will add only one line.
Is there any reason for that or is it a bug?
Tested: v1.1.2
Example with "hg tag":
$ hg init test
$ cd test
$ touch test
$ hg add test
$ hg ci -m "test"
$ hg tag -f -l -r 0 bla
$ hg tag -f -l -r 0 bla
$ cat .hg/localtags
671066518d0e56df080ffdf0774782a8db0e7733 bla
671066518d0e56df080ffdf0774782a8db0e7733 bla
$ rm .hg/localtags
$ hg id
671066518d0e tip
$ hg tag -f -l -r 671066518d0e bla
$ hg tag -f -l -r 671066518d0e bla
$ cat .hg/localtags
671066518d0e56df080ffdf0774782a8db0e7733 bla
671066518d0e56df080ffdf0774782a8db0e7733 bla
671066518d0e56df080ffdf0774782a8db0e7733 bla
Example with "extension":
from mercurial.i18n import gettext as _
from mercurial import commands
def main(ui, repo, *pats, **opts):
"""
$ hg test -r 0
$ hg test -r 0
$ cat .hg/localtags
84868863848a4078acd2fe030dab57f59c1802fd bla
84868863848a4078acd2fe030dab57f59c1802fd bla
$ rm .hg/localtags
$ hg test -r 84868863848a
$ hg test -r 84868863848a
$ cat .hg/localtags
84868863848a4078acd2fe030dab57f59c1802fd bla
84868863848a4078acd2fe030dab57f59c1802fd bla
84868863848a4078acd2fe030dab57f59c1802fd bla
"""
if opts.get('rev'):
repo[opts.get('rev')]
commands.tag(ui, repo, "bla", force=True, local=True)
else:
ui.write('Will add tag "bla" twice if tag exists and --rev is'
' given as hex instead of int\n')
cmdtable = {
"test": (main,
[
('r', 'rev', '', _('revision'))
],
_("hg test")),
}
Best regards,
André Klitzing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20090222/19734d59/attachment.pgp
More information about the Mercurial
mailing list