[PATCH 2 of 2 V2] rebase: update _rebaseset inside transaction

Durham Goode durham at fb.com
Thu Nov 10 12:27:55 EST 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1478798531 28800
#      Thu Nov 10 09:22:11 2016 -0800
# Node ID 839aa67de1a6436dfc1ae29265d0bfb0c1ce3cb7
# Parent  03bc2afdfa26ad5ab057a28ac037524407ca5a92
rebase: update _rebaseset inside transaction

Rebase has the concept of the _rebaseset, which is used to prevent the commits
being rebased from being hidden until after the rebase is complete. Previously,
the _rebaseset was being cleared at the very end of rebase, after the last
transaction had already closed. This meant that the repo filteredrevs cache was
not updated (since no invalidation had been triggered, since we're outside of a
transaction), which meant future changelog reads saw commits as visible that
should've been hidden.

This patch moves the _rebaseset clearing to be inside the last rebase
transaction, so that after the transaction the filteredrevs is appropriately
invalidated and will be up-to-date on the next read.

This showed up in an extension that combines rebase, obsolete, and inhibit, so
I'm not sure how to create a test case in hg core to repro it. But we have a
test case in the extension repo.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -496,7 +496,12 @@ class rebaseruntime(object):
                 collapsedas = newnode
             clearrebased(ui, repo, self.state, self.skipped, collapsedas)
 
-        clearstatus(repo)
+        # Put clearstatus in a transaction since it affects commit visibility
+        # and extensions depend on transaction close hooks for watching
+        # visibility updates.
+        with repo.transaction('rebasestatus') as tr:
+            clearstatus(repo)
+
         clearcollapsemsg(repo)
 
         ui.note(_("rebase completed\n"))


More information about the Mercurial-devel mailing list