diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -65,6 +65,9 @@ def dodiff(ui, repo, diffcmd, diffopts, ui.write_err(_('making snapshot of %d files from rev %s\n') % (len(files), short(node))) for fn in files: + if not fn in mf: + # skipping new file after a merge ? + continue wfn = util.pconvert(fn) ui.note(' %s\n' % wfn) dest = os.path.join(base, wfn) diff --git a/tests/test-extdiff b/tests/test-extdiff --- a/tests/test-extdiff +++ b/tests/test-extdiff @@ -26,4 +26,13 @@ hg ci -d '0 0' -mtest1 echo b >> a hg ci -d '1 0' -mtest2 -hg falabala -r 0:1 || echo "diff-like tools yield a non-zero exit code" +hg falabala -r 0:1 + +# test diff during merge +hg update 0 +echo b >> b +hg add b +hg ci -m "new branch" -d '1 0' +hg update -C 1 +hg merge tip +hg falabala || echo "diff-like tools yield a non-zero exit code" diff --git a/tests/test-extdiff.out b/tests/test-extdiff.out --- a/tests/test-extdiff.out +++ b/tests/test-extdiff.out @@ -29,4 +29,11 @@ options: making snapshot of 1 files from rev e27a2475d60a making snapshot of 1 files from rev 5e49ec8d3f05 diffing a.e27a2475d60a a.5e49ec8d3f05 +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +1 files updated, 0 files merged, 1 files removed, 0 files unresolved +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +making snapshot of 1 files from rev 5e49ec8d3f05 +making snapshot of 1 files from working dir +diffing a.5e49ec8d3f05 a diff-like tools yield a non-zero exit code diff --git a/tests/test-merge1 b/tests/test-merge1 --- a/tests/test-merge1 +++ b/tests/test-merge1 @@ -23,6 +23,8 @@ hg commit -m "commit #2" -d "1000000 0" echo This is file b1 > b echo %% no merges expected env HGMERGE=../merge hg merge 1 +hg diff --nodates +hg status cd ..; /bin/rm -rf t mkdir t @@ -44,6 +46,8 @@ echo %% merge should fail env HGMERGE=../merge hg merge 1 echo %% merge of b expected env HGMERGE=../merge hg merge -f 1 +hg diff --nodates +hg status cd ..; /bin/rm -rf t echo %% @@ -71,6 +75,8 @@ echo %% merge fails env HGMERGE=../merge hg merge 2 echo %% merge expected! env HGMERGE=../merge hg merge -f 2 +hg diff --nodates +hg status cd ..; /bin/rm -rf t mkdir t @@ -93,4 +99,6 @@ echo %% merge of b should fail env HGMERGE=../merge hg merge 2 echo %% merge of b expected env HGMERGE=../merge hg merge -f 2 +hg diff --nodates +hg status cd ..; /bin/rm -rf t diff --git a/tests/test-merge1.out b/tests/test-merge1.out --- a/tests/test-merge1.out +++ b/tests/test-merge1.out @@ -4,6 +4,12 @@ merging for b merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) +diff -r d9e5953b9dec b +--- /dev/null ++++ b/b +@@ -0,0 +1,1 @@ ++This is file b1 +M b 0 files updated, 0 files merged, 1 files removed, 0 files unresolved %% merge should fail abort: 'b' already exists in the working dir and differs from remote @@ -12,6 +18,12 @@ merging for b merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) +diff -r d9e5953b9dec b +--- /dev/null ++++ b/b +@@ -0,0 +1,1 @@ ++This is file b2 +M b %% 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Contents of b should be "this is file b1" @@ -23,6 +35,13 @@ merging for b merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) +diff -r c1dd73cbf59f b +--- a/b ++++ b/b +@@ -1,1 +1,1 @@ This is file b1 +-This is file b1 ++This is file b22 +M b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved %% merge of b should fail abort: outstanding uncommitted changes @@ -31,3 +50,10 @@ merging for b merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) +diff -r c1dd73cbf59f b +--- a/b ++++ b/b +@@ -1,1 +1,1 @@ This is file b1 +-This is file b1 ++This is file b33 +M b