D8175: transaction: move constant to upper case
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Fri Feb 28 12:05:37 UTC 2020
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
These constant are internal to the module and can be safely renamed. Having them
upper case help to clarify their "constant" status.
(This is a gratuitous cleanup I did while looking at something else.)
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D8175
AFFECTED FILES
mercurial/transaction.py
CHANGE DETAILS
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -30,9 +30,9 @@
# the changelog having been written).
postfinalizegenerators = {b'bookmarks', b'dirstate'}
-gengroupall = b'all'
-gengroupprefinalize = b'prefinalize'
-gengrouppostfinalize = b'postfinalize'
+GEN_GROUP_ALL = b'all'
+GEN_GROUP_PRE_FINALIZE = b'prefinalize'
+GEN_GROUP_POST_FINALIZE = b'postfinalize'
def active(func):
@@ -352,7 +352,7 @@
if genid in self._filegenerators:
del self._filegenerators[genid]
- def _generatefiles(self, suffix=b'', group=gengroupall):
+ def _generatefiles(self, suffix=b'', group=GEN_GROUP_ALL):
# write files registered for generation
any = False
for id, entry in sorted(pycompat.iteritems(self._filegenerators)):
@@ -360,9 +360,9 @@
order, filenames, genfunc, location = entry
# for generation at closing, check if it's before or after finalize
- postfinalize = group == gengrouppostfinalize
+ postfinalize = group == GEN_GROUP_POST_FINALIZE
if (
- group != gengroupall
+ group != GEN_GROUP_ALL
and (id in postfinalizegenerators) != postfinalize
):
continue
@@ -505,7 +505,7 @@
if self._count == 1:
self._validator(self) # will raise exception if needed
self._validator = None # Help prevent cycles.
- self._generatefiles(group=gengroupprefinalize)
+ self._generatefiles(group=GEN_GROUP_PRE_FINALIZE)
while self._finalizecallback:
callbacks = self._finalizecallback
self._finalizecallback = {}
@@ -514,7 +514,7 @@
callbacks[cat](self)
# Prevent double usage and help clear cycles.
self._finalizecallback = None
- self._generatefiles(group=gengrouppostfinalize)
+ self._generatefiles(group=GEN_GROUP_POST_FINALIZE)
self._count -= 1
if self._count != 0:
To: marmoute, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list