1
votes

I have a repository in which there are two branches MAIN and FEATURE1. Soon after I branched, I needed to make a bug fix and then I tagged MAIN with a version number. These are the only changes on MAIN after the branch. I've been working in FEATURE1 and have added several files.

1--2----4--5
    \
     3--------6--7--8
  • 3 - Branch created
  • 4 - Bug fix
  • 5 - Tag added
  • 6-8 - Feature changes

Note There is a single conflicting change between the bug fix and the feature.

Now, my feature is complete, and I want to merge FEATURE1 (8) into MAIN (5). But when I perform the merge, it doesn't appear that any of my changes are moved into the MAIN branch.

When I performed the merge without committing, I noticed a few things:

  • All of the files that were added in the source branch (FEATURE1) are marked to be removed.
  • There are a lot of .orig files (I have no idea what these are). These are marked ? (unknown action) and are not committed.
  • Existing files are marked 'M' (modified) as expected, but the changes aren't migrated.

It's almost as if it's taking MAIN as the source and FEATURE1 as the destination, but I'm sure I'm merging into MAIN. I update to MAIN (5), right-click FEATURE1 (8), and select Merge to Local.... The resulting branch appears as part of MAIN as expected.

I've never branched using TortoiseHg or Mercurial before. I'm used to TFS, and I feel like I'm getting the opposite behavior.

Basically, I want the changes I made in FEATURE1 to be present in MAIN.

1
The .orig files only matter if you have unresolved merge conflicts, they seem to be generated automatically as it finds conflicts and tries to work them out. They don't seem to get cleaned up automatically when everything is resolved unfortunately. Just add them to your ignore list.Nanhydrin
The problem is that some of them are precisely the changes I want migrated. And why do my new files get marked to remove?gregsdennis
It's possible that for some reason whatever tool is doing the auto-merge is defaulting to discard incoming changes. Do you know what tool it's using? You could try running the merge from command line rather than the Workbench and maybe even explicitly specify the tool so you can verify any settings before you run it.Nanhydrin
@Nanhydrin, thank you. I was checking the "Discard changes" box thinking that it would discard my uncommitted changes on the MAIN branch, but it was discarding the changes on the FEATURE1 branch. Answer and the check mark is yours.gregsdennis
Thank you but you're better placed to answer it and outline exactly what you did for anyone coming after us, I was only stabbing in the dark :)Nanhydrin

1 Answers

0
votes

So apparently, TortoiseHg was working correctly. My frustration was the result of misreading the UI.

Whenever you update to a different revision in TortoiseHg, it gives you a dialog with a checkbox which allows you to discard the uncommitted changes in the current branch.

Discard local changes, no backup (-C/--clean)

When merging, the message is similar but carries a very different meaning.

Discard all changes from merge target (other) revision

While the first means that you want to undo uncommitted changes, the second means that you want to merge the branches without bringing over any of the changes.

On a side note, I can't figure out why that feature is there. Why would you merge branches without migrating the changes? It seems easier to just close the branch.