evolve: store the skippedrevs in evolvestate
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 30 Jan 2018 00:00:45 +0530
changeset 3495 a7cac3fcc49d
parent 3494 14cd04ff968e
child 3496 af2602c354d8
evolve: store the skippedrevs in evolvestate While doing `hg evolve`, there are some revs which are skipped as they can't be evolved. Before this patch, we did not store this information in evolvestate and neither they were evolved, so `hg evolve --continue` will again try to stabilize those revisions. As much time as we run `hg evolve --continue`, this will happen which is not a good behavior. This patch adds a skippedrevs list to evolvestate where we store such revisions so that we don't try to stabilize them again.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Mon Jan 29 00:09:44 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Jan 30 00:00:45 2018 +0530
@@ -1152,11 +1152,14 @@
             for rev in evolvestate['revs']:
                 # XXX: prevent this lookup by storing nodes instead of revnums
                 curctx = unfi[rev]
-                if curctx.node() not in evolvestate['replacements']:
+                if (curctx.node() not in evolvestate['replacements'] and
+                    curctx.node() not in evolvestate['skippedrevs']):
                     newnode = _solveone(ui, repo, curctx, evolvestate, False,
                                         confirm, progresscb, category)
                     if newnode[0]:
                         evolvestate['replacements'][curctx.node()] = newnode[1]
+                    else:
+                        evolvestate['skippedrevs'].append(curctx.node())
 
             _cleanup(ui, repo, unfi[startnode], True)
             evolvestate.delete()
@@ -1175,8 +1178,10 @@
     if targetcat == 'orphan':
         revs = _orderrevs(repo, revs)
 
+    # cbor does not know how to serialize sets, using list for skippedrevs
     stateopts = {'category': targetcat, 'replacements': {}, 'revs': revs,
-                 'confirm': confirmopt, 'startnode': startnode.node()}
+                 'confirm': confirmopt, 'startnode': startnode.node(),
+                 'skippedrevs': []}
     evolvestate.addopts(stateopts)
     for rev in revs:
         curctx = repo[rev]
@@ -1186,5 +1191,7 @@
         seen += 1
         if ret[0]:
             evolvestate['replacements'][curctx.node()] = [ret[1]]
+        else:
+            evolvestate['skippedrevs'].append(curctx.node())
     progresscb()
     _cleanup(ui, repo, startnode, showprogress)