diff mercurial/transaction.py @ 33056:2312e70cf78b

rebase: clean up rebasestate from active transaction Previously, rebase assumes the following pattern: rebase: with transaction as tr: # top-level ... tr.__close__ writes rebasestate unlink('rebasestate') However it's possible that "rebase" was called inside a transaction: with transaction as tr1: rebase: with transaction as tr2: # not top-level ... tr2.__close__ does not write rebasestate unlink('rebasestate') tr1.__close__ writes rebasestate That leaves a rebasestate on disk incorrectly. This patch adds "removefilegenerator" to notify transaction code that the state file is no longer needed therefore fixes the issue.
author Jun Wu <quark@fb.com>
date Sat, 24 Jun 2017 21:13:48 -0700
parents aa91085cadf3
children fcd1c483f5ea
line wrap: on
line diff
--- a/mercurial/transaction.py	Sat Jun 24 21:01:28 2017 -0700
+++ b/mercurial/transaction.py	Sat Jun 24 21:13:48 2017 -0700
@@ -292,6 +292,12 @@
         # but for bookmarks that are handled outside this mechanism.
         self._filegenerators[genid] = (order, filenames, genfunc, location)
 
+    @active
+    def removefilegenerator(self, genid):
+        """reverse of addfilegenerator, remove a file generator function"""
+        if genid in self._filegenerators:
+            del self._filegenerators[genid]
+
     def _generatefiles(self, suffix='', group=gengroupall):
         # write files registered for generation
         any = False