[PATCH 3 of 3] update: fix case-collision with a clean wd and no --clean

Patrick Mezard patrick at mezard.eu
Mon Apr 23 07:36:28 CDT 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1335184379 -7200
# Branch stable
# Node ID 455efac3f33cb21c9c073543569392f113b6c80d
# Parent  5707b5278142998ab7d26750bc196f1692fbe666
update: fix case-collision with a clean wd and no --clean

cbf2ea2f5ca1 introduced some logic to avoid case-collision detection between
source and destination revisions when it does not make sense: clean or to be
cleaned working directories. Unfortunately, part of it was flawed and the
related test was broken by another bug.

This patch disables cross revision case collision detection for updates without
option or with --check, if the working directory is clean.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -577,7 +577,8 @@
         folding = not util.checkcase(repo.path)
         if folding:
             # collision check is not needed for clean update
-            if not branchmerge and force:
+            if (not branchmerge and
+                (force or not wc.dirty(missing=True, branch=False))):
                 _checkcollision(p2, None)
             else:
                 _checkcollision(p2, wc)
diff --git a/tests/test-casecollision-merge.t b/tests/test-casecollision-merge.t
--- a/tests/test-casecollision-merge.t
+++ b/tests/test-casecollision-merge.t
@@ -143,14 +143,14 @@
   $ hg commit -m '#2'
 
   $ hg update 0
-  abort: case-folding collision between a and A
-  [255]
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg parents --template '{rev}\n'
-  2
+  0
   $ hg status -A
-  C A
+  C a
   $ cat A
-  A
+  a
+  $ hg up -qC 2
 
   $ hg update --check 0
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved


More information about the Mercurial-devel mailing list