mercurial/localrepo.py
changeset 31231 0a38a313033e
parent 31209 dd2364f5180a
child 31279 052bc876a879
equal deleted inserted replaced
31230:cc37b5a06e32 31231:0a38a313033e
    57     subrepo,
    57     subrepo,
    58     tags as tagsmod,
    58     tags as tagsmod,
    59     transaction,
    59     transaction,
    60     txnutil,
    60     txnutil,
    61     util,
    61     util,
       
    62     vfs as vfsmod,
    62 )
    63 )
    63 
    64 
    64 release = lockmod.release
    65 release = lockmod.release
    65 urlerr = util.urlerr
    66 urlerr = util.urlerr
    66 urlreq = util.urlreq
    67 urlreq = util.urlreq
   253     featuresetupfuncs = set()
   254     featuresetupfuncs = set()
   254 
   255 
   255     def __init__(self, baseui, path, create=False):
   256     def __init__(self, baseui, path, create=False):
   256         self.requirements = set()
   257         self.requirements = set()
   257         # vfs to access the working copy
   258         # vfs to access the working copy
   258         self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
   259         self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
   259         # vfs to access the content of the repository
   260         # vfs to access the content of the repository
   260         self.vfs = None
   261         self.vfs = None
   261         # vfs to access the store part of the repository
   262         # vfs to access the store part of the repository
   262         self.svfs = None
   263         self.svfs = None
   263         self.root = self.wvfs.base
   264         self.root = self.wvfs.base
   264         self.path = self.wvfs.join(".hg")
   265         self.path = self.wvfs.join(".hg")
   265         self.origroot = path
   266         self.origroot = path
   266         self.auditor = pathutil.pathauditor(self.root, self._checknested)
   267         self.auditor = pathutil.pathauditor(self.root, self._checknested)
   267         self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
   268         self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
   268                                                 realfs=False)
   269                                                 realfs=False)
   269         self.vfs = scmutil.vfs(self.path)
   270         self.vfs = vfsmod.vfs(self.path)
   270         self.baseui = baseui
   271         self.baseui = baseui
   271         self.ui = baseui.copy()
   272         self.ui = baseui.copy()
   272         self.ui.copy = baseui.copy # prevent copying repo configuration
   273         self.ui.copy = baseui.copy # prevent copying repo configuration
   273         # A list of callback to shape the phase if no data were found.
   274         # A list of callback to shape the phase if no data were found.
   274         # Callback are in the form: func(repo, roots) --> processed root.
   275         # Callback are in the form: func(repo, roots) --> processed root.
   329         self.sharedpath = self.path
   330         self.sharedpath = self.path
   330         try:
   331         try:
   331             sharedpath = self.vfs.read("sharedpath").rstrip('\n')
   332             sharedpath = self.vfs.read("sharedpath").rstrip('\n')
   332             if 'relshared' in self.requirements:
   333             if 'relshared' in self.requirements:
   333                 sharedpath = self.vfs.join(sharedpath)
   334                 sharedpath = self.vfs.join(sharedpath)
   334             vfs = scmutil.vfs(sharedpath, realpath=True)
   335             vfs = vfsmod.vfs(sharedpath, realpath=True)
   335 
       
   336             s = vfs.base
   336             s = vfs.base
   337             if not vfs.exists():
   337             if not vfs.exists():
   338                 raise error.RepoError(
   338                 raise error.RepoError(
   339                     _('.hg/sharedpath points to nonexistent directory %s') % s)
   339                     _('.hg/sharedpath points to nonexistent directory %s') % s)
   340             self.sharedpath = s
   340             self.sharedpath = s
   341         except IOError as inst:
   341         except IOError as inst:
   342             if inst.errno != errno.ENOENT:
   342             if inst.errno != errno.ENOENT:
   343                 raise
   343                 raise
   344 
   344 
   345         self.store = store.store(
   345         self.store = store.store(
   346                 self.requirements, self.sharedpath, scmutil.vfs)
   346                 self.requirements, self.sharedpath, vfsmod.vfs)
   347         self.spath = self.store.path
   347         self.spath = self.store.path
   348         self.svfs = self.store.vfs
   348         self.svfs = self.store.vfs
   349         self.sjoin = self.store.join
   349         self.sjoin = self.store.join
   350         self.vfs.createmode = self.store.createmode
   350         self.vfs.createmode = self.store.createmode
   351         self._applyopenerreqs()
   351         self._applyopenerreqs()