Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TortoiseHG merging local into branch head

I have a repo in TortoiseHG with a single branch (next version development), but modifications to the local (bug fixes)... something like...

Local 0-------3--4
       \
Branch  1--2

I want to do some more development on the branch version but with the subsequent Local changes merged into it. And I want to leave the local version in a state where I can continue development without the branch changed.

I'm not sure if what I'm asking is actually possible, or whether coming from a Visual SourceSafe environment is just clouding my ability to see something that should be obvious.

In fact, thinking about it a bit more (as I was writing the above) I'm wondering if my approach is the wrong way around. I should probably have continued with the future development in the local version and then create a bug-fix branch that I could have merged back into local one.

So the question is, is there a way to get around what I want to do with the current repo setup, or should I export the individual revisions and rebuild the repo from scratch? (Or any other options?)

like image 688
freefaller Avatar asked Oct 10 '11 11:10

freefaller


1 Answers

This seems like pretty normal Mercurial handling to me.

You have:

  1. Two branches
  2. Want to make sure one of the two branches have all the updates of the other
  3. Want to make sure that other branch does not have any of the updates from the first (yet)

You basically just have to merge the Local branch into the Branch branch at regular intervals, but not the other way around.

Whenever you merge to a branch, you first update to the head of that branch. This makes the changeset you commit to persist that merge be on that branch as well.

In other words, you would do this:

  1. Update to the head of Branch
  2. Right-click on the head of Local and select "Merge with local..." and go through with the merge
  3. Commit, this new changeset ends up being on the Branch branch

The Local branch is still blissfully unaware of the changes on the Branch branch.

like image 192
Lasse V. Karlsen Avatar answered Oct 11 '22 12:10

Lasse V. Karlsen