changeset 20044:d38de18d187a

scmutil: introduce a filecacheentry that can watch multiple paths
author Siddharth Agarwal <sid0@fb.com>
date Sat, 16 Nov 2013 13:24:26 -0800
parents 88bd8df008f2
children b3684fd2ff1a
files mercurial/scmutil.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.