[PATCH 2 of 4] dirstate: introduce function to normalize just filenames

Siddharth Agarwal sid0 at fb.com
Tue Mar 31 11:52:57 CDT 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1427594034 25200
#      Sat Mar 28 18:53:54 2015 -0700
# Node ID 21df72baa78f0ba8c6f7d98f4159c48b4dffddf3
# Parent  1628a521be87f334e98a0575ebbb17153f1ed9b8
dirstate: introduce function to normalize just filenames

This will be used in upcoming patches to stop generating the set of directories
in many common cases.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -490,6 +490,17 @@
 
         return folded
 
+    def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
+        normed = util.normcase(path)
+        folded = self._foldmap.get(normed, None)
+        if folded is None:
+            if isknown:
+                folded = path
+            else:
+                folded = self._discoverpath(path, normed, ignoremissing, exists,
+                                            self._foldmap)
+        return folded
+
     def _normalize(self, path, isknown, ignoremissing=False, exists=None):
         normed = util.normcase(path)
         folded = self._foldmap.get(normed, None)


More information about the Mercurial-devel mailing list