Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hook.py @ 30528: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 | 39d13b8c101d |
children | 22fbca1d11ed |
comparison
equal
deleted
inserted
replaced
30527:a8b17859684a | 30528:20a42325fdef |
---|---|
14 from .i18n import _ | 14 from .i18n import _ |
15 from . import ( | 15 from . import ( |
16 demandimport, | 16 demandimport, |
17 error, | 17 error, |
18 extensions, | 18 extensions, |
19 pycompat, | |
19 util, | 20 util, |
20 ) | 21 ) |
21 | 22 |
22 def _pythonhook(ui, repo, name, hname, funcname, args, throw): | 23 def _pythonhook(ui, repo, name, hname, funcname, args, throw): |
23 '''call python hook. hook is callable object, looked up as | 24 '''call python hook. hook is callable object, looked up as |
139 env['HG_' + k.upper()] = v | 140 env['HG_' + k.upper()] = v |
140 | 141 |
141 if repo: | 142 if repo: |
142 cwd = repo.root | 143 cwd = repo.root |
143 else: | 144 else: |
144 cwd = os.getcwd() | 145 cwd = pycompat.getcwd() |
145 r = ui.system(cmd, environ=env, cwd=cwd) | 146 r = ui.system(cmd, environ=env, cwd=cwd) |
146 | 147 |
147 duration = time.time() - starttime | 148 duration = time.time() - starttime |
148 ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n', | 149 ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n', |
149 name, cmd, duration) | 150 name, cmd, duration) |