# HG changeset patch # User Matt Mackall # Date 1244934106 18000 # Node ID 87d1fd40f57e7b88a9528048ffd7b1ee0b8f2a38 # Parent 92fc57c9f9d1081c517e0c19f6ba0716741d9cc1 repo: add internal support for sharing store directories set .hg/sharedpath to point to the .hg to share with diff -r 92fc57c9f9d1 -r 87d1fd40f57e mercurial/localrepo.py --- 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