14

I'm working on a website using two branches: develop (for actively working on code) and default (where I merge features when they're ready to go live). I've just merged changes and I'm getting this message when switching between the two branches:

1 files updated, 0 files merged, 0 files removed, 0 files unresolved

I've run hg status --rev default:develop to figure out which file it's referring to, but I haven't been able to figure out what is different.

Here's what I've tried so far:

hg diff --rev default:develop
hg diff --rev default:develop file.php

Could someone point me in the right direction?

bradym
  • 4,880
  • 1
  • 31
  • 36
  • This looks like you have made the same changes independently in both branches. `hg update -v` should tell you which file was actually changed. Try `hg log -r 'ancestor(default,develop)'` to find the common ancestor of the branches and `hg diff -r 'ancestor(default,develop)' -r default` and `hg diff -r 'ancestor(default,develop) -r develop` to see what the changes in either branch since the last common revision are. – Reimer Behrends May 28 '13 at 03:59
  • When I run the log command you give, it shows the latest commit. The diff command doesn't return anything.. – bradym May 30 '13 at 04:02
  • That would indicate that `default` and `develop` are one and the same branch. Are you sure you're using branches and not bookmarks? Because bookmarks are the only way (off the top of my head) that I could see that happen. If you do use bookmarks, you need to assign different ones to different heads; `default` will otherwise refer to the head revision closest to the tip. – Reimer Behrends May 30 '13 at 09:11

2 Answers2

26
  1. Diff between two branches:

    hg diff -r BRANCH1:BRANCH2

  2. Diff a single file between two branches:

    hg diff -r BRANCH1:BRANCH2 the_sinlge_file_to_diff

Reference

alex
  • 479,566
  • 201
  • 878
  • 984
dylanninin
  • 659
  • 7
  • 8
0

I've just merged changes and I'm getting this message when switching between the two branches:

When you merge a branch into default the branch still has it's head at the previous change-set. The merge commit is on the default branch and not the develop branch. This lets you switch to the develop branch and continue work

So if you did:

# hg update default
# hg merge develop
# hg commit

...you'd get...

D1 --- D2 --- D3 --- D4
                   /
                  /
V1 --- V2 --- V3 -

D is default, V is deVelop. D4 is the merge. This is the state you're in. When you switch between branches you switch between D4 and V3. The one file that's changing is a file that was changed in the default branch. If you then went on and did...

# hg update develop
<some work>
# hg commit develop

...you'd get...

D1 --- D2 --- D3 --- D4
                   /
                  /
V1 --- V2 --- V3 --- V4

V4 is based on V3, the change on the develop branch before the merge, not the merged version.

This doesn't answer your diff question but it tells you why your branches don't contain the same thing.

Paul S
  • 7,645
  • 2
  • 24
  • 36