Mercurial > evolve
changeset 6445:b27523cb3ffb stable
prune: call dirstate.changing_parents() to silence ProgrammingError in hg 6.4
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 07 Mar 2023 12:24:33 -0500 |
parents | e384ae0ef6e8 |
children | 88c701539ed4 |
files | hgext3rd/evolve/cmdrewrite.py |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)