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.
--- 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(
_(