# HG changeset patch # User Matt Harbison # Date 1678209873 18000 # Node ID b27523cb3ffbfcbc925cb99fdfdcf6349cadccc9 # Parent e384ae0ef6e83faabe578d03b7e68fba4463b505 prune: call dirstate.changing_parents() to silence ProgrammingError in hg 6.4 diff -r e384ae0ef6e8 -r b27523cb3ffb hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Tue Mar 07 12:21:13 2023 -0500 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 07 12:24:33 2023 -0500 @@ -1007,13 +1007,23 @@ # changed changedfiles.extend(repo[rev].files()) + need_write = True + if util.safehasattr(repo.dirstate, 'changing_parents'): + changing_parents = repo.dirstate.changing_parents(repo) + else: + # hg <= 6.3 (7a8bfc05b691) + need_write = False + 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(newnode.node(), newnode.manifest(), - changedfiles) - dirstate.write(tr) + with changing_parents: + repo.dirstate.rebuild(newnode.node(), newnode.manifest(), + changedfiles) + if need_write: + dirstate.write(tr) else: bookactive = repo._activebookmark # Active bookmark that we don't want to delete (with -B option)