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): |