Integrating different branches from external sources into a single Mercurial repository

Posted by dukeofgaming on Programmers See other posts from Programmers or by dukeofgaming
Published on 2012-06-18T01:22:22Z Indexed on 2012/06/18 3:23 UTC
Read the original article Hit count: 455

Filed under:
|
|
|

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 it.

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.

© Programmers or respective owner

Related posts about mercurial

Related posts about dvcs