0

For example, I have the following history on my HG repository (i.e. I created a branch on rev. 80), named "Project X":

Project X Workbench:
-------------------------------------------------------------
·   85: Project X: version Z stable
·   84: Project X: improvements based on Project Model #3
| ·   83: Project Model: improvements #3
| ·   82: Project Model: improvements #2
| ·   81: Project Model: improvements #1
|_·   80: Project Model: created
·   79: Project X: code improvements
·   78: Project X: version Y stable
|   
[...]

Now I want to have two repositories, "Project" and "Model". The "Project" repository must have the main branch of "Project X" and the "Model" repository must have the branch created on rev. 80 (i.e., from rev. 80 to rev. 83):

Project Workbench:
-------------------------------------------------------------
·   81: Project X: version Z stable
·   80: Project X: improvements based on Project Model #3
·   79: Project X: code improvements
·   78: Project X: version Y stable
|   
[...]

Model Workbench:
-------------------------------------------------------------
·   3: Project Model: improvements #3
·   2: Project Model: improvements #2
·   1: Project Model: improvements #1
·   0: Project Model: created

How can I do that using HG commands? Or I can do that only "the hard way"?

Hard way:
---------
1. create another repository named "Model"
2. rev1 = 80, rev2 = 0
3. update "Project X" to (rev1 + rev2)
4. copy "Project X" code to "Model" folder
5. commit "Model" as rev2 using the same comments of "Project X" on (rev1 + rev2)
6. rev2++
7. go back to step 3 while rev2 < 4
8. on "Project X" strip rev1 and all its descendants
1

You can make you "hard way" a lot easier and shorter (in the assumption you don't rename named branch into default default in Model repository)

  1. Clone "Project X" repository to (new) "Project" repository, range 0:80 revisions hg clone -r 80 ProjectX Project (use real paths instead of names)
  2. Clone full "Project X" into "Model" hg clone -r 80 ProjectX Model
  3. Enable histedit extension (globally or only in Model)
  4. Run histedit with hash of changeset 0 as parameter and "drop" all changesets before rev 80

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.