comparison 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
comparison
equal deleted inserted replaced
804:68e3d6e83ca5 805:66c02a2e8e2f
299 uisetup = eh.final_uisetup 299 uisetup = eh.final_uisetup
300 extsetup = eh.final_extsetup 300 extsetup = eh.final_extsetup
301 reposetup = eh.final_reposetup 301 reposetup = eh.final_reposetup
302 302
303 ##################################################################### 303 #####################################################################
304 ### experimental behavior ###
305 #####################################################################
306
307 @eh.wrapfunction(mercurial.obsolete, 'createmarkers')
308 def _createmarkers(orig, repo, relations, *args, **kwargs):
309 """register parent information at prune time"""
310 # every time this test is run, a kitten is slain.
311 # Change it as soon as possible
312 if '[,{metadata}]' in orig.__doc__:
313 for idx, rel in enumerate(relations):
314 prec = rel[0]
315 sucs = rel[1]
316 if not sucs:
317 meta = {}
318 if 2 < len(rel):
319 meta.update(rel[2])
320 for i, p in enumerate(prec.parents(), 1):
321 meta['p%i' % i] = p.hex()
322 relations[idx] = (prec, sucs, meta)
323 return orig(repo, relations, *args, **kwargs)
324
325 def createmarkers(*args, **kwargs):
326 return obsolete.createmarkers(*args, **kwargs)
327
328 #####################################################################
304 ### Critical fix ### 329 ### Critical fix ###
305 ##################################################################### 330 #####################################################################
306 331
307 @eh.wrapfunction(mercurial.obsolete, '_readmarkers') 332 @eh.wrapfunction(mercurial.obsolete, '_readmarkers')
308 def safereadmarkers(orig, data): 333 def safereadmarkers(orig, data):
334 # - Function to create markers 359 # - Function to create markers
335 # - useful alias pstatus and pdiff (should probably go in evolve) 360 # - useful alias pstatus and pdiff (should probably go in evolve)
336 # - "troubles" method on changectx 361 # - "troubles" method on changectx
337 # - function to travel throught the obsolescence graph 362 # - function to travel throught the obsolescence graph
338 # - function to find useful changeset to stabilize 363 # - function to find useful changeset to stabilize
339
340 createmarkers = obsolete.createmarkers
341 364
342 365
343 ### Useful alias 366 ### Useful alias
344 367
345 @eh.uisetup 368 @eh.uisetup