Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.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 | a8b17859684a |
children | 1ee358c3ed26 |
comparison
equal
deleted
inserted
replaced
30518:a8b17859684a | 30519:20a42325fdef |
---|---|
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import operator | 10 import operator |
11 import os | |
12 import random | 11 import random |
13 | 12 |
14 from .i18n import _ | 13 from .i18n import _ |
15 from .node import ( | 14 from .node import ( |
16 hex, | 15 hex, |
28 exchange, | 27 exchange, |
29 extensions, | 28 extensions, |
30 hg, | 29 hg, |
31 localrepo, | 30 localrepo, |
32 lock as lockmod, | 31 lock as lockmod, |
32 pycompat, | |
33 revlog, | 33 revlog, |
34 scmutil, | 34 scmutil, |
35 setdiscovery, | 35 setdiscovery, |
36 simplemerge, | 36 simplemerge, |
37 streamclone, | 37 streamclone, |
48 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) | 48 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
49 def debugancestor(ui, repo, *args): | 49 def debugancestor(ui, repo, *args): |
50 """find the ancestor revision of two revisions in a given index""" | 50 """find the ancestor revision of two revisions in a given index""" |
51 if len(args) == 3: | 51 if len(args) == 3: |
52 index, rev1, rev2 = args | 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 lookup = r.lookup | 54 lookup = r.lookup |
55 elif len(args) == 2: | 55 elif len(args) == 2: |
56 if not repo: | 56 if not repo: |
57 raise error.Abort(_('there is no Mercurial repository here ' | 57 raise error.Abort(_('there is no Mercurial repository here ' |
58 '(.hg not found)')) | 58 '(.hg not found)')) |
383 Otherwise, the changelog DAG of the current repo is emitted. | 383 Otherwise, the changelog DAG of the current repo is emitted. |
384 """ | 384 """ |
385 spaces = opts.get('spaces') | 385 spaces = opts.get('spaces') |
386 dots = opts.get('dots') | 386 dots = opts.get('dots') |
387 if file_: | 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 revs = set((int(r) for r in revs)) | 390 revs = set((int(r) for r in revs)) |
390 def events(): | 391 def events(): |
391 for r in rlog: | 392 for r in rlog: |
392 yield 'n', (r, list(p for p in rlog.parentrevs(r) | 393 yield 'n', (r, list(p for p in rlog.parentrevs(r) |
393 if p != -1)) | 394 if p != -1)) |