diff tests/test-casecollision-merge.t @ 19105:c60a7f5a741f stable

icasefs: rewrite case-folding collision detection (issue3452) Before this patch, case-folding collision detection uses "copies.pathcopies()" before "manifestmerge()", and is not aware of renaming in some cases. For example, in the case of issue3452, "copies.pathcopies()" can't detect renaming, if the file is renamed at the revision before common ancestor of merging. So, "hg merge" is aborted unexpectedly on case insensitive filesystem. This patch fully rewrites case-folding collision detection, and relocate it into "manifestmerge()". New implementation uses list of actions held in "actions" and "prompts" to build provisional merged manifest up. Provisional merged manifest should be correct, if actions required to build merge result up in working directory are listed up in "actions" and "prompts" correctly. This patch checks case-folding collision still before prompting for merge, to avoid aborting after some interactions with users. So, this assumes that user would choose not "deleted" but "changed". This patch also changes existing abort message, because sorting before collision detection changes order of checked files.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 30 Apr 2013 05:01:32 +0900
parents 370d9ea027b1
children 3d0dd890c525
line wrap: on
line diff
--- a/tests/test-casecollision-merge.t	Tue Apr 30 05:01:32 2013 +0900
+++ b/tests/test-casecollision-merge.t	Tue Apr 30 05:01:32 2013 +0900
@@ -17,14 +17,17 @@
   $ echo a > a
   $ hg add a
   $ hg commit -m '#0'
+  $ hg tag -l A
   $ hg rename a tmp
   $ hg rename tmp A
   $ hg commit -m '#1'
+  $ hg tag -l B
   $ hg update -q 0
   $ touch x
   $ hg add x
   $ hg commit -m '#2'
   created new head
+  $ hg tag -l C
 
   $ hg merge -q
   $ hg status -A
@@ -37,6 +40,46 @@
   $ hg status -A
   M x
   C A
+  $ hg commit -m '(D)'
+  $ hg tag -l D
+
+additional test for issue3452:
+
+| this assumes the history below.
+|
+|  (A) -- (C) -- (E) -------
+|      \      \             \
+|       \      \             \
+|         (B) -- (D) -- (F) -- (G)
+|
+|   A: add file 'a'
+|   B: rename from 'a' to 'A'
+|   C: add 'x' (or operation other than modification of 'a')
+|   D: merge C into B
+|   E: modify 'a'
+|   F: modify 'A'
+|   G: merge E into F
+|
+| issue3452 occurs when (B) is recorded before (C)
+
+  $ hg update -q --clean C
+  $ echo "modify 'a' at (E)" > a
+  $ hg commit -m '(E)'
+  created new head
+  $ hg tag -l E
+
+  $ hg update -q --clean D
+  $ echo "modify 'A' at (F)" > A
+  $ hg commit -m '(F)'
+  $ hg tag -l F
+
+  $ hg merge -q --tool internal:other E
+  $ hg status -A
+  M A
+    a
+  C x
+  $ cat A
+  modify 'a' at (E)
 
   $ cd ..
 
@@ -63,7 +106,7 @@
   $ hg commit -m '#4'
 
   $ hg merge
-  abort: case-folding collision between A and a
+  abort: case-folding collision between a and A
   [255]
   $ hg parents --template '{rev}\n'
   4