comparison hgext/fastannotate/commands.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 b77f2ea51da5
children fa88170c10bb
comparison
equal deleted inserted replaced
39817:94c25f694ec3 39818:24e493ec2229
10 import os 10 import os
11 11
12 from mercurial.i18n import _ 12 from mercurial.i18n import _
13 from mercurial import ( 13 from mercurial import (
14 commands, 14 commands,
15 encoding,
15 error, 16 error,
16 extensions, 17 extensions,
17 patch, 18 patch,
18 pycompat, 19 pycompat,
19 registrar, 20 registrar,
39 # b) if we treat pats as plain file names, some of them do not have 40 # b) if we treat pats as plain file names, some of them do not have
40 # corresponding linelog files 41 # corresponding linelog files
41 if perfhack: 42 if perfhack:
42 # cwd related to reporoot 43 # cwd related to reporoot
43 reporoot = os.path.dirname(repo.path) 44 reporoot = os.path.dirname(repo.path)
44 reldir = os.path.relpath(pycompat.getcwd(), reporoot) 45 reldir = os.path.relpath(encoding.getcwd(), reporoot)
45 if reldir == '.': 46 if reldir == '.':
46 reldir = '' 47 reldir = ''
47 if any(opts.get(o[1]) for o in commands.walkopts): # a) 48 if any(opts.get(o[1]) for o in commands.walkopts): # a)
48 perfhack = False 49 perfhack = False
49 else: # b) 50 else: # b)