comparison mercurial/exchange.py @ 43168:01e8eefd9434

py3: fix sorting of obsolete markers when building bundle Last item of marker tuple (parents) is either None or tuple. Comparison thus fails on Python 3 with: TypeError: '<' not supported between instances of 'tuple' and 'NoneType' Fixing this by coercing None to the empty tuple when sorting markers in exchange._getbundleobsmarkerpart().
author Denis Laxalde <denis@laxalde.org>
date Thu, 10 Oct 2019 20:27:34 +0200
parents c17a63eb5d4c
children 48b9fbfb00b9
comparison
equal deleted inserted replaced
43167:bca9d1a6c4c5 43168:01e8eefd9434
2565 if kwargs.get(r'obsmarkers', False): 2565 if kwargs.get(r'obsmarkers', False):
2566 if heads is None: 2566 if heads is None:
2567 heads = repo.heads() 2567 heads = repo.heads()
2568 subset = [c.node() for c in repo.set(b'::%ln', heads)] 2568 subset = [c.node() for c in repo.set(b'::%ln', heads)]
2569 markers = repo.obsstore.relevantmarkers(subset) 2569 markers = repo.obsstore.relevantmarkers(subset)
2570 markers = sorted(markers) 2570 # last item of marker tuple ('parents') may be None or a tuple
2571 markers = sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),))
2571 bundle2.buildobsmarkerspart(bundler, markers) 2572 bundle2.buildobsmarkerspart(bundler, markers)
2572 2573
2573 2574
2574 @getbundle2partsgenerator(b'phases') 2575 @getbundle2partsgenerator(b'phases')
2575 def _getbundlephasespart( 2576 def _getbundlephasespart(