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.
--- a/mercurial/merge.py Mon Apr 23 12:12:04 2012 +0200
+++ b/mercurial/merge.py Mon Apr 23 14:32:59 2012 +0200
@@ -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)
--- a/tests/test-casecollision-merge.t Mon Apr 23 12:12:04 2012 +0200
+++ b/tests/test-casecollision-merge.t Mon Apr 23 14:32:59 2012 +0200
@@ -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