repo: add internal support for sharing store directories
set .hg/sharedpath to point to the .hg to share with
--- a/mercurial/localrepo.py Fri Jun 12 02:19:51 2009 -0500
+++ b/mercurial/localrepo.py Sat Jun 13 18:01:46 2009 -0500
@@ -19,7 +19,7 @@
class localrepository(repo.repository):
capabilities = set(('lookup', 'changegroupsubset', 'branchmap'))
- supported = set('revlogv1 store fncache'.split())
+ supported = set('revlogv1 store fncache shared'.split())
def __init__(self, baseui, path=None, create=0):
repo.repository.__init__(self)
@@ -72,7 +72,18 @@
for r in requirements - self.supported:
raise error.RepoError(_("requirement '%s' not supported") % r)
- self.store = store.store(requirements, self.path, util.opener)
+ self.sharedpath = self.path
+ try:
+ s = os.path.realpath(self.opener("sharedpath").read())
+ if not os.path.exists(s):
+ raise error.RepoError(
+ _('.hg/sharedpath points to nonexistent directory %s' % s))
+ self.sharedpath = s
+ except IOError, inst:
+ if inst.errno != errno.ENOENT:
+ raise
+
+ self.store = store.store(requirements, self.sharedpath, util.opener)
self.spath = self.store.path
self.sopener = self.store.opener
self.sjoin = self.store.join