Patchwork [4,of,4] parsers: pure implementation of the new dirstate ordering

login
register
mail settings
Submitter Laurent Charignon
Date Nov. 25, 2015, 1:19 a.m.
Message ID <848edfab1ea6553582dd.1448414351@dev5073.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11645/
State Superseded
Delegated to: Yuya Nishihara
Headers show

Comments

Laurent Charignon - Nov. 25, 2015, 1:19 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1448411881 28800
#      Tue Nov 24 16:38:01 2015 -0800
# Node ID 848edfab1ea6553582dd52979c3b9071a7c39ecb
# Parent  5c7759228e340435b6b391aa080342f97e548821
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.

Patch

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 @@ 
     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-