comparison mercurial/unionrepo.py @ 39818:24e493ec2229

py3: rename pycompat.getcwd() to encoding.getcwd() (API) We need to avoid os.getcwdb() on Windows to avoid DeprecationWarnings, and we need encoding.strtolocal() to encode the result of os.getcwd().
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 21 Sep 2018 19:48:23 -0400
parents 5ccd791344f3
children 39f51064e9f5
comparison
equal deleted inserted replaced
39817:94c25f694ec3 39818:24e493ec2229
17 from .node import nullid 17 from .node import nullid
18 18
19 from . import ( 19 from . import (
20 changelog, 20 changelog,
21 cmdutil, 21 cmdutil,
22 encoding,
22 error, 23 error,
23 filelog, 24 filelog,
24 localrepo, 25 localrepo,
25 manifest, 26 manifest,
26 mdiff, 27 mdiff,
27 pathutil, 28 pathutil,
28 pycompat,
29 revlog, 29 revlog,
30 util, 30 util,
31 vfs as vfsmod, 31 vfs as vfsmod,
32 ) 32 )
33 33
238 238
239 def peer(self): 239 def peer(self):
240 return unionpeer(self) 240 return unionpeer(self)
241 241
242 def getcwd(self): 242 def getcwd(self):
243 return pycompat.getcwd() # always outside the repo 243 return encoding.getcwd() # always outside the repo
244 244
245 def instance(ui, path, create, intents=None, createopts=None): 245 def instance(ui, path, create, intents=None, createopts=None):
246 if create: 246 if create:
247 raise error.Abort(_('cannot create new union repository')) 247 raise error.Abort(_('cannot create new union repository'))
248 parentpath = ui.config("bundle", "mainreporoot") 248 parentpath = ui.config("bundle", "mainreporoot")
249 if not parentpath: 249 if not parentpath:
250 # try to find the correct path to the working directory repo 250 # try to find the correct path to the working directory repo
251 parentpath = cmdutil.findrepo(pycompat.getcwd()) 251 parentpath = cmdutil.findrepo(encoding.getcwd())
252 if parentpath is None: 252 if parentpath is None:
253 parentpath = '' 253 parentpath = ''
254 if parentpath: 254 if parentpath:
255 # Try to make the full path relative so we get a nice, short URL. 255 # Try to make the full path relative so we get a nice, short URL.
256 # In particular, we don't want temp dir names in test outputs. 256 # In particular, we don't want temp dir names in test outputs.
257 cwd = pycompat.getcwd() 257 cwd = encoding.getcwd()
258 if parentpath == cwd: 258 if parentpath == cwd:
259 parentpath = '' 259 parentpath = ''
260 else: 260 else:
261 cwd = pathutil.normasprefix(cwd) 261 cwd = pathutil.normasprefix(cwd)
262 if parentpath.startswith(cwd): 262 if parentpath.startswith(cwd):