[PATCH 5 of 6] scmutil: introduce a filecacheentry that can watch multiple paths

Siddharth Agarwal sid0 at fb.com
Sat Nov 16 17:21:11 CST 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1384637066 28800
#      Sat Nov 16 13:24:26 2013 -0800
# Node ID c31031f519a1410a7ab92a0a0b8c263cf1e92161
# Parent  325bd3d4fba6b30a5b508a4d1d331fe8e8374cb3
scmutil: introduce a filecacheentry that can watch multiple paths

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -906,6 +906,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.
 


More information about the Mercurial-devel mailing list