Edit: Making this even clearer as the bounty is about to expire: is there a way of importing history (pulling from different SCM) directly into a specific branch with Mercurial?
I'm currently working in a company using Perforce and am making way for distributed version control with Mercurial. I've had success importing Perforce history using the perfarce (quite a suitable name, I laugh every time I see/say it) however, this only works with a single branch at a time.
Here's how my P4 integration setup works:
- In perforce, create a "client", which is kind of a description of what you will be constantly updating/checking-out. This can only address one branch at a time (trunk or other).
- Once you do this, run
hg clone p4://<server>/<client_name>
- Go to .hg/hgrc and put the perforce path line:
perforce = p4://<server>/<client_name>
- Work normally with the code under mercurial, do
hg pull perforce
to sync up,hg push
to export a changelist
What I'd like to be able to do is have a perforce path per branch and have everything work in the same repository. Now, pushing is not a problem, however, if I pull the history from another branch it would end up at the default branch.
I'd like to be able to do something like hg pull perforce-R5
and have it land in mercurial's R5 branch. Even if I have no merging history, it would be sweet enough to be able to preserve the branch's history.
There are also other plugins for CVCSs that let you integrate mercurial, but AFAIK the subversion one has the same problem.
I don't think there is a straight-through way of doing this, but as long as I could automate the process with some hooks and scripts in a single Mercurial machine, that would be good enough.
Edit: To make things a little clearer:
- Perforce trunk is mapped to Mercurial's default branch
- Perforce R1 branch should be mapped to Mercurial's release-1 branch (same for R2, R3, etc.)
- When I tell Mercurial to pull from perforce (i.e.
hg pull perforce
, where "perforce" is the name of the path pointing to the Perforce client) it should pull the Perforce trunk into Mercurial's default. - When I tell Mercurial to pull from perforce-R1 (i.e.
hg pull perforce-R1
, where "perforce-R1" is the path to the R1 client) it should pull the Perforce R1 branch to Mercurial's "release-1" branch. THIS IS THE PART I'M ASKING ABOUT.