how to import tags?

Hollis Blanchard hollis_blanchard at mentor.com
Wed May 23 22:15:00 UTC 2018


I run a mirror from Perforce into Mercurial. I use p4fastimport to do 
the actual conversion, but it doesn't handle P4's labels for me, so I 
have to look them up and commit them later. Also, my hg repositories are 
bare (no working directory).

When I import tags, after the regular commits, I end up with a commit 
graph like this:

null -> A -> B
null -> tag 1 -> tag 2

... because the repository is bare when I run 'hg tag 1', so it chooses 
null as the tag commit's parent. This is likely to break things and will 
definitely confuse users. It's catastrophic when the most recent commit 
is a tag, because suddenly tip has no files except .hgtags.

What to do?

1. Ideally p4fastimport would "just do it" for me, interleaving tag 
commits with code commits. However, it doesn't, and modifying it is 
difficult.

2. Commit tags as children of the correct head.

I don't see a 'tag' cmdline option for this, though: the parent commit 
is the parent of the working directory, without an ability to override. 
That means I would need to keep working directories for all these 
mirrors, and since there are GBs of working directories and millions of 
files, that would be significant overhead.

3. Don't use tags at all; use bookmarks. These are stored inside .hg, so 
don't need user-visible commits to change them, but (unlike local tags) 
are propagated during clone.

However, it would cause some user confusion when 'hg tags' comes up 
empty. Also, unlike a tag, if they commit/push the server's copy of the 
bookmark will move. Hmm, that's not good.

4. Other ideas?

Thanks!

-- 
Hollis Blanchard
Mentor Graphics Emulation Division



More information about the Mercurial-devel mailing list