[PATCH 4 of 4 V2] parsers: pure implementation of the new dirstate ordering

Laurent Charignon lcharignon at fb.com
Mon Nov 30 18:52:46 CST 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1448411881 28800
#      Tue Nov 24 16:38:01 2015 -0800
# Node ID f9959f2e4cd73d0bf06c6a325c4a33e4f5bd1a04
# Parent  749f9f5d6476c60ba9841415e4e94358fe3adf01
parsers: pure implementation of the new dirstate ordering

This patch makes the pure implementation of pack_dirstate up to date with the
C implementation. It effectively writes the dirstate starting with the
non-normal files and ends with the normal files.

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -88,8 +88,13 @@ def pack_dirstate(dmap, copymap, pl, now
     cs = cStringIO.StringIO()
     write = cs.write
     write("".join(pl))
-    if True:
+    # First pass: non normal files, second pass: normal files to improve status
+    # performance as status generally only need the non normal files
+    for _pass in [0, 1]:
         for f, e in dmap.iteritems():
+            normal = e[0] == 'n' and e[3] != -1
+            if normal != _pass:
+                continue
             if e[0] == 'n' and e[3] == now:
                 # The file was last modified "simultaneously" with the current
                 # write to dirstate (i.e. within the same second for file-


More information about the Mercurial-devel mailing list