changeset 6444:e384ae0ef6e8 stable

rewind: call dirstate.changing_parents() to silence ProgrammingError in hg 6.4
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 07 Mar 2023 12:21:13 -0500
parents 693b52957bfd
children b27523cb3ffb
files hgext3rd/evolve/rewind.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/rewind.py	Sun Feb 26 23:13:04 2023 +0400
+++ b/hgext3rd/evolve/rewind.py	Tue Mar 07 12:21:13 2023 -0500
@@ -159,12 +159,19 @@
                         # changed
                         changedfiles.extend(ctx.files())
 
+                    if util.safehasattr(repo.dirstate, 'changing_parents'):
+                        changing_parents = repo.dirstate.changing_parents(repo)
+                    else:
+                        # hg <= 6.3 (7a8bfc05b691)
+                        changing_parents = util.nullcontextmanager()
+
                     # reset files that only changed in the dirstate too
                     dirstate = repo.dirstate
                     dirchanges = compat.dirchanges(dirstate)
                     changedfiles.extend(dirchanges)
-                    repo.dirstate.rebuild(newctx.node(), newctx.manifest(),
-                                          changedfiles)
+                    with changing_parents:
+                        repo.dirstate.rebuild(newctx.node(), newctx.manifest(),
+                                              changedfiles)
 
                     # TODO: implement restoration of copies/renames
                     # Ideally this step should be handled by dirstate.rebuild