Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/scmutil.py @ 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 |
comparison
equal
deleted
inserted
replaced
20043:88bd8df008f2 | 20044:d38de18d187a |
---|---|
766 return util.cachestat(path) | 766 return util.cachestat(path) |
767 except OSError, e: | 767 except OSError, e: |
768 if e.errno != errno.ENOENT: | 768 if e.errno != errno.ENOENT: |
769 raise | 769 raise |
770 | 770 |
771 class filecacheentry(object): | |
772 def __init__(self, paths, stat=True): | |
773 self._entries = [] | |
774 for path in paths: | |
775 self._entries.append(filecachesubentry(path, stat)) | |
776 | |
777 def changed(self): | |
778 '''true if any entry has changed''' | |
779 for entry in self._entries: | |
780 if entry.changed(): | |
781 return True | |
782 return False | |
783 | |
784 def refresh(self): | |
785 for entry in self._entries: | |
786 entry.refresh() | |
787 | |
771 class filecache(object): | 788 class filecache(object): |
772 '''A property like decorator that tracks a file under .hg/ for updates. | 789 '''A property like decorator that tracks a file under .hg/ for updates. |
773 | 790 |
774 Records stat info when called in _filecache. | 791 Records stat info when called in _filecache. |
775 | 792 |