D1337: util: add util.clearcachedproperty

mbthomas (Mark Thomas) phabricator at mercurial-scm.org
Fri Nov 10 18:04:02 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbe6aa0cff8ea: util: add util.clearcachedproperty (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1337?vs=3337&id=3411

REVISION DETAIL
  https://phab.mercurial-scm.org/D1337

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -931,6 +931,11 @@
         # __dict__ assignment required to bypass __setattr__ (eg: repoview)
         obj.__dict__[self.name] = value
 
+def clearcachedproperty(obj, prop):
+    '''clear a cached property value, if one has been set'''
+    if prop in obj.__dict__:
+        del obj.__dict__[prop]
+
 def pipefilter(s, cmd):
     '''filter string S through command CMD, returning its output'''
     p = subprocess.Popen(cmd, shell=True, close_fds=closefds,



To: mbthomas, #hg-reviewers, indygreg, durin42
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list