# HG changeset patch # User Anton Shestakov # Date 1578747191 -25200 # Node ID 08112f100d7008e9d760bde7dbc43a573ccea59a # Parent a66c9fc9c503c972e064fe1129a8f17696626b7f metaedit: actually track folds using fold-* metadata in obsmarkers diff -r a66c9fc9c503 -r 08112f100d70 hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Sat Jan 11 19:52:56 2020 +0700 +++ b/hgext3rd/evolve/cmdrewrite.py Sat Jan 11 19:53:11 2020 +0700 @@ -936,9 +936,13 @@ metadata[b'note'] = opts['note'] phases.retractboundary(repo, tr, targetphase, [newid]) - obsolete.createmarkers(repo, [(ctx, (repo[newid],)) - for ctx in allctx], - metadata=metadata, operation=b"metaedit") + if 'predecessors' in obsolete.createmarkers.__code__.co_varnames: + obsolete.createmarkers(repo, [(tuple(allctx), (repo[newid],))], + metadata=metadata, operation=b"metaedit") + else: + # hg <= 4.7 (6335c0de80fa) + obsolete.createmarkers(repo, [(ctx, (repo[newid],)) for ctx in allctx], + metadata=metadata, operation=b"metaedit") else: ui.status(_(b"nothing changed\n")) tr.close() diff -r a66c9fc9c503 -r 08112f100d70 tests/test-metaedit.t --- a/tests/test-metaedit.t Sat Jan 11 19:52:56 2020 +0700 +++ b/tests/test-metaedit.t Sat Jan 11 19:53:11 2020 +0700 @@ -146,6 +146,9 @@ x 587528abfffe (7) F rewritten(user) as 212b2a2b87cd using metaedit by test (Thu Jan 01 00:00:00 1970 +0000) + $ hg debugobsolete --rev . --exclusive + 212b2a2b87cdbae992f001e9baba64db389fbce7 a08d35fd7d9d0f8cb33d5bd2074e9bafb5cbc70f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '29', 'fold-id': 'c5832a81', 'fold-idx': '2', 'fold-size': '2', 'note': 'folding changesets using metaedit', 'operation': 'metaedit', 'user': 'test'} + c2bd843aa2468b30bb56d69d4f5fef95b85986f2 a08d35fd7d9d0f8cb33d5bd2074e9bafb5cbc70f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'fold-id': 'c5832a81', 'fold-idx': '1', 'fold-size': '2', 'note': 'folding changesets using metaedit', 'operation': 'metaedit', 'user': 'test'} no new commit is created here because the date is the same $ HGEDITOR=cat hg metaedit @@ -205,6 +208,8 @@ 1 changesets folded $ hg log -r "tip" --template '{rev}: {author}\n' 12: foobar3 + $ hg debugobsolete --rev 'tip' --exclusive + f3d001339afd30d27fcd91e713274a78233528c8 07a6525ddaf5de1ab33352806abb5724a0954f3f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '16', 'operation': 'metaedit', 'user': 'foobar3'} working on merge commits too