##// END OF EJS Templates
py3: use pycompat.getcwd() instead of os.getcwd()...
Pulkit Goyal -
r30519:20a42325 default
parent child Browse files
Show More
@@ -15,6 +15,7 b' from mercurial.i18n import _'
15 15 from mercurial import (
16 16 encoding,
17 17 error,
18 pycompat,
18 19 util,
19 20 )
20 21
@@ -69,7 +70,7 b' class convert_cvs(converter_source):'
69 70 raise error.Abort(_('revision %s is not a patchset number')
70 71 % self.revs[0])
71 72
72 d = os.getcwd()
73 d = pycompat.getcwd()
73 74 try:
74 75 os.chdir(self.path)
75 76 id = None
@@ -12,6 +12,7 b' from mercurial.i18n import _'
12 12 from mercurial import (
13 13 encoding,
14 14 error,
15 pycompat,
15 16 scmutil,
16 17 strutil,
17 18 util,
@@ -1119,7 +1120,7 b' class svn_sink(converter_sink, commandli'
1119 1120 self.delexec = []
1120 1121 self.copies = []
1121 1122 self.wc = None
1122 self.cwd = os.getcwd()
1123 self.cwd = pycompat.getcwd()
1123 1124
1124 1125 created = False
1125 1126 if os.path.isfile(os.path.join(path, '.svn', 'entries')):
@@ -1139,7 +1140,8 b' class svn_sink(converter_sink, commandli'
1139 1140 path = '/' + path
1140 1141 path = 'file://' + path
1141 1142
1142 wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')
1143 wcpath = os.path.join(pycompat.getcwd(), os.path.basename(path) +
1144 '-wc')
1143 1145 ui.status(_('initializing svn working copy %r\n')
1144 1146 % os.path.basename(wcpath))
1145 1147 self.run0('checkout', path, wcpath)
@@ -87,6 +87,7 b' from mercurial import ('
87 87 lock as lockmod,
88 88 patch as patchmod,
89 89 phases,
90 pycompat,
90 91 registrar,
91 92 revset,
92 93 scmutil,
@@ -3523,7 +3524,7 b' def mqinit(orig, ui, *args, **kwargs):'
3523 3524 raise error.Abort(_('only a local queue repository '
3524 3525 'may be initialized'))
3525 3526 else:
3526 repopath = cmdutil.findrepo(os.getcwd())
3527 repopath = cmdutil.findrepo(pycompat.getcwd())
3527 3528 if not repopath:
3528 3529 raise error.Abort(_('there is no Mercurial repository here '
3529 3530 '(.hg not found)'))
@@ -35,6 +35,7 b' from . import ('
35 35 node as nodemod,
36 36 pathutil,
37 37 phases,
38 pycompat,
38 39 revlog,
39 40 scmutil,
40 41 util,
@@ -392,7 +393,7 b' class bundlerepository(localrepo.localre'
392 393 return bundlepeer(self)
393 394
394 395 def getcwd(self):
395 return os.getcwd() # always outside the repo
396 return pycompat.getcwd() # always outside the repo
396 397
397 398 # Check if parents exist in localrepo before setting
398 399 def setparents(self, p1, p2=nullid):
@@ -412,13 +413,13 b' def instance(ui, path, create):'
412 413 parentpath = ui.config("bundle", "mainreporoot", "")
413 414 if not parentpath:
414 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 417 if parentpath is None:
417 418 parentpath = ''
418 419 if parentpath:
419 420 # Try to make the full path relative so we get a nice, short URL.
420 421 # In particular, we don't want temp dir names in test outputs.
421 cwd = os.getcwd()
422 cwd = pycompat.getcwd()
422 423 if parentpath == cwd:
423 424 parentpath = ''
424 425 else:
@@ -38,6 +38,7 b' from . import ('
38 38 patch,
39 39 pathutil,
40 40 phases,
41 pycompat,
41 42 repair,
42 43 revlog,
43 44 revset,
@@ -570,7 +571,7 b' def openrevlog(repo, cmd, file_, opts):'
570 571 raise error.CommandError(cmd, _('invalid arguments'))
571 572 if not os.path.isfile(file_):
572 573 raise error.Abort(_("revlog '%s' not found") % file_)
573 r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False),
574 r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False),
574 575 file_[:-2] + ".i")
575 576 return r
576 577
@@ -2744,7 +2745,7 b' def commitforceeditor(repo, ctx, subs, f'
2744 2745 committext = buildcommittext(repo, ctx, subs, extramsg)
2745 2746
2746 2747 # run editor in the repository root
2747 olddir = os.getcwd()
2748 olddir = pycompat.getcwd()
2748 2749 os.chdir(repo.root)
2749 2750
2750 2751 # make in-memory changes visible to external process
@@ -2630,7 +2630,7 b' def debugpathcomplete(ui, repo, *specs, '
2630 2630
2631 2631 def complete(path, acceptable):
2632 2632 dirstate = repo.dirstate
2633 spec = os.path.normpath(os.path.join(os.getcwd(), path))
2633 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
2634 2634 rootdir = repo.root + os.sep
2635 2635 if spec != repo.root and not spec.startswith(rootdir):
2636 2636 return [], []
@@ -21,6 +21,7 b' from .i18n import _'
21 21 from . import (
22 22 encoding,
23 23 error,
24 pycompat,
24 25 util,
25 26 )
26 27
@@ -152,7 +153,7 b' class server(object):'
152 153 based stream to fout.
153 154 """
154 155 def __init__(self, ui, repo, fin, fout):
155 self.cwd = os.getcwd()
156 self.cwd = pycompat.getcwd()
156 157
157 158 # developer config: cmdserver.log
158 159 logpath = ui.config("cmdserver", "log", None)
@@ -8,7 +8,6 b''
8 8 from __future__ import absolute_import
9 9
10 10 import operator
11 import os
12 11 import random
13 12
14 13 from .i18n import _
@@ -30,6 +29,7 b' from . import ('
30 29 hg,
31 30 localrepo,
32 31 lock as lockmod,
32 pycompat,
33 33 revlog,
34 34 scmutil,
35 35 setdiscovery,
@@ -50,7 +50,7 b' def debugancestor(ui, repo, *args):'
50 50 """find the ancestor revision of two revisions in a given index"""
51 51 if len(args) == 3:
52 52 index, rev1, rev2 = args
53 r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index)
53 r = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False), index)
54 54 lookup = r.lookup
55 55 elif len(args) == 2:
56 56 if not repo:
@@ -385,7 +385,8 b' def debugdag(ui, repo, file_=None, *revs'
385 385 spaces = opts.get('spaces')
386 386 dots = opts.get('dots')
387 387 if file_:
388 rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_)
388 rlog = revlog.revlog(scmutil.opener(pycompat.getcwd(), audit=False),
389 file_)
389 390 revs = set((int(r) for r in revs))
390 391 def events():
391 392 for r in rlog:
@@ -271,7 +271,7 b' class dirstate(object):'
271 271
272 272 @propertycache
273 273 def _cwd(self):
274 return os.getcwd()
274 return pycompat.getcwd()
275 275
276 276 def getcwd(self):
277 277 '''Return the path from which a canonical path is calculated.
@@ -880,7 +880,7 b' def _dispatch(req):'
880 880 if not path:
881 881 raise error.RepoError(_("no repository found in"
882 882 " '%s' (.hg not found)")
883 % os.getcwd())
883 % pycompat.getcwd())
884 884 raise
885 885 if repo:
886 886 ui = repo.ui
@@ -16,6 +16,7 b' from . import ('
16 16 demandimport,
17 17 error,
18 18 extensions,
19 pycompat,
19 20 util,
20 21 )
21 22
@@ -141,7 +142,7 b' def _exthook(ui, repo, name, cmd, args, '
141 142 if repo:
142 143 cwd = repo.root
143 144 else:
144 cwd = os.getcwd()
145 cwd = pycompat.getcwd()
145 146 r = ui.system(cmd, environ=env, cwd=cwd)
146 147
147 148 duration = time.time() - starttime
@@ -28,6 +28,7 b' from . import ('
28 28 error,
29 29 filemerge,
30 30 obsolete,
31 pycompat,
31 32 scmutil,
32 33 subrepo,
33 34 util,
@@ -1040,7 +1041,7 b' def batchremove(repo, actions):'
1040 1041 wjoin = repo.wjoin
1041 1042 audit = repo.wvfs.audit
1042 1043 try:
1043 cwd = os.getcwd()
1044 cwd = pycompat.getcwd()
1044 1045 except OSError as err:
1045 1046 if err.errno != errno.ENOENT:
1046 1047 raise
@@ -1066,7 +1067,7 b' def batchremove(repo, actions):'
1066 1067 # cwd was present before we started to remove files
1067 1068 # let's check if it is present after we removed them
1068 1069 try:
1069 os.getcwd()
1070 pycompat.getcwd()
1070 1071 except OSError as err:
1071 1072 if err.errno != errno.ENOENT:
1072 1073 raise
@@ -27,6 +27,7 b' from . import ('
27 27 error,
28 28 formatter,
29 29 progress,
30 pycompat,
30 31 scmutil,
31 32 util,
32 33 )
@@ -227,7 +228,7 b' class ui(object):'
227 228 if section in (None, 'paths'):
228 229 # expand vars and ~
229 230 # translate paths relative to root (or home) into absolute paths
230 root = root or os.getcwd()
231 root = root or pycompat.getcwd()
231 232 for c in self._tcfg, self._ucfg, self._ocfg:
232 233 for n, p in c.items('paths'):
233 234 # Ignore sub-options.
@@ -13,8 +13,6 b' allowing operations like diff and log wi'
13 13
14 14 from __future__ import absolute_import
15 15
16 import os
17
18 16 from .i18n import _
19 17 from .node import nullid
20 18
@@ -27,6 +25,7 b' from . import ('
27 25 manifest,
28 26 mdiff,
29 27 pathutil,
28 pycompat,
30 29 revlog,
31 30 scmutil,
32 31 util,
@@ -229,7 +228,7 b' class unionrepository(localrepo.localrep'
229 228 return unionpeer(self)
230 229
231 230 def getcwd(self):
232 return os.getcwd() # always outside the repo
231 return pycompat.getcwd() # always outside the repo
233 232
234 233 def instance(ui, path, create):
235 234 if create:
@@ -237,13 +236,13 b' def instance(ui, path, create):'
237 236 parentpath = ui.config("bundle", "mainreporoot", "")
238 237 if not parentpath:
239 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 240 if parentpath is None:
242 241 parentpath = ''
243 242 if parentpath:
244 243 # Try to make the full path relative so we get a nice, short URL.
245 244 # In particular, we don't want temp dir names in test outputs.
246 cwd = os.getcwd()
245 cwd = pycompat.getcwd()
247 246 if parentpath == cwd:
248 247 parentpath = ''
249 248 else:
General Comments 0
You need to be logged in to leave comments. Login now