[PATCH 2 of 3] largefile: explain why the monkey patching on repoview

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 17 14:42:17 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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,


More information about the Mercurial-devel mailing list