[PATCH 1 of 6] localrepo: add auditor attribute which knows about subrepos
Martin Geisler
mg at lazybytes.net
Mon Aug 30 17:01:33 CDT 2010
# HG changeset patch
# User Martin Geisler <mg at lazybytes.net>
# Date 1283205545 -7200
# Node ID 2075384560dc39a9ffa340473a9abd2abda57a96
# Parent cd895084a4cd80abd241060705090aa7c3d9f39a
localrepo: add auditor attribute which knows about subrepos
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -28,6 +28,7 @@
self.root = os.path.realpath(util.expandpath(path))
self.path = os.path.join(self.root, ".hg")
self.origroot = path
+ self.auditor = util.path_auditor(self.root, self._checknested)
self.opener = util.opener(self.path)
self.wopener = util.opener(self.root)
self.baseui = baseui
@@ -111,6 +112,15 @@
self._datafilters = {}
self._transref = self._lockref = self._wlockref = None
+ def _checknested(self, path):
+ """Determine if path is a legal nested repository."""
+ # XXX: which revision to use?
+ ctx = self['.']
+ if not path.startswith(self.root):
+ return False
+ sub = path[len(self.root) + 1:]
+ return sub in ctx.substate
+
@propertycache
def changelog(self):
c = changelog.changelog(self.sopener)
More information about the Mercurial-devel
mailing list