[PATCH 2 of 3] localrepo: add getwatcher function
Sune Foldager
cryo at cyanite.org
Thu May 26 06:06:43 CDT 2011
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1306407607 -7200
# Node ID 26ce147adada2315fb538a1bdd23acf78d18a4c2
# Parent 991245e3b101e911c8fe6c3d75c33676613e5ef5
localrepo: add getwatcher function
Returns an fswatcher which watches the repo store, and optionally the repo
configuration as well, for changes.
diff -r 991245e3b101 -r 26ce147adada mercurial/localrepo.py
--- a/mercurial/localrepo.py Thu May 26 12:54:34 2011 +0200
+++ b/mercurial/localrepo.py Thu May 26 13:00:07 2011 +0200
@@ -831,6 +831,20 @@
self._wlockref = weakref.ref(l)
return l
+ def getwatcher(self, store=True, config=False, reset=False):
+ '''Return an fswatcher object that can be used to check for various
+ changes to the repository.
+
+ store - watch the repository store; default
+ config - watch the repository configuration file
+ reset - start watcher in the reset state'''
+ files = []
+ if store:
+ files += [self.sjoin("00changelog.i"), self.spath]
+ if config:
+ files.append(self.join("hgrc"))
+ return util.fswatcher(files, reset=reset)
+
def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
"""
commit an individual file as part of a larger transaction
More information about the Mercurial-devel
mailing list