fold: actually track folds using fold-* metadata in obsmarkers
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 11 Jan 2020 19:52:56 +0700
changeset 5113 a66c9fc9c503
parent 5112 51e38bf936cf
child 5114 08112f100d70
fold: actually track folds using fold-* metadata in obsmarkers
hgext3rd/evolve/cmdrewrite.py
tests/test-evolve.t
tests/test-fold.t
--- a/hgext3rd/evolve/cmdrewrite.py	Sun Feb 02 15:51:10 2020 +0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Sat Jan 11 19:52:56 2020 +0700
@@ -801,9 +801,15 @@
                                                          p2.node()],
                                                         commitopts=commitopts)
             phases.retractboundary(repo, tr, targetphase, [newid])
-            replacements = {ctx.node(): [newid] for ctx in allctx}
-            scmutil.cleanupnodes(repo, replacements, operation=b"fold",
-                                 metadata=metadata)
+            if 'repls' in scmutil.cleanupnodes.__code__.co_varnames:
+                replacements = {tuple(ctx.node() for ctx in allctx): [newid]}
+                scmutil.cleanupnodes(repo, replacements, operation=b"fold",
+                                     metadata=metadata)
+            else:
+                # hg <= 4.7 (b99903534e06)
+                replacements = {ctx.node(): [newid] for ctx in allctx}
+                scmutil.cleanupnodes(repo, replacements, operation=b"fold",
+                                     metadata=metadata)
             tr.close()
         finally:
             tr.release()
--- a/tests/test-evolve.t	Sun Feb 02 15:51:10 2020 +0700
+++ b/tests/test-evolve.t	Sat Jan 11 19:52:56 2020 +0700
@@ -781,19 +781,22 @@
       more than 2 successors:         0
       available  keys:
                   ef1:               10
+              fold-id:                5
+             fold-idx:                5
+            fold-size:                5
             operation:               10
                  user:               10
   marker size:
       format v1:
           smallest length:           90
-          longer length:             92
-          median length:             91
-          mean length:               90
+          longer length:            131
+          median length:            130
+          mean length:              110
       format v0:
-          smallest length:           * (glob)
-          longer length:             * (glob)
-          median length:             * (glob)
-          mean length:               * (glob)
+          smallest length:          * (glob)
+          longer length:            * (glob)
+          median length:            * (glob)
+          mean length:              * (glob)
   disconnected clusters:              1
           any known node:             1
           smallest length:           10
--- a/tests/test-fold.t	Sun Feb 02 15:51:10 2020 +0700
+++ b/tests/test-fold.t	Sat Jan 11 19:52:56 2020 +0700
@@ -95,6 +95,10 @@
   $ hg fold --from -r 'desc("r5")'
   3 changesets folded
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg debugobsolete -r 'desc("r5")' --exclusive
+  4de32a90b66cd083ebf3c00b41277aa7abca51dd 198b5c405d01a50c41a81a00fc61677b81981a5f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '37', 'fold-id': '25cb328e', 'fold-idx': '3', 'fold-size': '3', 'operation': 'fold', 'user': 'test'}
+  c8d03c1b5e94af74b772900c58259d2e08917735 198b5c405d01a50c41a81a00fc61677b81981a5f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '33', 'fold-id': '25cb328e', 'fold-idx': '1', 'fold-size': '3', 'operation': 'fold', 'user': 'test'}
+  f69452c5b1af6cbaaa56ef50cf94fff5bcc6ca23 198b5c405d01a50c41a81a00fc61677b81981a5f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '37', 'fold-id': '25cb328e', 'fold-idx': '2', 'fold-size': '3', 'operation': 'fold', 'user': 'test'}
 
 Checking whether the bookmarks are moved or not