clfilter: introduce an `unfilteredmethod` decorator
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 26 Nov 2012 19:11:13 +0100
changeset 17994 8899bf48116a
parent 17993 1a6f8820eb71
child 17995 a5d85476da6e
clfilter: introduce an `unfilteredmethod` decorator This decorator ensure the method in run on an unfiltered version of the repository. See follow-up commit for details. This decorator is not named `unfiltered` because it would clash with the `unfilteredmethod` on `localrepo` itself.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Wed Nov 21 00:36:29 2012 +0100
+++ b/mercurial/localrepo.py	Mon Nov 26 19:11:13 2012 +0100
@@ -23,6 +23,12 @@
     def join(self, obj, fname):
         return obj.sjoin(fname)
 
+def unfilteredmeth(orig):
+    """decorate method that always need to be run on unfiltered version"""
+    def wrapper(repo, *args, **kwargs):
+        return orig(repo.unfiltered(), *args, **kwargs)
+    return wrapper
+
 MODERNCAPS = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle'))
 LEGACYCAPS = MODERNCAPS.union(set(['changegroupsubset']))