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