mercurial/unionrepo.py
changeset 30519 20a42325fdef
parent 30374 f2d146d1e8d6
child 30743 2df983125d37
equal deleted inserted replaced
30518:a8b17859684a 30519:20a42325fdef
    10 """Repository class for "in-memory pull" of one local repository to another,
    10 """Repository class for "in-memory pull" of one local repository to another,
    11 allowing operations like diff and log with revsets.
    11 allowing operations like diff and log with revsets.
    12 """
    12 """
    13 
    13 
    14 from __future__ import absolute_import
    14 from __future__ import absolute_import
    15 
       
    16 import os
       
    17 
    15 
    18 from .i18n import _
    16 from .i18n import _
    19 from .node import nullid
    17 from .node import nullid
    20 
    18 
    21 from . import (
    19 from . import (
    25     filelog,
    23     filelog,
    26     localrepo,
    24     localrepo,
    27     manifest,
    25     manifest,
    28     mdiff,
    26     mdiff,
    29     pathutil,
    27     pathutil,
       
    28     pycompat,
    30     revlog,
    29     revlog,
    31     scmutil,
    30     scmutil,
    32     util,
    31     util,
    33 )
    32 )
    34 
    33 
   227 
   226 
   228     def peer(self):
   227     def peer(self):
   229         return unionpeer(self)
   228         return unionpeer(self)
   230 
   229 
   231     def getcwd(self):
   230     def getcwd(self):
   232         return os.getcwd() # always outside the repo
   231         return pycompat.getcwd() # always outside the repo
   233 
   232 
   234 def instance(ui, path, create):
   233 def instance(ui, path, create):
   235     if create:
   234     if create:
   236         raise error.Abort(_('cannot create new union repository'))
   235         raise error.Abort(_('cannot create new union repository'))
   237     parentpath = ui.config("bundle", "mainreporoot", "")
   236     parentpath = ui.config("bundle", "mainreporoot", "")
   238     if not parentpath:
   237     if not parentpath:
   239         # try to find the correct path to the working directory repo
   238         # try to find the correct path to the working directory repo
   240         parentpath = cmdutil.findrepo(os.getcwd())
   239         parentpath = cmdutil.findrepo(pycompat.getcwd())
   241         if parentpath is None:
   240         if parentpath is None:
   242             parentpath = ''
   241             parentpath = ''
   243     if parentpath:
   242     if parentpath:
   244         # Try to make the full path relative so we get a nice, short URL.
   243         # Try to make the full path relative so we get a nice, short URL.
   245         # In particular, we don't want temp dir names in test outputs.
   244         # In particular, we don't want temp dir names in test outputs.
   246         cwd = os.getcwd()
   245         cwd = pycompat.getcwd()
   247         if parentpath == cwd:
   246         if parentpath == cwd:
   248             parentpath = ''
   247             parentpath = ''
   249         else:
   248         else:
   250             cwd = pathutil.normasprefix(cwd)
   249             cwd = pathutil.normasprefix(cwd)
   251             if parentpath.startswith(cwd):
   250             if parentpath.startswith(cwd):