comparison hgext/evolve.py @ 1301:896d66841f7f

evolve: stop conditional wrapping of _getbundleobsmarkerpart We support down to Mercurial 3.3, all such version have this function.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 29 Apr 2015 15:11:52 -0700
parents 4a27123e0696
children ebcf23fe3032
comparison
equal deleted inserted replaced
1300:4a27123e0696 1301:896d66841f7f
2749 common = boundaries['common'] 2749 common = boundaries['common']
2750 if common != [nullid]: 2750 if common != [nullid]:
2751 kwargs['evo_obscommon'] = common 2751 kwargs['evo_obscommon'] = common
2752 return ret 2752 return ret
2753 2753
2754 if getattr(exchange, '_getbundleobsmarkerpart', None) is not None: 2754 @eh.wrapfunction(exchange, '_getbundleobsmarkerpart')
2755 @eh.wrapfunction(exchange, '_getbundleobsmarkerpart') 2755 def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs):
2756 def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs): 2756 if 'evo_obscommon' not in kwargs:
2757 if 'evo_obscommon' not in kwargs: 2757 return orig(bundler, repo, source, **kwargs)
2758 return orig(bundler, repo, source, **kwargs) 2758
2759 2759 heads = kwargs.get('heads')
2760 heads = kwargs.get('heads') 2760 if kwargs.get('obsmarkers', False):
2761 if kwargs.get('obsmarkers', False): 2761 if heads is None:
2762 if heads is None: 2762 heads = repo.heads()
2763 heads = repo.heads() 2763 obscommon = kwargs.get('evo_obscommon', ())
2764 obscommon = kwargs.get('evo_obscommon', ()) 2764 assert obscommon
2765 assert obscommon 2765 obsset = repo.unfiltered().set('::%ln - ::%ln', heads, obscommon)
2766 obsset = repo.unfiltered().set('::%ln - ::%ln', heads, obscommon) 2766 subset = [c.node() for c in obsset]
2767 subset = [c.node() for c in obsset] 2767 markers = repo.obsstore.relevantmarkers(subset)
2768 markers = repo.obsstore.relevantmarkers(subset) 2768 exchange.buildobsmarkerspart(bundler, markers)
2769 exchange.buildobsmarkerspart(bundler, markers) 2769
2770 2770 @eh.uisetup
2771 @eh.uisetup 2771 def installgetbundlepartgen(ui):
2772 def installgetbundlepartgen(ui): 2772 origfunc = exchange.getbundle2partsmapping['obsmarkers']
2773 origfunc = exchange.getbundle2partsmapping['obsmarkers'] 2773 def newfunc(*args, **kwargs):
2774 def newfunc(*args, **kwargs): 2774 return _getbundleobsmarkerpart(origfunc, *args, **kwargs)
2775 return _getbundleobsmarkerpart(origfunc, *args, **kwargs) 2775 exchange.getbundle2partsmapping['obsmarkers'] = newfunc
2776 exchange.getbundle2partsmapping['obsmarkers'] = newfunc
2777
2778 2776
2779 @eh.wrapfunction(exchange, '_pullobsolete') 2777 @eh.wrapfunction(exchange, '_pullobsolete')
2780 def _pullobsolete(orig, pullop): 2778 def _pullobsolete(orig, pullop):
2781 if not obsolete.isenabled(pullop.repo, obsolete.exchangeopt): 2779 if not obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
2782 return None 2780 return None