Patchwork D8176: transaction: clarify the logic around pre-finalize/post-finalize

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2020, 7:14 p.m.
Message ID <45d201b160444bf887e75b446b6f2e37@localhost.localdomain>
Download mbox | patch
Permalink /patch/45405/
State Not Applicable
Headers show

Comments

phabricator - Feb. 28, 2020, 7:14 p.m.
Closed by commit rHGf6798c1a80fa: transaction: clarify the logic around pre-finalize/post-finalize (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8176?vs=20370&id=20399

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8176/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8176

AFFECTED FILES
  mercurial/transaction.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -355,16 +355,22 @@ 
     def _generatefiles(self, suffix=b'', group=GEN_GROUP_ALL):
         # write files registered for generation
         any = False
+
+        if group == GEN_GROUP_ALL:
+            skip_post = skip_pre = False
+        else:
+            skip_pre = group == GEN_GROUP_POST_FINALIZE
+            skip_post = group == GEN_GROUP_PRE_FINALIZE
+
         for id, entry in sorted(pycompat.iteritems(self._filegenerators)):
             any = True
             order, filenames, genfunc, location = entry
 
             # for generation at closing, check if it's before or after finalize
-            postfinalize = group == GEN_GROUP_POST_FINALIZE
-            if (
-                group != GEN_GROUP_ALL
-                and (id in postfinalizegenerators) != postfinalize
-            ):
+            is_post = id in postfinalizegenerators
+            if skip_post and is_post:
+                continue
+            elif skip_pre and not is_post:
                 continue
 
             vfs = self._vfsmap[location]