Patchwork [1,of,3,main-line-of-work] transaction: always generate file on close

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 13, 2014, 5:04 p.m.
Message ID <d6bae78a0cd5293b9f66.1415898299@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6711/
State Accepted
Commit 59513ec767481e34f4effb05d4b883e34051d27b
Headers show

Comments

Pierre-Yves David - Nov. 13, 2014, 5:04 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1415874167 0
#      Thu Nov 13 10:22:47 2014 +0000
# Node ID d6bae78a0cd5293b9f666909ebac799fc84e43fd
# Parent  a196f9b8f58cf4a129c649fc2b498cb6c32904b0
transaction: always generate file on close

The conditionnal was buggy and file were only generated if "onclose" was
defined. By luck, "onclose" was always defined.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -327,16 +327,17 @@  class transaction(object):
         self._postclosecallback[category] = callback
 
     @active
     def close(self):
         '''commit the transaction'''
-        if self.count == 1 and self.onclose is not None:
+        if self.count == 1:
             self._generatefiles()
             categories = sorted(self._finalizecallback)
             for cat in categories:
                 self._finalizecallback[cat](self)
-            self.onclose()
+            if self.onclose is not None:
+                self.onclose()
 
         self.count -= 1
         if self.count != 0:
             return
         self.file.close()