diff mercurial/localrepo.py @ 50267:f92afdf3cff9

transaction: remove the `branch` backup for transaction We can now back it up at the end of the transaction as we do for the rest of the dirstate.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Mar 2023 15:33:04 +0100
parents 240a04cedd24
children f34887316f1f
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Mar 02 11:54:29 2023 +0100
+++ b/mercurial/localrepo.py	Thu Mar 02 15:33:04 2023 +0100
@@ -2673,13 +2673,9 @@
         # strip" to pick a working copy destination on `hg rollback`
         if self.currentwlock() is not None:
             ds = self.dirstate
-            if ds.branch() == b'default':
+            if not self.vfs.exists(b'branch'):
                 # force a file to be written if None exist
                 ds.setbranch(b'default', None)
-            # we cannot simply add "branch" to `all_file_names` because branch
-            # is written outside of the transaction control. So we need to
-            # backup early.
-            tr.addbackup(b"branch", hardlink=True, location=b'plain')
 
             def backup_dirstate(tr):
                 for f in ds.all_file_names():