changeset 829:64fa5ea18b89

manifest: add matches() to overlay 0cc283f44655 in upstream Mercurial added a matches function to the manifest. This broke 'hg incoming -p' with hg-git. This patch adds a simple implementation that fixes the problem. This was caught by the tests, and now the tests pass.
author Durham Goode <durham@fb.com>
date Tue, 25 Nov 2014 10:53:11 -0800
parents 9da433130b12
children 5fa9649c4ef6
files hggit/overlay.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/overlay.py	Wed Nov 05 12:30:19 2014 -0500
+++ b/hggit/overlay.py	Tue Nov 25 10:53:11 2014 -0800
@@ -70,6 +70,17 @@
 
         addtree(self.tree, '')
 
+    def matches(self, match):
+        '''generate a new manifest filtered by the match argument'''
+        if match.always():
+            return self.copy()
+
+        mf = self.copy()
+        for fn in mf.keys():
+            if not match(fn):
+                del mf[fn]
+        return mf
+
     def iteritems(self):
         self.load()
         return self._map.iteritems()