Mercurial > hg
comparison mercurial/bundlerepo.py @ 30519:20a42325fdef
py3: use pycompat.getcwd() instead of os.getcwd()
We have pycompat.getcwd() which returns bytes path on Python 3. This patch
changes most of the occurences of the os.getcwd() with pycompat one.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 23 Nov 2016 00:03:11 +0530 |
parents | 11b8b740d54a |
children | be5b2098a817 |
comparison
equal
deleted
inserted
replaced
30518:a8b17859684a | 30519:20a42325fdef |
---|---|
33 manifest, | 33 manifest, |
34 mdiff, | 34 mdiff, |
35 node as nodemod, | 35 node as nodemod, |
36 pathutil, | 36 pathutil, |
37 phases, | 37 phases, |
38 pycompat, | |
38 revlog, | 39 revlog, |
39 scmutil, | 40 scmutil, |
40 util, | 41 util, |
41 ) | 42 ) |
42 | 43 |
390 | 391 |
391 def peer(self): | 392 def peer(self): |
392 return bundlepeer(self) | 393 return bundlepeer(self) |
393 | 394 |
394 def getcwd(self): | 395 def getcwd(self): |
395 return os.getcwd() # always outside the repo | 396 return pycompat.getcwd() # always outside the repo |
396 | 397 |
397 # Check if parents exist in localrepo before setting | 398 # Check if parents exist in localrepo before setting |
398 def setparents(self, p1, p2=nullid): | 399 def setparents(self, p1, p2=nullid): |
399 p1rev = self.changelog.rev(p1) | 400 p1rev = self.changelog.rev(p1) |
400 p2rev = self.changelog.rev(p2) | 401 p2rev = self.changelog.rev(p2) |
410 raise error.Abort(_('cannot create new bundle repository')) | 411 raise error.Abort(_('cannot create new bundle repository')) |
411 # internal config: bundle.mainreporoot | 412 # internal config: bundle.mainreporoot |
412 parentpath = ui.config("bundle", "mainreporoot", "") | 413 parentpath = ui.config("bundle", "mainreporoot", "") |
413 if not parentpath: | 414 if not parentpath: |
414 # try to find the correct path to the working directory repo | 415 # try to find the correct path to the working directory repo |
415 parentpath = cmdutil.findrepo(os.getcwd()) | 416 parentpath = cmdutil.findrepo(pycompat.getcwd()) |
416 if parentpath is None: | 417 if parentpath is None: |
417 parentpath = '' | 418 parentpath = '' |
418 if parentpath: | 419 if parentpath: |
419 # Try to make the full path relative so we get a nice, short URL. | 420 # Try to make the full path relative so we get a nice, short URL. |
420 # In particular, we don't want temp dir names in test outputs. | 421 # In particular, we don't want temp dir names in test outputs. |
421 cwd = os.getcwd() | 422 cwd = pycompat.getcwd() |
422 if parentpath == cwd: | 423 if parentpath == cwd: |
423 parentpath = '' | 424 parentpath = '' |
424 else: | 425 else: |
425 cwd = pathutil.normasprefix(cwd) | 426 cwd = pathutil.normasprefix(cwd) |
426 if parentpath.startswith(cwd): | 427 if parentpath.startswith(cwd): |