comparison mercurial/transaction.py @ 44407:f6798c1a80fa

transaction: clarify the logic around pre-finalize/post-finalize I am taking a bit more verbose route, but I find it easier to follow for people who (re)discover the code. (This is a gratuitous cleanup I did while looking at something else.) Differential Revision: https://phab.mercurial-scm.org/D8176
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 28 Feb 2020 00:17:26 +0100
parents baf8c3f944eb
children 36f08ae87ef6
comparison
equal deleted inserted replaced
44406:baf8c3f944eb 44407:f6798c1a80fa
353 del self._filegenerators[genid] 353 del self._filegenerators[genid]
354 354
355 def _generatefiles(self, suffix=b'', group=GEN_GROUP_ALL): 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
359 if group == GEN_GROUP_ALL:
360 skip_post = skip_pre = False
361 else:
362 skip_pre = group == GEN_GROUP_POST_FINALIZE
363 skip_post = group == GEN_GROUP_PRE_FINALIZE
364
358 for id, entry in sorted(pycompat.iteritems(self._filegenerators)): 365 for id, entry in sorted(pycompat.iteritems(self._filegenerators)):
359 any = True 366 any = True
360 order, filenames, genfunc, location = entry 367 order, filenames, genfunc, location = entry
361 368
362 # for generation at closing, check if it's before or after finalize 369 # for generation at closing, check if it's before or after finalize
363 postfinalize = group == GEN_GROUP_POST_FINALIZE 370 is_post = id in postfinalizegenerators
364 if ( 371 if skip_post and is_post:
365 group != GEN_GROUP_ALL 372 continue
366 and (id in postfinalizegenerators) != postfinalize 373 elif skip_pre and not is_post:
367 ):
368 continue 374 continue
369 375
370 vfs = self._vfsmap[location] 376 vfs = self._vfsmap[location]
371 files = [] 377 files = []
372 try: 378 try: