changeset 6046:a49a90a5fa5b

compat: make prune and rewind use the new dirstate.get_entry()
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 08 Oct 2021 14:03:33 +0300
parents 2da56c12e70f
children 6d29d97f4853
files hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/rewind.py
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Oct 05 09:30:02 2021 +0300
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Oct 08 14:03:33 2021 +0300
@@ -1011,7 +1011,7 @@
 
                 # reset files that only changed in the dirstate too
                 dirstate = repo.dirstate
-                dirchanges = [f for f in dirstate if dirstate[f] != b'n']
+                dirchanges = compat.dirchanges(dirstate)
                 changedfiles.extend(dirchanges)
                 repo.dirstate.rebuild(newnode.node(), newnode.manifest(),
                                       changedfiles)
--- a/hgext3rd/evolve/compat.py	Tue Oct 05 09:30:02 2021 +0300
+++ b/hgext3rd/evolve/compat.py	Fri Oct 08 14:03:33 2021 +0300
@@ -554,3 +554,13 @@
         }
 
     context.overlayworkingctx._markdirty = fixedmarkdirty
+
+if util.safehasattr(dirstate.dirstate, 'get_entry'):
+    def dirchanges(dirstate):
+        return [
+            f for f in dirstate if not dirstate.get_entry(f).maybe_clean
+        ]
+else:
+    # hg <= 5.9 (dcd97b082b3b)
+    def dirchanges(dirstate):
+        return [f for f in dirstate if dirstate[f] != b'n']
--- a/hgext3rd/evolve/rewind.py	Tue Oct 05 09:30:02 2021 +0300
+++ b/hgext3rd/evolve/rewind.py	Fri Oct 08 14:03:33 2021 +0300
@@ -163,7 +163,7 @@
 
                     # reset files that only changed in the dirstate too
                     dirstate = repo.dirstate
-                    dirchanges = [f for f in dirstate if dirstate[f] != 'n']
+                    dirchanges = compat.dirchanges(dirstate)
                     changedfiles.extend(dirchanges)
                     repo.dirstate.rebuild(newctx.node(), newctx.manifest(),
                                           changedfiles)