##// END OF EJS Templates
py3: replace os.environ with encoding.environ (part 1 of 5)...
Pulkit Goyal -
r30634:ad15646d default
parent child Browse files
Show More
@@ -8,7 +8,6
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11 import os
12
11
13 from .i18n import _
12 from .i18n import _
14 from .node import (
13 from .node import (
@@ -31,7 +30,7 def _getbkfile(repo):
31 may need to tweak this behavior further.
30 may need to tweak this behavior further.
32 """
31 """
33 bkfile = None
32 bkfile = None
34 if 'HG_PENDING' in os.environ:
33 if 'HG_PENDING' in encoding.environ:
35 try:
34 try:
36 bkfile = repo.vfs('bookmarks.pending')
35 bkfile = repo.vfs('bookmarks.pending')
37 except IOError as inst:
36 except IOError as inst:
@@ -67,7 +67,7 def _trypending(root, vfs, filename):
67
67
68 This returns '(fp, is_pending_opened)' tuple.
68 This returns '(fp, is_pending_opened)' tuple.
69 '''
69 '''
70 if root == os.environ.get('HG_PENDING'):
70 if root == encoding.environ.get('HG_PENDING'):
71 try:
71 try:
72 return (vfs('%s.pending' % filename), True)
72 return (vfs('%s.pending' % filename), True)
73 except IOError as inst:
73 except IOError as inst:
@@ -499,8 +499,8 class localrepository(object):
499 @storecache('00changelog.i')
499 @storecache('00changelog.i')
500 def changelog(self):
500 def changelog(self):
501 c = changelog.changelog(self.svfs)
501 c = changelog.changelog(self.svfs)
502 if 'HG_PENDING' in os.environ:
502 if 'HG_PENDING' in encoding.environ:
503 p = os.environ['HG_PENDING']
503 p = encoding.environ['HG_PENDING']
504 if p.startswith(self.root):
504 if p.startswith(self.root):
505 c.readpending('00changelog.i.a')
505 c.readpending('00changelog.i.a')
506 return c
506 return c
@@ -1299,7 +1299,7 class localrepository(object):
1299 # the contents of parentenvvar are used by the underlying lock to
1299 # the contents of parentenvvar are used by the underlying lock to
1300 # determine whether it can be inherited
1300 # determine whether it can be inherited
1301 if parentenvvar is not None:
1301 if parentenvvar is not None:
1302 parentlock = os.environ.get(parentenvvar)
1302 parentlock = encoding.environ.get(parentenvvar)
1303 try:
1303 try:
1304 l = lockmod.lock(vfs, lockname, 0, releasefn=releasefn,
1304 l = lockmod.lock(vfs, lockname, 0, releasefn=releasefn,
1305 acquirefn=acquirefn, desc=desc,
1305 acquirefn=acquirefn, desc=desc,
@@ -103,7 +103,6 Note: old client behave as a publishing
103 from __future__ import absolute_import
103 from __future__ import absolute_import
104
104
105 import errno
105 import errno
106 import os
107
106
108 from .i18n import _
107 from .i18n import _
109 from .node import (
108 from .node import (
@@ -114,6 +113,7 from .node import (
114 short,
113 short,
115 )
114 )
116 from . import (
115 from . import (
116 encoding,
117 error,
117 error,
118 )
118 )
119
119
@@ -137,7 +137,7 def _readroots(repo, phasedefaults=None)
137 roots = [set() for i in allphases]
137 roots = [set() for i in allphases]
138 try:
138 try:
139 f = None
139 f = None
140 if 'HG_PENDING' in os.environ:
140 if 'HG_PENDING' in encoding.environ:
141 try:
141 try:
142 f = repo.svfs('phaseroots.pending')
142 f = repo.svfs('phaseroots.pending')
143 except IOError as inst:
143 except IOError as inst:
@@ -462,7 +462,7 def findexe(command):
462 if sys.platform == 'plan9':
462 if sys.platform == 'plan9':
463 return findexisting(os.path.join('/bin', command))
463 return findexisting(os.path.join('/bin', command))
464
464
465 for path in os.environ.get('PATH', '').split(pycompat.ospathsep):
465 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep):
466 executable = findexisting(os.path.join(path, command))
466 executable = findexisting(os.path.join(path, command))
467 if executable is not None:
467 if executable is not None:
468 return executable
468 return executable
General Comments 0
You need to be logged in to leave comments. Login now