changeset 39695:ebbba3ba3f66

transaction: make validator a private attribute This is similar to releasefn. It holds state that doesn't need to be exposed as part of the public interface. Differential Revision: https://phab.mercurial-scm.org/D4627
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 17 Sep 2018 16:01:22 -0700
parents 040007cd3d81
children 264d56954dda
files mercurial/transaction.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Mon Sep 17 16:00:09 2018 -0700
+++ b/mercurial/transaction.py	Mon Sep 17 16:01:22 2018 -0700
@@ -139,7 +139,7 @@
         # target user is repository hooks.
         if validator is None:
             validator = lambda tr: None
-        self.validator = validator
+        self._validator = validator
         # A callback to do something just after releasing transaction.
         if releasefn is None:
             releasefn = lambda tr, success: None
@@ -455,8 +455,8 @@
     def close(self):
         '''commit the transaction'''
         if self._count == 1:
-            self.validator(self)  # will raise exception if needed
-            self.validator = None # Help prevent cycles.
+            self._validator(self)  # will raise exception if needed
+            self._validator = None # Help prevent cycles.
             self._generatefiles(group=gengroupprefinalize)
             categories = sorted(self._finalizecallback)
             for cat in categories: