changeset 16313:e785456f9631 stable

dirstate: avoid normalizing letter case on icasefs for exact match (issue3340) on icasefs, "hg qnew" fails to import changing letter case of filename already occurred in working directory, for example: $ hg rename a tmp $ hg rename tmp A $ hg qnew casechange $ hg status R a $ "hg qnew" invokes 'dirstate.walk()' via 'localrepository.commit()' with 'exact match' matching object having exact filenames of targets in ones 'files()'. current implementation of 'dirstate.walk()' always normalizes letter case of filenames from 'match.files()' on icasefs, even though exact matching is required. then, files only different in letter case are treated as one file. this patch prevents 'dirstate.walk()' from normalizing, if exact matching is required, even on icasefs. filenames for 'exact matching' are given not from user command line, but from dirstate walk result, manifest of changecontext, patch files or fixed list for specific system files (e.g.: '.hgtags'). in such case, case normalization should not be done, so this patch works well.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 31 Mar 2012 00:04:08 +0900
parents 7ee8aa662937
children 80a6a68906bf
files mercurial/dirstate.py tests/test-casefolding.t
diffstat 2 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Thu Mar 29 00:35:00 2012 +0200
+++ b/mercurial/dirstate.py	Sat Mar 31 00:04:08 2012 +0900
@@ -558,7 +558,7 @@
         elif match.files() and not match.anypats(): # match.match, no patterns
             skipstep3 = True
 
-        if self._checkcase:
+        if not exact and self._checkcase:
             normalize = self._normalize
             skipstep3 = False
         else:
--- a/tests/test-casefolding.t	Thu Mar 29 00:35:00 2012 +0200
+++ b/tests/test-casefolding.t	Sat Mar 31 00:04:08 2012 +0900
@@ -72,3 +72,45 @@
   gold
 
   $ cd ..
+
+issue 3340: mq does not handle case changes correctly
+
+in addition to reported case, 'hg qrefresh' is also tested against
+case changes.
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init issue3340
+  $ cd issue3340
+
+  $ echo a > mIxEdCaSe
+  $ hg add mIxEdCaSe
+  $ hg commit -m '#0'
+  $ hg rename mIxEdCaSe tmp
+  $ hg rename tmp MiXeDcAsE
+  $ hg status -A
+  A MiXeDcAsE
+    mIxEdCaSe
+  R mIxEdCaSe
+  $ hg qnew changecase
+  $ hg status -A
+  C MiXeDcAsE
+
+  $ hg qpop -a
+  popping changecase
+  patch queue now empty
+  $ hg qnew refresh-casechange
+  $ hg status -A
+  C mIxEdCaSe
+  $ hg rename mIxEdCaSe tmp
+  $ hg rename tmp MiXeDcAsE
+  $ hg status -A
+  A MiXeDcAsE
+    mIxEdCaSe
+  R mIxEdCaSe
+  $ hg qrefresh
+  $ hg status -A
+  C MiXeDcAsE
+
+  $ cd ..