changeset 27588:714849ba7836

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.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 21 Dec 2015 16:22:43 -0800
parents c8dc480142a8
children 3e4f9d78ebd4
files mercurial/dirstate.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Dec 29 23:58:30 2015 +0900
+++ b/mercurial/dirstate.py	Mon Dec 21 16:22:43 2015 -0800
@@ -49,6 +49,11 @@
         os.close(tmpfd)
         vfs.unlink(tmpname)
 
+def nonnormalentries(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