开发者

Using the Hg Convert Extension, Branchmap Option

I've got 2 Mercurial repositories RepoA and RepoB, 2 people have been working independenlty on each of their repos, RepoA only has one branch(Default) but 9 commits, RepoB has 2 branches, Default and Experiment1, each of these branches have approx 30 commits. Now it turns out that RepoB is a subset of RepoA, i.e alot of the stuff in RepoB can be put into RepoA. I'd like to Pull(import) all the contents of RepoB into a branch in RepoA. I do not want the import to go the Default branch of RepoA but rather a named branch in RepoA, called Developer1WIP. I specifically need to know

  1. How can I create a named branch(Developer1WIP) in RepoA and import ALL of RepoB into the Developer1WIP Branch on RepoA

I believe the HgConvert Extension with bran开发者_开发问答ch-map is a good way forward. "The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository."....

  1. what is this file?
  2. where is it to be created & what should be in it?
  3. Can I get some examples of exactly how to use this command in Windows?

,


Everything is documented in the Mercurial wiki, here's an excerpt from the ConvertExtension page:

...

--branchmap

Since v1.3

The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository. When used in conjunction with a splicemap, it allows for a powerful combination to help fix even the most badly mismanaged repositories and turn them into nicely structured Mercurial repositories. The branchmap contains lines of the form

original_branch_name new_branch_name

"original_branch_name" is the name of the branch in the source repository, and "new_branch_name" is the name of the branch is the destination repository. This can be used to move code in one repository from "default" to a named branch.

Remember that "default" identifies the default branch of Mercurial repositories, which is not displayed by default by log, heads or parents commands. To erase named branch markers, convert it to "default" with a branchmap like

original_branch_name default

The revisions will still be there but no longer attached to the original named branch.

...

So basically you'll create a textfile containing this:

default Developer1WIP
Experiment1 Developer1WIP

(do you want both default and Experiment1 on the same branch after conversion? your question was a bit unclear but I assumed you did.)

Then issue the convert command:

hg convert ORIGINAL_REPO CONVERTED_REPO --branchmap MAP.TXT
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜