Submitter | Pierre-Yves David |
---|---|
Date | Dec. 17, 2014, 8:42 p.m. |
Message ID | <9ce12a1f60bd91ffba22.1418848937@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/7148/ |
State | Accepted |
Headers | show |
Comments
On Wed, Dec 17, 2014 at 9:42 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@fb.com> > # Date 1418847573 28800 > # Wed Dec 17 12:19:33 2014 -0800 > # Node ID 9ce12a1f60bd91ffba2270b347485c18795cceb0 > # Parent 6232babf277b57b826f337628e4372f9c45f2862 > largefile: explain why the monkey patching on repoview > > The comment requested for investigations, here they are. > > diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py > --- a/hgext/largefiles/overrides.py > +++ b/hgext/largefiles/overrides.py > @@ -1114,12 +1114,19 @@ def scmutiladdremove(orig, repo, matcher > return orig(repo, matcher, prefix, opts, dry_run, similarity) > > # Calling purge with --all will cause the largefiles to be deleted. > # Override repo.status to prevent this from happening. > def overridepurge(orig, ui, repo, *dirs, **opts): > - # XXX large file status is buggy when used on repo proxy. > - # XXX this needs to be investigate. > + # XXX Monkey patching a repoview will not work. The assigned attribut will > + # be set on the unfiltered repo, but we will only lookup attributs in the > + # unfiltered repo if the lookup in the repoview object itself fails. As the > + # monkey patched method exists on the repoview class the lookup will not > + # fail. As a result, the original version will shadow the monkey patched > + # one, defeating the monkey patch. > + # > + # As a work around we use an unfiltered repo here. We should do something > + # cleaner instead. > repo = repo.unfiltered() > oldstatus = repo.status > def overridestatus(node1='.', node2=None, match=None, ignored=False, > clean=False, unknown=False, listsubrepos=False): > r = oldstatus(node1, node2, match, ignored, clean, unknown, > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel There is a missing "e" in "attribut" and in "attributs". Cheers, Angel
Patch
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1114,12 +1114,19 @@ def scmutiladdremove(orig, repo, matcher return orig(repo, matcher, prefix, opts, dry_run, similarity) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. def overridepurge(orig, ui, repo, *dirs, **opts): - # XXX large file status is buggy when used on repo proxy. - # XXX this needs to be investigate. + # XXX Monkey patching a repoview will not work. The assigned attribut will + # be set on the unfiltered repo, but we will only lookup attributs in the + # unfiltered repo if the lookup in the repoview object itself fails. As the + # monkey patched method exists on the repoview class the lookup will not + # fail. As a result, the original version will shadow the monkey patched + # one, defeating the monkey patch. + # + # As a work around we use an unfiltered repo here. We should do something + # cleaner instead. repo = repo.unfiltered() oldstatus = repo.status def overridestatus(node1='.', node2=None, match=None, ignored=False, clean=False, unknown=False, listsubrepos=False): r = oldstatus(node1, node2, match, ignored, clean, unknown,