[PATCH 1 of 3] dirstate: add a method to filter by not included

Siddharth Agarwal sid0 at fb.com
Fri Feb 1 16:41:24 CST 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1359672835 28800
# Branch stable
# Node ID 9139388e66b4c6295c85989f27357c280a40025d
# Parent  d4f93b62e7af1b8fe71de99e0483d0a75b2b6746
dirstate: add a method to filter by not included

This is the bulk what merge._checkunknown does, except much faster. That
function will be made to use this in an upcoming patch.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -551,6 +551,17 @@ class dirstate(object):
                 return True
         return False
 
+    def notincluded(self, files):
+        """Return all the entries in files not included in the dirstate.
+
+        "Included" here means n, m or a. This is here for perf reasons."""
+        dmap = self._map
+        l = []
+        for f in files:
+            if f not in dmap or dmap[f] == 'r':
+                l.append(f)
+        return l
+
     def walk(self, match, subrepos, unknown, ignored):
         '''
         Walk recursively through the directory tree, finding all files


More information about the Mercurial-devel mailing list