Patchwork [1,of,4,STABLE] icasefs: ignore removed files at building "dirstate._foldmap" up on icasefs

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 29, 2013, 9:01 p.m.
Message ID <db31701b54f7bffd6cb8.1367269309@feefifofum>
Download mbox | patch
Permalink /patch/1495/
State Accepted
Commit 0176d0db46712bdd330bbe9f7db25b2595e99fae
Headers show

Comments

Katsunori FUJIWARA - April 29, 2013, 9:01 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1367265648 -32400
#      Tue Apr 30 05:00:48 2013 +0900
# Branch stable
# Node ID db31701b54f7bffd6cb8a0e5cc6008a6848aac2a
# Parent  f01a351db79106ba96ac6d527cf69944fd98e665
icasefs: ignore removed files at building "dirstate._foldmap" up on icasefs

Before this patch, all files in dirstate are used to build "_foldmap"
up on case insensitive filesystem regardless of their statuses.

For example, when dirstate contains both removed file 'a' and added
file 'A', "_foldmap" may be updated finally by removed file 'a'. This
causes unexpected status information for added file 'A' at "hg status"
invocation.

This patch ignores removed files at building "_foldmap" up on case
insensitive filessytem.

This patch doesn't add any test, because this issue is difficult to
reproduce intentionally: it depends on iteration order of "dirstate._map".
Matt Mackall - May 1, 2013, 7:23 p.m.
On Tue, 2013-04-30 at 06:01 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1367265648 -32400
> #      Tue Apr 30 05:00:48 2013 +0900
> # Branch stable
> # Node ID db31701b54f7bffd6cb8a0e5cc6008a6848aac2a
> # Parent  f01a351db79106ba96ac6d527cf69944fd98e665
> icasefs: ignore removed files at building "dirstate._foldmap" up on icasefs

These are queued for stable, thanks.

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -59,8 +59,9 @@ 
     @propertycache
     def _foldmap(self):
         f = {}
-        for name in self._map:
-            f[util.normcase(name)] = name
+        for name, s in self._map.iteritems():
+            if s[0] != 'r':
+                f[util.normcase(name)] = name
         for name in self._dirs:
             f[util.normcase(name)] = name
         f['.'] = '.' # prevents useless util.fspath() invocation