Problem with merge after a dir rename
Long Vu
long.vu at intelerad.com
Thu Jan 14 17:25:35 UTC 2016
On Thu, Jan 14, 2016 at 10:59 AM, Long Vu <long.vu at intelerad.com> wrote:
> On Wed, Jan 13, 2016 at 10:34 AM, Matt Mackall <mpm at selenic.com> wrote:
>> On Tue, 2016-01-12 at 15:28 -0500, Long Vu wrote:
>>> Test2.java should have been under java-project/test/com/package/, not
>>> "source".
>>
>> So the theory is that we should only infer a directory move when ALL the files
>> in a given directory are moved. But apparently there's a bug here. The non-
>> determinism is caused by randomization of Python's hashing constant. Give this
>> patch a try if you can:
>>
>> diff -r 81bca91a0507 mercurial/copies.py
>> --- a/mercurial/copies.py Tue Jan 12 15:08:03 2016 -0600
>> +++ b/mercurial/copies.py Wed Jan 13 09:32:20 2016 -0600
>> @@ -401,13 +401,13 @@
>> continue
>> elif dsrc in d1 and ddst in d1:
>> # directory wasn't entirely moved locally
>> - invalid.add(dsrc)
>> + invalid.add(dsrc + "/")
>> elif dsrc in d2 and ddst in d2:
>> # directory wasn't entirely moved remotely
>> - invalid.add(dsrc)
>> - elif dsrc in dirmove and dirmove[dsrc] != ddst:
>> + invalid.add(dsrc + "/")
>> + elif dsrc + "/" in dirmove and dirmove[dsrc + "/"] != ddst + "/":
>> # files from the same directory moved to two different places
>> - invalid.add(dsrc)
>> + invalid.add(dsrc + "/")
>> else:
>> # looks good so far
>> dirmove[dsrc + "/"] = ddst + "/"
>>
>
> Will try the proposed patch, thanks.
>
Patch works (on tip of stable bf86e3e87123), added files are not
automatically randomly moved to one of source/ or test/ but created in
their original location (which is the expected behaviour).
However, the added files show up as modified instead of added in hg
status, but then correctly show up as added after commit is done. I
think I've seen this behaviour before. Is this also a known issue?
--- test-mercurial-merge-after-dir-rename.t
+++ test-mercurial-merge-after-dir-rename.t.err
@@ -30,16 +30,28 @@
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hh diff
- abort: java-project/com/package/Source2.java@[a-f0-9]{12}: not
found in manifest! (re)
- [255]
+ diff --git a/java-project/com/package/Source2.java
b/java-project/com/package/Source2.java
+ new file mode 100644
+ --- /dev/null
+ +++ b/java-project/com/package/Source2.java
+ @@ -0,0 +1,1 @@
+ +Source2
+ diff --git a/java-project/com/package/Test2.java
b/java-project/com/package/Test2.java
+ new file mode 100644
+ --- /dev/null
+ +++ b/java-project/com/package/Test2.java
+ @@ -0,0 +1,1 @@
+ +Test2
Test2.java should have been under java-project/test/com/package/, not "source".
In fact, the destination (source/test) seems to be random as one of my re-run,
I saw it put under test.
$ hh st
- A java-project/source/com/package/Source2.java
- A java-project/source/com/package/Test2.java
+ M java-project/com/package/Source2.java
+ M java-project/com/package/Test2.java
$ hh ci -m "commit the merge"
$ hh st --ch .
+ A java-project/com/package/Source2.java
+ A java-project/com/package/Test2.java
I think mercurial should prompt the user instead of silently randomly deciding
the destination.
--
Long Vu | Build Controller | Intelerad | +1-514-931-6222 ext. 7743
--
This email or any attachments may contain confidential or legally
privileged information intended for the sole use of the addressees. Any
use, redistribution, disclosure, or reproduction of this information,
except as intended, is prohibited. If you received this email in error,
please notify the sender and remove all copies of the message, including
any attachments.
More information about the Mercurial
mailing list