[PATCH 1 of 7 V6] dirstate: add a function to compute non-normal entries from the dmap

Laurent Charignon lcharignon at fb.com
Tue Dec 22 00:33:10 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1450743763 28800
#      Mon Dec 21 16:22:43 2015 -0800
# Node ID 72338485aacdd2f9189c8ad85c1824f42e41df9c
# Parent  5df74b2f296df7f44a08106df4f9dd97a5aa726a
dirstate: add a function to compute non-normal entries from the dmap

This patch adds a new python function in the dirstate to compute the set of
non-normal files from the dmap. These files are useful to compute the repository
status.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -36,6 +36,11 @@ def _getfsnow(vfs):
         os.close(tmpfd)
         vfs.unlink(tmpname)
 
+def nonnomalentries(dmap):
+    '''Compute the nonnormal dirstate entries from the dmap'''
+    return set(fname for fname, e in dmap.iteritems()
+           if e[0] != 'n' or e[3] == -1)
+
 def _trypending(root, vfs, filename):
     '''Open  file to be read according to HG_PENDING environment variable
 


More information about the Mercurial-devel mailing list