Mercurial > public > mercurial-scm > hg
diff mercurial/localrepo.py @ 29373:36fbd72c2f39
scmutil: allow access to filecache descriptor on class
To make it easier to patch the wrapped function, make it possible to access the
filecache descriptor directly on the class (rather than have to use
ClassObject.__dict__['attributename']). Returning `self` when the first
argument to `__get__` is `None` makes the descriptor behave the same way
`property` objects do.
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Fri, 17 Jun 2016 20:06:09 +0100 |
parents | 37c7f9fb7040 |
children | 526b027b0130 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Jun 17 16:59:08 2016 +0100 +++ b/mercurial/localrepo.py Fri Jun 17 20:06:09 2016 +0100 @@ -66,6 +66,8 @@ """ def __get__(self, repo, type=None): + if repo is None: + return self return super(repofilecache, self).__get__(repo.unfiltered(), type) def __set__(self, repo, value): return super(repofilecache, self).__set__(repo.unfiltered(), value)