comparison mercurial/exchange.py @ 43661:32048206e7be

merge with stable
author Yuya Nishihara <yuya@tcha.org>
date Fri, 15 Nov 2019 22:22:55 +0900
parents 4d8a4ecbb8b9 e513e87b0476
children 27c6d6f53d46
comparison
equal deleted inserted replaced
43660:303bf312d5ed 43661:32048206e7be
26 exchangev2, 26 exchangev2,
27 lock as lockmod, 27 lock as lockmod,
28 logexchange, 28 logexchange,
29 narrowspec, 29 narrowspec,
30 obsolete, 30 obsolete,
31 obsutil,
31 phases, 32 phases,
32 pushkey, 33 pushkey,
33 pycompat, 34 pycompat,
34 scmutil, 35 scmutil,
35 sslutil, 36 sslutil,
95 wirecompression = attr.ib() 96 wirecompression = attr.ib()
96 version = attr.ib() 97 version = attr.ib()
97 wireversion = attr.ib() 98 wireversion = attr.ib()
98 params = attr.ib() 99 params = attr.ib()
99 contentopts = attr.ib() 100 contentopts = attr.ib()
100
101
102 def _sortedmarkers(markers):
103 # last item of marker tuple ('parents') may be None or a tuple
104 return sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),))
105 101
106 102
107 def parsebundlespec(repo, spec, strict=True): 103 def parsebundlespec(repo, spec, strict=True):
108 """Parse a bundle string specification into parts. 104 """Parse a bundle string specification into parts.
109 105
1138 remoteversions = bundle2.obsmarkersversion(bundler.capabilities) 1134 remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
1139 if obsolete.commonversion(remoteversions) is None: 1135 if obsolete.commonversion(remoteversions) is None:
1140 return 1136 return
1141 pushop.stepsdone.add(b'obsmarkers') 1137 pushop.stepsdone.add(b'obsmarkers')
1142 if pushop.outobsmarkers: 1138 if pushop.outobsmarkers:
1143 markers = _sortedmarkers(pushop.outobsmarkers) 1139 markers = obsutil.sortedmarkers(pushop.outobsmarkers)
1144 bundle2.buildobsmarkerspart(bundler, markers) 1140 bundle2.buildobsmarkerspart(bundler, markers)
1145 1141
1146 1142
1147 @b2partsgenerator(b'bookmarks') 1143 @b2partsgenerator(b'bookmarks')
1148 def _pushb2bookmarks(pushop, bundler): 1144 def _pushb2bookmarks(pushop, bundler):
1473 remote = pushop.remote 1469 remote = pushop.remote
1474 pushop.stepsdone.add(b'obsmarkers') 1470 pushop.stepsdone.add(b'obsmarkers')
1475 if pushop.outobsmarkers: 1471 if pushop.outobsmarkers:
1476 pushop.ui.debug(b'try to push obsolete markers to remote\n') 1472 pushop.ui.debug(b'try to push obsolete markers to remote\n')
1477 rslts = [] 1473 rslts = []
1478 markers = _sortedmarkers(pushop.outobsmarkers) 1474 markers = obsutil.sortedmarkers(pushop.outobsmarkers)
1479 remotedata = obsolete._pushkeyescape(markers) 1475 remotedata = obsolete._pushkeyescape(markers)
1480 for key in sorted(remotedata, reverse=True): 1476 for key in sorted(remotedata, reverse=True):
1481 # reverse sort to ensure we end with dump0 1477 # reverse sort to ensure we end with dump0
1482 data = remotedata[key] 1478 data = remotedata[key]
1483 rslts.append(remote.pushkey(b'obsolete', key, b'', data)) 1479 rslts.append(remote.pushkey(b'obsolete', key, b'', data))
2571 if kwargs.get('obsmarkers', False): 2567 if kwargs.get('obsmarkers', False):
2572 if heads is None: 2568 if heads is None:
2573 heads = repo.heads() 2569 heads = repo.heads()
2574 subset = [c.node() for c in repo.set(b'::%ln', heads)] 2570 subset = [c.node() for c in repo.set(b'::%ln', heads)]
2575 markers = repo.obsstore.relevantmarkers(subset) 2571 markers = repo.obsstore.relevantmarkers(subset)
2576 markers = _sortedmarkers(markers) 2572 markers = obsutil.sortedmarkers(markers)
2577 bundle2.buildobsmarkerspart(bundler, markers) 2573 bundle2.buildobsmarkerspart(bundler, markers)
2578 2574
2579 2575
2580 @getbundle2partsgenerator(b'phases') 2576 @getbundle2partsgenerator(b'phases')
2581 def _getbundlephasespart( 2577 def _getbundlephasespart(