mercurial/bundlerepo.py
changeset 39818 24e493ec2229
parent 39763 5ccd791344f3
child 39944 75b53b809e87
equal deleted inserted replaced
39817:94c25f694ec3 39818:24e493ec2229
    23     bundle2,
    23     bundle2,
    24     changegroup,
    24     changegroup,
    25     changelog,
    25     changelog,
    26     cmdutil,
    26     cmdutil,
    27     discovery,
    27     discovery,
       
    28     encoding,
    28     error,
    29     error,
    29     exchange,
    30     exchange,
    30     filelog,
    31     filelog,
    31     localrepo,
    32     localrepo,
    32     manifest,
    33     manifest,
   430 
   431 
   431     def peer(self):
   432     def peer(self):
   432         return bundlepeer(self)
   433         return bundlepeer(self)
   433 
   434 
   434     def getcwd(self):
   435     def getcwd(self):
   435         return pycompat.getcwd() # always outside the repo
   436         return encoding.getcwd() # always outside the repo
   436 
   437 
   437     # Check if parents exist in localrepo before setting
   438     # Check if parents exist in localrepo before setting
   438     def setparents(self, p1, p2=nullid):
   439     def setparents(self, p1, p2=nullid):
   439         p1rev = self.changelog.rev(p1)
   440         p1rev = self.changelog.rev(p1)
   440         p2rev = self.changelog.rev(p2)
   441         p2rev = self.changelog.rev(p2)
   450         raise error.Abort(_('cannot create new bundle repository'))
   451         raise error.Abort(_('cannot create new bundle repository'))
   451     # internal config: bundle.mainreporoot
   452     # internal config: bundle.mainreporoot
   452     parentpath = ui.config("bundle", "mainreporoot")
   453     parentpath = ui.config("bundle", "mainreporoot")
   453     if not parentpath:
   454     if not parentpath:
   454         # try to find the correct path to the working directory repo
   455         # try to find the correct path to the working directory repo
   455         parentpath = cmdutil.findrepo(pycompat.getcwd())
   456         parentpath = cmdutil.findrepo(encoding.getcwd())
   456         if parentpath is None:
   457         if parentpath is None:
   457             parentpath = ''
   458             parentpath = ''
   458     if parentpath:
   459     if parentpath:
   459         # Try to make the full path relative so we get a nice, short URL.
   460         # Try to make the full path relative so we get a nice, short URL.
   460         # In particular, we don't want temp dir names in test outputs.
   461         # In particular, we don't want temp dir names in test outputs.
   461         cwd = pycompat.getcwd()
   462         cwd = encoding.getcwd()
   462         if parentpath == cwd:
   463         if parentpath == cwd:
   463             parentpath = ''
   464             parentpath = ''
   464         else:
   465         else:
   465             cwd = pathutil.normasprefix(cwd)
   466             cwd = pathutil.normasprefix(cwd)
   466             if parentpath.startswith(cwd):
   467             if parentpath.startswith(cwd):