Mercurial > public > mercurial-scm > hg
diff mercurial/obsutil.py @ 33996:98fa777cd7a1
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.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 03 Jul 2017 17:38:56 +0200 |
parents | c35c0f54f420 |
children | 7cdc8c5a481a |
line wrap: on
line diff
--- a/mercurial/obsutil.py Mon Jul 03 15:34:10 2017 +0200 +++ b/mercurial/obsutil.py Mon Jul 03 17:38:56 2017 +0200 @@ -585,8 +585,40 @@ ssets = successorssets(repo, ctx.node(), closest=True) + # closestsuccessors returns an empty list for pruned revisions, remap it + # into a list containing an 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: + # successorsset return an empty set() when ctx or one of its + # successors is pruned. + # In this case, walk the obs-markers tree again starting with ctx + # and find the relevant pruning obs-makers, the ones without + # successors. + # Having these markers allow us to compute some information about + # its fate, like who pruned this changeset and when. + + # 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: values.append({'successors': sset, 'markers': sset.markers}) return values