[PATCH 3 of 8 STABLE RFC] largefiles: use duplicated 'match' object to modify it
mpm at selenic.com
Fri Feb 17 14:14:37 CST 2012
On Sat, 2012-02-18 at 01:07 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1329494572 -32400
> # Branch stable
> # Node ID 5a568b210fe58273670925aef2278c5fc0d059e0
> # Parent 7a58a75274f8356ea503f207a321033023daf371
> largefiles: use duplicated 'match' object to modify it
> current implementation of 'lfiles_repo.status()' modifies '_files'
> field of specified 'match' object directory, but caller of
> 'repo.status()' does not provide against such cases.
> this patch uses duplicated 'match' object for safety.
> this patch also does "m._fmap = set(m._files)" to keep internal
> consistency in "match", even though this is required only in cases
> using "match.exact(f)".
> diff -r 7a58a75274f8 -r 5a568b210fe5 hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py Sat Feb 18 01:02:52 2012 +0900
> +++ b/hgext/largefiles/reposetup.py Sat Feb 18 01:02:52 2012 +0900
> @@ -172,8 +172,10 @@
> orig_ignore = lfdirstate._ignore
> lfdirstate._ignore = _ignoreoverride
> + match = copy.copy(match)
> match._files = [f for f in match._files if f in
> + match._fmap = set(match._files)
> # Don't waste time getting the ignored and unknown
> # files again; we already have them
> s = lfdirstate.status(match, , False,
I have to note that the fact that we have to do these sorts of
machinations repeatedly in largefiles smells like we're missing some
fundamental way to simplify the whole thing. One suspects that there's a
way to isolate all the knowledge of standins to a much smaller piece of
code so that things like the matcher never care. And if you get the
abstraction right, huge classes of bugs vanish.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel