2
votes

In effect, I would like to do the opposite of "Merge with local"

To clarify: We have a release branch and a default branch. When doing bug fixes on the release branch, here's the routine:

  1. Update to the release branch
  2. Implement bug fix, and commit
  3. Update to the default branch
  4. Right-click on the bug fix commit from the release branch, and select "Merge with local..."

Since a lot of work is done on the release branch, it gets tedious to Update between the branches all the time. In previous versions of TortoiseHg, I could select the branch before doing the merge, in effect doing a "Merge local with selected". This would eliminate steps 1 and 3 above.

Is this doable in TortoiseHg anymore?

2

2 Answers

2
votes

Three-way merges are basically symmetric: you merge two divergent versions of your code (the two branches) into a single version (the merge commit). There is no technical different between updating to default and merging with release, or doing it the other way around. In particular, the merge conflicts are exactly the same.

In Mercurial, there is an extra twist because of the named branch names: by default, the merge commit will inherit the branch name of its first parent. If you don't update to default before merging, the first parent will thus be release. But you can change the branch name before committing.

On the command line it's just:

$ hg update release
$ hg merge default
$ hg branch default
$ hg commit -m 'Merged release into default'

In the pre-2.0 versions of TortoiseHg you were presented with this dialog to commit the merge:

hgtk commit dialog

The button above the commit message saying "branch: release" could be used to change branch of the next commit — the merge commit. In TortoiseHg 2.x the dialog looks like this:

thg commit dialog

and there's no longer a button for changing branch.

Maybe you can ask the TortoiseHg developers to add the button again, or you can use Henrik Stuart's TortoiseHg if you want a pre-2.0 TortoiseHg that is compatible with modern versions of Mercurial.

1
votes

I haven't found a way, even command line merge is always with local. I just keep a clone for each branch and switch between clones instead of updating a single clone. For large projects this prevents the usually time-intensive "rebuild all" when changing branches. Adds extra pull step but saves time overall:

  1. In release clone, implement bug fix and commit.
  2. In default clone, pull from release and merge with local.