3
votes

I have a pretty simple Mercurial repo that has one named branch in addition to the default branch.

Changes have been made and committed to the default branch and I want to merge those into my named branch. However, a hg merge default does not seem to be merging in all of the changes.

for example:

hg update working
99 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg status -m --rev default:working

there are about 20 files with modifications

M ... some list of files...
hg merge default
merging path/to/a/file/foo.java
3 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)

hg status -m --rev default:working

Now there are still file with modifications that I would have expected to get merged.

I can do an hg diff -r default and see that there are changes that are not getting merged.

This is what the repo looks like

@  changeset:   4:d41da580b434
|  branch:      working
|  tag:         tip
|  parent:      1:3ed1c8bf91cf
|  user:        bob costas
|  date:        Tue Mar 24 10:13:25 2015 -0500
|  summary:     pr-1243 and minor updates
|
| o  changeset:   2:ea0c249218fa
| |  parent:      0:385565af3c13
| |  user:        bob costas
| |  date:        Mon Mar 23 15:09:42 2015 -0500
| |  summary:     bunch of updated files and fixes
| |
o |  changeset:   1:3ed1c8bf91cf
|/   branch:      working
|    user:        bob costas
|    date:        Mon Mar 23 13:38:59 2015 -0500
|    summary:     pr-1231 
|
o  changeset:   0:385565af3c13
   user:        bob costas
   date:        Thu Mar 19 18:15:52 2015 -0500
   summary:     initial commit
1
Have you committed the merge changeset? (It isn't done automatically because you may have conflicts.)Edward
Shouldn't the status command be: hg status -m --rev default (remove :working at the end)? Also is it possible that the differences you see with hg diff are actually changes made in the working branch that have not been merged to default? I'm not sure how you use those branches, but maybe you need to merge working into default before you merge the other way around.David Levesque
@Edward no, I have not yet committed the merge because I don't see that the merge is picking up all the required changes.Oyunokata
@DavidLevesque the status command works either way and both have identical results. I added the :working just to be explicit about what revisions to compare. There are changes in working that are not in default. However, I am wanting to merge default into working, clean things up and then merge working into default. I am 100% sure that there are changes in default (because I put them there) that are not in working, hence my need to merge.Oyunokata
If you compare the merged head with the default branch head, you should expect to see changes. Specifically, you'll see changesets 1 and 4 (wait, what happened to 3?). This is normal and what you want.Kevin

1 Answers

9
votes

You didn't commit your merge.. Mercurial told you :

hg merge default 

merging path/to/a/file/foo.java 3 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit)

When you merge, all files stay modified in your sources, and you need to commit them

hg commit -m "merge with default"

Then your branch will appear merged in the log.