# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1499096336 -7200 # Mon Jul 03 17:38:56 2017 +0200 # Node ID 098585d4fbc88dc54513e12fa306d0e52ea2b323 # Parent 817d5a7df52dff4584ac3d9e5eef17230d2b1ae8 # EXP-Topic obsfatetemplate template: better prune support in obsfate
successorssets don't returns good results for pruned commit, add a workaround for simple cases. A proper fix would require a large rework of successorssets algorithm, I will send a separate series for this refactoring. diff -r 817d5a7df52d -r 098585d4fbc8 mercurial/obsutil.py --- a/mercurial/obsutil.py Mon Jul 03 15:34:10 2017 +0200 +++ b/mercurial/obsutil.py Mon Jul 03 17:38:56 2017 +0200 @@ -636,8 +636,32 @@ ssets = successorssets(repo, ctx.node(), closest=True) + # closestsuccessors returns an empty list for pruned revisions, remap it + # into a list containing en empty list for future processing + if ssets == []: + ssets = [[]] + + # Try to recover pruned markers + succsmap = repo.obsstore.successors + fullsuccessorsets = [] # successor set + markers + for sset in ssets: + if sset: + fullsuccessorsets.append(sset) + else: + # XXX we do not catch all prune markers (eg rewritten then pruned) + # (fix me later) + foundany = False + for mark in succsmap.get(ctx.node(), ()): + if not mark[1]: + foundany = True + sset = _succs() + sset.markers.add(mark) + fullsuccessorsets.append(sset) + if not foundany: + fullsuccessorsets.append(_succs()) + values = [] - for sset in ssets: + for sset in fullsuccessorsets: raw = preparesuccessorset(sset, sset.markers) values.append(raw) diff -r 817d5a7df52d -r 098585d4fbc8 tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t Mon Jul 03 15:34:10 2017 +0200 +++ b/tests/test-obsmarker-template.t Mon Jul 03 17:38:56 2017 +0200 @@ -158,7 +158,7 @@ | @ a468dc9b3633 |/ Obsfate: rewritten as 4:d004c8f274b9 | x f137d23bb3e1 - | | + | | Obsfate: pruned | x 471f378eab4c |/ Obsfate: rewritten as 3:a468dc9b3633 o ea207398892e @@ -207,7 +207,7 @@ | x a468dc9b3633 |/ Obsfate: rewritten by test2 as 4:d004c8f274b9 (at 2001-04-19 04:25 +0000) | x f137d23bb3e1 - | | + | | Obsfate: pruned by test1 (at 2009-02-13 23:31 +0000) | x 471f378eab4c |/ Obsfate: rewritten by test1 as 3:a468dc9b3633 (at 2009-02-13 23:31 +0000) o ea207398892e @@ -1147,7 +1147,7 @@ o f897c6137566 | | @ 471f378eab4c - |/ + |/ Obsfate: pruned o ea207398892e @@ -1541,11 +1541,11 @@ $ hg fatelog @ 471f378eab4c - | + | Obsfate: pruned o ea207398892e $ hg fatelog -v @ 471f378eab4c - | + | Obsfate: pruned by test (at 1970-01-01 00:00 +0000) o ea207398892e _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel