scmutil: introduce a filecacheentry that can watch multiple paths
authorSiddharth Agarwal <sid0@fb.com>
Sat, 16 Nov 2013 13:24:26 -0800
changeset 20044 d38de18d187a
parent 20043 88bd8df008f2
child 20045 b3684fd2ff1a
scmutil: introduce a filecacheentry that can watch multiple paths
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sat Nov 16 13:19:06 2013 -0800
+++ b/mercurial/scmutil.py	Sat Nov 16 13:24:26 2013 -0800
@@ -768,6 +768,23 @@
             if e.errno != errno.ENOENT:
                 raise
 
+class filecacheentry(object):
+    def __init__(self, paths, stat=True):
+        self._entries = []
+        for path in paths:
+            self._entries.append(filecachesubentry(path, stat))
+
+    def changed(self):
+        '''true if any entry has changed'''
+        for entry in self._entries:
+            if entry.changed():
+                return True
+        return False
+
+    def refresh(self):
+        for entry in self._entries:
+            entry.refresh()
+
 class filecache(object):
     '''A property like decorator that tracks a file under .hg/ for updates.