It's currently possible to tag the null revision. A couple of people have discovered this by accident by doing hg clone -U source repo cd repo hg tag foo But it's also easy to do like this: hg tag -r 00000000000000 foo or hg tag -r -1 foo However you do it, it's bad, because Mercurial uses the null changeset ID in .hgtags to mark a tag deleted. We should simply disallow tagging the null revision.
Issue916 is related but not the same: I believe that the complaint there is that tagging in a bare repository creates a new root. I do not propose to do anything about that.
On 19.11.2009 23:36, Greg Ward wrote: > However you do it, it's bad, because Mercurial uses the null changeset ID in > .hgtags to mark a tag deleted. How can that happen in a regular use case? (Mercurial setting a tag in .hgtags to the nullid)
> How can that happen in a regular use case? (Mercurial setting a tag in > .hgtags to the nullid) Easy: consider the case where tag1 exists: $ cat .hgtags 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 Then I delete that tag: $ hg tag --remove tag1 $ cat .hgtags 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 0000000000000000000000000000000000000000 tag1 But I can get that same result by tagging null: $ hg rollback $ hg revert . $ cat .hgtags 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 $ hg tag -r 00000000000 -f tag1 $ cat .hgtags 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 7d8f0497b8598ad1bac89cdad117db1b896903e5 tag1 0000000000000000000000000000000000000000 tag1 So in the simple case, "tag -r 000000000" is a backdoor way to remove a tag. That's just weird, and it exposes an implementation detail. In the case where my colleague discovered the bug, tagging in an empty repo creates a strange tag: $ hg up null $ hg tag tag2 $ cat .hgtags 0000000000000000000000000000000000000000 tag2 $ hg tags tip 4:5f1d9a32ce13 Note that tag2 doesn't actually exist, because it's "deleted". It's just weird. That's why tagging null should be disallowed (IMHO, but I think Matt agrees).
Seems reasonable.
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:04 EDT --- This bug was previously known as _bug_ 1915 at http://mercurial.selenic.com/bts/issue1915
Fixed by http://selenic.com/repo/hg/rev/e432fb4b4221 Brad Hall <bhall@fb.com> tag: don't allow tagging the null revision (issue1915) Also fixed the tests that were doing this and expected it to work (please test the fix)
Mass close old bugs in testing.