[PATCH] match: override 'visitdir' in subdirmatcher

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Feb 13 11:15:38 EST 2016



On 02/12/2016 09:32 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1454736344 28800
> #      Fri Feb 05 21:25:44 2016 -0800
> # Node ID 53dcf85064a5747e475fa89c8e70c310bd44ce46
> # Parent  d3f1b7ee5e7091afa7bf8059013ddfb3b385a37c
> match: override 'visitdir' in subdirmatcher
>
> The manifest.manifest class has a _treeinmem member than one can
> manually set to True to test that the treemanifest class works as a
> drop-in replacement for manifestdict (which is mostly a requirement
> for treemanifest repos to work). However, it doesn't quite work at the
> moment. These tests fail:
>
> test-largefiles-misc.t
> test-rebase-newancestor.t
> test-subrepo.t
> test-subrepo-deep-nested-change.t
> test-subrepo-recursion.t
>
> All but test-rebase-newancestor.t fail because they trigger calls to
> subdirmatcher.visitdir(), which tries to access a _excluderoots field
> that does not exist on the subdirmatcher. Let's fix that by overriding
> visitdir() in a similar way to how matchfn is overridden, i.e. by
> prepending the directory before calling the superclass method.
>
> diff -r d3f1b7ee5e70 -r 53dcf85064a5 mercurial/match.py
> --- a/mercurial/match.py Fri Feb 05 21:09:32 2016 -0800
> +++ b/mercurial/match.py Fri Feb 05 21:25:44 2016 -0800
> @@ -382,6 +382,11 @@
>
>           self._anypats = matcher._anypats
>           self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn)
> +        def visitdir(dir):

Can I get you to add a comment about why we overwrite this code ?

Future reader will thank you.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list