Patchwork D2365: tests: port extension in test-narrow-expanddirstate.t to Python 3

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2018, 5:41 p.m.
Message ID <differential-rev-PHID-DREV-yzc4hhlir2t4otipefpe-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28192/
State Superseded
Headers show

Comments

phabricator - Feb. 21, 2018, 5:41 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2365

AFFECTED FILES
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t
--- a/tests/test-narrow-expanddirstate.t
+++ b/tests/test-narrow-expanddirstate.t
@@ -48,6 +48,7 @@ 
   > import os
   > import sys
   > 
+  > from mercurial import encoding
   > from mercurial import extensions
   > from mercurial import localrepo
   > from mercurial import match as matchmod
@@ -64,11 +65,11 @@ 
   >   currentmatcher = narrowspec.match(repo.root, includes, excludes)
   >   includes = includes | newincludes
   >   if not repo.currenttransaction():
-  >     ui.develwarn('expandnarrowspec called outside of transaction!')
+  >     ui.develwarn(b'expandnarrowspec called outside of transaction!')
   >   repo.setnarrowpats(includes, excludes)
   >   newmatcher = narrowspec.match(repo.root, includes, excludes)
   >   added = matchmod.differencematcher(newmatcher, currentmatcher)
-  >   for f in repo['.'].manifest().walk(added):
+  >   for f in repo[b'.'].manifest().walk(added):
   >     repo.dirstate.normallookup(f)
   > 
   > def makeds(ui, repo):
@@ -79,22 +80,23 @@ 
   >       def _map(self):
   >         ret = super(expandingdirstate, self)._map
   >         with repo.wlock(), repo.lock(), repo.transaction(
-  >             'expandnarrowspec'):
-  >           expandnarrowspec(ui, repo, os.environ.get('DIRSTATEINCLUDES'))
+  >             b'expandnarrowspec'):
+  >           expandnarrowspec(ui, repo,
+  >                            encoding.environ.get(b'DIRSTATEINCLUDES'))
   >         return ret
   >     ds.__class__ = expandingdirstate
   >     return ds
   >   return wrapds
   > 
   > def reposetup(ui, repo):
-  >   extensions.wrapfilecache(localrepo.localrepository, 'dirstate',
+  >   extensions.wrapfilecache(localrepo.localrepository, b'dirstate',
   >                            makeds(ui, repo))
   >   def overridepatch(orig, *args, **kwargs):
   >     with repo.wlock():
-  >       expandnarrowspec(ui, repo, os.environ.get('PATCHINCLUDES'))
+  >       expandnarrowspec(ui, repo, encoding.environ.get(b'PATCHINCLUDES'))
   >       return orig(*args, **kwargs)
   > 
-  >   extensions.wrapfunction(patch, 'patch', overridepatch)
+  >   extensions.wrapfunction(patch, b'patch', overridepatch)
   > EOF
   $ cat >> ".hg/hgrc" <<EOF
   > [extensions]