##// END OF EJS Templates
tests: port extension in test-narrow-expanddirstate.t to Python 3...
Augie Fackler -
r36365:f6ddbcff default
parent child Browse files
Show More
@@ -48,6 +48,7 b' have this method available in narrowhg p'
48 48 > import os
49 49 > import sys
50 50 >
51 > from mercurial import encoding
51 52 > from mercurial import extensions
52 53 > from mercurial import localrepo
53 54 > from mercurial import match as matchmod
@@ -64,11 +65,11 b' have this method available in narrowhg p'
64 65 > currentmatcher = narrowspec.match(repo.root, includes, excludes)
65 66 > includes = includes | newincludes
66 67 > if not repo.currenttransaction():
67 > ui.develwarn('expandnarrowspec called outside of transaction!')
68 > ui.develwarn(b'expandnarrowspec called outside of transaction!')
68 69 > repo.setnarrowpats(includes, excludes)
69 70 > newmatcher = narrowspec.match(repo.root, includes, excludes)
70 71 > added = matchmod.differencematcher(newmatcher, currentmatcher)
71 > for f in repo['.'].manifest().walk(added):
72 > for f in repo[b'.'].manifest().walk(added):
72 73 > repo.dirstate.normallookup(f)
73 74 >
74 75 > def makeds(ui, repo):
@@ -79,22 +80,23 b' have this method available in narrowhg p'
79 80 > def _map(self):
80 81 > ret = super(expandingdirstate, self)._map
81 82 > with repo.wlock(), repo.lock(), repo.transaction(
82 > 'expandnarrowspec'):
83 > expandnarrowspec(ui, repo, os.environ.get('DIRSTATEINCLUDES'))
83 > b'expandnarrowspec'):
84 > expandnarrowspec(ui, repo,
85 > encoding.environ.get(b'DIRSTATEINCLUDES'))
84 86 > return ret
85 87 > ds.__class__ = expandingdirstate
86 88 > return ds
87 89 > return wrapds
88 90 >
89 91 > def reposetup(ui, repo):
90 > extensions.wrapfilecache(localrepo.localrepository, 'dirstate',
92 > extensions.wrapfilecache(localrepo.localrepository, b'dirstate',
91 93 > makeds(ui, repo))
92 94 > def overridepatch(orig, *args, **kwargs):
93 95 > with repo.wlock():
94 > expandnarrowspec(ui, repo, os.environ.get('PATCHINCLUDES'))
96 > expandnarrowspec(ui, repo, encoding.environ.get(b'PATCHINCLUDES'))
95 97 > return orig(*args, **kwargs)
96 98 >
97 > extensions.wrapfunction(patch, 'patch', overridepatch)
99 > extensions.wrapfunction(patch, b'patch', overridepatch)
98 100 > EOF
99 101 $ cat >> ".hg/hgrc" <<EOF
100 102 > [extensions]
General Comments 0
You need to be logged in to leave comments. Login now