Mercurial > public > mercurial-scm > evolve
diff hgext/evolve.py @ 805:66c02a2e8e2f
prune: wrap mercurial internal to add parent information in prune marker
We store as a p1 (and p2) key in the extra dict for marker. This allow us to
record this information for future use without requiering a format change.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 13 Feb 2014 18:09:54 -0800 |
parents | 68e3d6e83ca5 |
children | 895fadf6ba3e |
line wrap: on
line diff
--- a/hgext/evolve.py Wed Feb 19 18:14:20 2014 -0800 +++ b/hgext/evolve.py Thu Feb 13 18:09:54 2014 -0800 @@ -301,6 +301,31 @@ reposetup = eh.final_reposetup ##################################################################### +### experimental behavior ### +##################################################################### + +@eh.wrapfunction(mercurial.obsolete, 'createmarkers') +def _createmarkers(orig, repo, relations, *args, **kwargs): + """register parent information at prune time""" + # every time this test is run, a kitten is slain. + # Change it as soon as possible + if '[,{metadata}]' in orig.__doc__: + for idx, rel in enumerate(relations): + prec = rel[0] + sucs = rel[1] + if not sucs: + meta = {} + if 2 < len(rel): + meta.update(rel[2]) + for i, p in enumerate(prec.parents(), 1): + meta['p%i' % i] = p.hex() + relations[idx] = (prec, sucs, meta) + return orig(repo, relations, *args, **kwargs) + +def createmarkers(*args, **kwargs): + return obsolete.createmarkers(*args, **kwargs) + +##################################################################### ### Critical fix ### ##################################################################### @@ -337,8 +362,6 @@ # - function to travel throught the obsolescence graph # - function to find useful changeset to stabilize -createmarkers = obsolete.createmarkers - ### Useful alias