##// END OF EJS Templates
transaction: move constant to upper case...
marmoute -
r44886:baf8c3f9 default
parent child Browse files
Show More
@@ -30,9 +30,9 b' version = 2'
30 # the changelog having been written).
30 # the changelog having been written).
31 postfinalizegenerators = {b'bookmarks', b'dirstate'}
31 postfinalizegenerators = {b'bookmarks', b'dirstate'}
32
32
33 gengroupall = b'all'
33 GEN_GROUP_ALL = b'all'
34 gengroupprefinalize = b'prefinalize'
34 GEN_GROUP_PRE_FINALIZE = b'prefinalize'
35 gengrouppostfinalize = b'postfinalize'
35 GEN_GROUP_POST_FINALIZE = b'postfinalize'
36
36
37
37
38 def active(func):
38 def active(func):
@@ -352,7 +352,7 b' class transaction(util.transactional):'
352 if genid in self._filegenerators:
352 if genid in self._filegenerators:
353 del self._filegenerators[genid]
353 del self._filegenerators[genid]
354
354
355 def _generatefiles(self, suffix=b'', group=gengroupall):
355 def _generatefiles(self, suffix=b'', group=GEN_GROUP_ALL):
356 # write files registered for generation
356 # write files registered for generation
357 any = False
357 any = False
358 for id, entry in sorted(pycompat.iteritems(self._filegenerators)):
358 for id, entry in sorted(pycompat.iteritems(self._filegenerators)):
@@ -360,9 +360,9 b' class transaction(util.transactional):'
360 order, filenames, genfunc, location = entry
360 order, filenames, genfunc, location = entry
361
361
362 # for generation at closing, check if it's before or after finalize
362 # for generation at closing, check if it's before or after finalize
363 postfinalize = group == gengrouppostfinalize
363 postfinalize = group == GEN_GROUP_POST_FINALIZE
364 if (
364 if (
365 group != gengroupall
365 group != GEN_GROUP_ALL
366 and (id in postfinalizegenerators) != postfinalize
366 and (id in postfinalizegenerators) != postfinalize
367 ):
367 ):
368 continue
368 continue
@@ -505,7 +505,7 b' class transaction(util.transactional):'
505 if self._count == 1:
505 if self._count == 1:
506 self._validator(self) # will raise exception if needed
506 self._validator(self) # will raise exception if needed
507 self._validator = None # Help prevent cycles.
507 self._validator = None # Help prevent cycles.
508 self._generatefiles(group=gengroupprefinalize)
508 self._generatefiles(group=GEN_GROUP_PRE_FINALIZE)
509 while self._finalizecallback:
509 while self._finalizecallback:
510 callbacks = self._finalizecallback
510 callbacks = self._finalizecallback
511 self._finalizecallback = {}
511 self._finalizecallback = {}
@@ -514,7 +514,7 b' class transaction(util.transactional):'
514 callbacks[cat](self)
514 callbacks[cat](self)
515 # Prevent double usage and help clear cycles.
515 # Prevent double usage and help clear cycles.
516 self._finalizecallback = None
516 self._finalizecallback = None
517 self._generatefiles(group=gengrouppostfinalize)
517 self._generatefiles(group=GEN_GROUP_POST_FINALIZE)
518
518
519 self._count -= 1
519 self._count -= 1
520 if self._count != 0:
520 if self._count != 0:
General Comments 0
You need to be logged in to leave comments. Login now