comparison mercurial/cmdutil.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 fd805a44b89d
children 0d703063d0c8
comparison
equal deleted inserted replaced
39817:94c25f694ec3 39818:24e493ec2229
579 579
580 m = scmutil.match(repo[None]) 580 m = scmutil.match(repo[None])
581 unresolvedlist = [f for f in mergestate.unresolved() if m(f)] 581 unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
582 if unresolvedlist: 582 if unresolvedlist:
583 mergeliststr = '\n'.join( 583 mergeliststr = '\n'.join(
584 [' %s' % util.pathto(repo.root, pycompat.getcwd(), path) 584 [' %s' % util.pathto(repo.root, encoding.getcwd(), path)
585 for path in unresolvedlist]) 585 for path in unresolvedlist])
586 msg = _('''Unresolved merge conflicts: 586 msg = _('''Unresolved merge conflicts:
587 587
588 %s 588 %s
589 589
1108 1108
1109 if not file_: 1109 if not file_:
1110 raise error.CommandError(cmd, _('invalid arguments')) 1110 raise error.CommandError(cmd, _('invalid arguments'))
1111 if not os.path.isfile(file_): 1111 if not os.path.isfile(file_):
1112 raise error.Abort(_("revlog '%s' not found") % file_) 1112 raise error.Abort(_("revlog '%s' not found") % file_)
1113 r = revlog.revlog(vfsmod.vfs(pycompat.getcwd(), audit=False), 1113 r = revlog.revlog(vfsmod.vfs(encoding.getcwd(), audit=False),
1114 file_[:-2] + ".i") 1114 file_[:-2] + ".i")
1115 return r 1115 return r
1116 1116
1117 def openrevlog(repo, cmd, file_, opts): 1117 def openrevlog(repo, cmd, file_, opts):
1118 """Obtain a revlog backing storage of an item. 1118 """Obtain a revlog backing storage of an item.
2627 forms.pop() 2627 forms.pop()
2628 else: 2628 else:
2629 committext = buildcommittext(repo, ctx, subs, extramsg) 2629 committext = buildcommittext(repo, ctx, subs, extramsg)
2630 2630
2631 # run editor in the repository root 2631 # run editor in the repository root
2632 olddir = pycompat.getcwd() 2632 olddir = encoding.getcwd()
2633 os.chdir(repo.root) 2633 os.chdir(repo.root)
2634 2634
2635 # make in-memory changes visible to external process 2635 # make in-memory changes visible to external process
2636 tr = repo.currenttransaction() 2636 tr = repo.currenttransaction()
2637 repo.dirstate.write(tr) 2637 repo.dirstate.write(tr)