# HG changeset patch # User Matt Harbison # Date 1678209673 18000 # Node ID e384ae0ef6e83faabe578d03b7e68fba4463b505 # Parent 693b52957bfd8950d31eacb7abf3d9dee98c77e4 rewind: call dirstate.changing_parents() to silence ProgrammingError in hg 6.4 diff -r 693b52957bfd -r e384ae0ef6e8 hgext3rd/evolve/rewind.py --- 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