Mercurial > hg-stable
changeset 44056:8e09551206f5
transaction: add a `hasfinalize` method
The method allow code to check if an existing callback exists. It allow them to
skip potentially expensive setup for a callback.
Differential Revision: https://phab.mercurial-scm.org/D7832
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 11 Jan 2020 05:44:58 +0100 |
parents | 7f67f53492f7 |
children | 7dddc2251365 |
files | mercurial/transaction.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/transaction.py Sat Jan 11 04:57:29 2020 +0100 +++ b/mercurial/transaction.py Sat Jan 11 05:44:58 2020 +0100 @@ -456,6 +456,12 @@ return self._anypending @active + def hasfinalize(self, category): + """check is a callback already exist for a category + """ + return category in self._finalizecallback + + @active def addfinalize(self, category, callback): """add a callback to be called when the transaction is closed