Patchwork D5275: tests: update narrowspec when narrowspec, not dirstate, is accessed

login
register
mail settings
Submitter phabricator
Date Dec. 23, 2018, 2:14 a.m.
Message ID <8b2d8158f6629922bdef6df710e249be@localhost.localdomain>
Download mbox | patch
Permalink /patch/37323/
State Not Applicable
Headers show

Comments

phabricator - Dec. 23, 2018, 2:14 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG92fde28860bb: tests: update narrowspec when narrowspec, not dirstate, is accessed (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5275?vs=12543&id=12957

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

AFFECTED FILES
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS




To: martinvonz, 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
@@ -56,9 +56,13 @@ 
   > from mercurial import patch
   > from mercurial import util as hgutil
   > 
+  > narrowspecexpanded = False
   > def expandnarrowspec(ui, repo, newincludes=None):
   >   if not newincludes:
   >     return
+  >   if getattr(repo, '_narrowspecexpanded', False):
+  >     return
+  >   repo._narrowspecexpanded = True
   >   import sys
   >   newincludes = set([newincludes])
   >   includes, excludes = repo.narrowpats
@@ -72,24 +76,14 @@ 
   >   for f in repo[b'.'].manifest().walk(added):
   >     repo.dirstate.normallookup(f)
   > 
-  > def wrapds(ui, repo, ds):
-  >   class expandingdirstate(ds.__class__):
-  >     @hgutil.propertycache
-  >     def _map(self):
-  >       ret = super(expandingdirstate, self)._map
+  > def reposetup(ui, repo):
+  >   class expandingrepo(repo.__class__):
+  >     def narrowmatch(self, *args, **kwargs):
   >       with repo.wlock(), repo.lock(), repo.transaction(
   >           b'expandnarrowspec'):
   >         expandnarrowspec(ui, repo,
   >                          encoding.environ.get(b'DIRSTATEINCLUDES'))
-  >       return ret
-  >   ds.__class__ = expandingdirstate
-  >   return ds
-  > 
-  > def reposetup(ui, repo):
-  >   class expandingrepo(repo.__class__):
-  >     def _makedirstate(self):
-  >       dirstate = super(expandingrepo, self)._makedirstate()
-  >       return wrapds(ui, repo, dirstate)
+  >       return super(expandingrepo, self).narrowmatch(*args, **kwargs)
   >   repo.__class__ = expandingrepo
   > 
   > def extsetup(unused_ui):