changeset 50264:921f4834b7b5

branch: pass current transaction when writing branch in shelve
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Mar 2023 14:46:51 +0100
parents 798e4314ddd9
children 240a04cedd24
files mercurial/shelve.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Thu Mar 02 14:45:39 2023 +0100
+++ b/mercurial/shelve.py	Thu Mar 02 14:46:51 2023 +0100
@@ -453,7 +453,7 @@
     # transaction to do so.
     assert repo.currenttransaction() is None
     repo.dirstate.write(None)
-    ds.setbranch(current_branch)
+    ds.setbranch(current_branch, None)
 
 
 def getshelvename(repo, parent, opts):
@@ -631,7 +631,9 @@
         if _iswctxonnewbranch(repo) and not _isbareshelve(pats, opts):
             # In non-bare shelve we don't store newly created branch
             # at bundled commit
-            repo.dirstate.setbranch(repo[b'.'].branch())
+            repo.dirstate.setbranch(
+                repo[b'.'].branch(), repo.currenttransaction()
+            )
 
         commitfunc = getcommitfunc(extra, interactive, editor=True)
         if not interactive:
@@ -665,7 +667,7 @@
                 ms.reset()
 
         if origbranch != repo[b'.'].branch() and not _isbareshelve(pats, opts):
-            repo.dirstate.setbranch(origbranch)
+            repo.dirstate.setbranch(origbranch, repo.currenttransaction())
 
         _finishshelve(repo, tr)
     finally:
@@ -849,7 +851,7 @@
 
 def restorebranch(ui, repo, branchtorestore):
     if branchtorestore and branchtorestore != repo.dirstate.branch():
-        repo.dirstate.setbranch(branchtorestore)
+        repo.dirstate.setbranch(branchtorestore, repo.currenttransaction())
         ui.status(
             _(b'marked working directory as branch %s\n') % branchtorestore
         )