Patchwork [Bug,3908] New: copies._tracefiles does not trace from merges correctly

mail settings
Date April 25, 2013, 4:54 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/1481/
State Superseded
Commit 9bfa86746c9c1f6ab51deb8f174ffc482417d09f
Headers show

Comments - April 25, 2013, 4:54 p.m.

          Priority: normal
            Bug ID: 3908
           Summary: copies._tracefiles does not trace from merges
          Severity: bug
    Classification: Unclassified
                OS: Mac OS
          Hardware: PC
            Status: UNCONFIRMED
           Version: 2.6-rc
         Component: Mercurial
           Product: Mercurial

copies._tracefiles does not find the correct file in the following scenario:

M    merge (file y now has a parent from C and a copy parent from B)
| D  
| |
C |  rename x to y
| |
| B  edit x
A    add file x

copies._tracefile(filenode(y in M), D) looks for the version of y that exists
in D. It does an ancestor walk on y and checks C first. The y node in C does
not appear in D, so that fails. It notices that C.rev() < D.rev() and gives up.
 That's wrong.  It should keep looking and will eventually find the node for x
in B.

Here are repro steps:

hg init foo && cd foo
touch x && hg commit -Am A
echo x > x && hg commit -Am B
hg up 0
hg mv x y && hg commit -m C
hg up 1
touch z && hg commit -Am D
hg merge 2
hg commit -m M
hg diff -r 3 -r 4

Actual output:
diff --git a/y b/y
new file mode 100644
--- /dev/null
+++ b/y

Expected output:
diff --git a/x b/y
rename from x
rename to y


diff --git a/x b/x
deleted file mode 100644
--- a/x
+++ /dev/null
@@ -1,1 +0,0 @@