sparse: fix debugrebuilddirsate when narrow extension is enabled
dirstate wrapping in narrow extension converts the manifest object to a list. So
let's assume we get a list of files in sparse extension.
Differential Revision: https://phab.mercurial-scm.org/D5481
--- a/hgext/sparse.py Mon Dec 24 15:57:54 2018 +0300
+++ b/hgext/sparse.py Mon Dec 24 16:04:52 2018 +0300
@@ -210,7 +210,7 @@
def _rebuild(orig, self, parent, allfiles, changedfiles=None):
matcher = self._sparsematcher
if not matcher.always():
- allfiles = allfiles.matches(matcher)
+ allfiles = [f for f in allfiles if matcher(f)]
if changedfiles:
changedfiles = [f for f in changedfiles if matcher(f)]
--- a/tests/test-narrow-sparse.t Mon Dec 24 15:57:54 2018 +0300
+++ b/tests/test-narrow-sparse.t Mon Dec 24 16:04:52 2018 +0300
@@ -67,43 +67,3 @@
treemanifest (tree !)
$ hg debugrebuilddirstate
- ** unknown exception encountered, please report by visiting
- ** https://mercurial-scm.org/wiki/BugTracker
- ** Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
- ** Mercurial Distributed SCM (version 4.8.1+588-479a5ea51ccc+20181224)
- ** Extensions loaded: narrow, sparse
- Traceback (most recent call last):
- File "/place/vartmp/hgtests.zMelCK/install/bin/hg", line 43, in <module>
- dispatch.run()
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 99, in run
- status = dispatch(req)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 225, in dispatch
- ret = _runcatch(req) or 0
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 376, in _runcatch
- return _callcatch(ui, _runcatchfunc)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 384, in _callcatch
- return scmutil.callcatch(ui, func)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/scmutil.py", line 166, in callcatch
- return func()
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 367, in _runcatchfunc
- return _dispatch(req)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 1021, in _dispatch
- cmdpats, cmdoptions)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 756, in runcommand
- ret = _runcommand(ui, options, cmd, d)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 1030, in _runcommand
- return cmdfunc()
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 1018, in <lambda>
- d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/util.py", line 1670, in check
- return func(*args, **kwargs)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/debugcommands.py", line 1998, in debugrebuilddirstate
- dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/narrow/narrowdirstate.py", line 60, in rebuild
- super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/extensions.py", line 437, in closure
- return func(*(args + a), **kw)
- File "/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/sparse.py", line 213, in _rebuild
- allfiles = allfiles.matches(matcher)
- AttributeError: 'list' object has no attribute 'matches'
- [1]