changeset 50111:0ca8dc8a135f

mq: wrap the dirstate's rebuild in a `changing_parents` context This code is dealing with `qreshesh` failure. In that case the working copy will be left on the parent of the refreshed patch, so the parents are changing and `changing_parents` make sens.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 19 Feb 2023 02:47:28 +0100
parents a860298776f0
children 62158471d038
files hgext/mq.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Feb 20 11:37:05 2023 +0100
+++ b/hgext/mq.py	Sun Feb 19 02:47:28 2023 +0100
@@ -2121,9 +2121,9 @@
                 finally:
                     lockmod.release(tr, lock)
             except:  # re-raises
-                ctx = repo[cparents[0]]
-                repo.dirstate.rebuild(ctx.node(), ctx.manifest())
-                repo.dirstate.write(repo.currenttransaction())
+                with repo.dirstate.changing_parents(repo):
+                    ctx = repo[cparents[0]]
+                    repo.dirstate.rebuild(ctx.node(), ctx.manifest())
                 self.savedirty()
                 self.ui.warn(
                     _(