##// END OF EJS Templates
changegroup: pass ellipsis roots into cgpacker constructor...
Gregory Szorc -
r38943:ad4c4cc9 default
parent child Browse files
Show More
@@ -522,7 +522,8 b' class revisiondelta(object):'
522 522 class cgpacker(object):
523 523 def __init__(self, repo, filematcher, version, allowreorder,
524 524 useprevdelta, builddeltaheader, manifestsend,
525 sendtreemanifests, bundlecaps=None, shallow=False):
525 sendtreemanifests, bundlecaps=None, shallow=False,
526 ellipsisroots=None):
526 527 """Given a source repo, construct a bundler.
527 528
528 529 filematcher is a matcher that matches on files to include in the
@@ -565,6 +566,9 b' class cgpacker(object):'
565 566 self._bundlecaps = bundlecaps
566 567 self._isshallow = shallow
567 568
569 # Maps ellipsis revs to their roots at the changelog level.
570 self._precomputedellipsis = ellipsisroots
571
568 572 # experimental config: bundle.reorder
569 573 reorder = repo.ui.config('bundle', 'reorder')
570 574 if reorder == 'auto':
@@ -740,7 +744,7 b' class cgpacker(object):'
740 744 # we skip some manifest nodes that we should otherwise
741 745 # have sent.
742 746 if (x in self._full_nodes
743 or cl.rev(x) in self._precomputed_ellipsis):
747 or cl.rev(x) in self._precomputedellipsis):
744 748 n = c[0]
745 749 # Record the first changeset introducing this manifest
746 750 # version.
@@ -1086,10 +1090,10 b' class cgpacker(object):'
1086 1090
1087 1091 # At this point, a node can either be one we should skip or an
1088 1092 # ellipsis. If it's not an ellipsis, bail immediately.
1089 if linkrev not in self._precomputed_ellipsis:
1093 if linkrev not in self._precomputedellipsis:
1090 1094 return
1091 1095
1092 linkparents = self._precomputed_ellipsis[linkrev]
1096 linkparents = self._precomputedellipsis[linkrev]
1093 1097 def local(clrev):
1094 1098 """Turn a changelog revnum into a local revnum.
1095 1099
@@ -1133,8 +1137,8 b' class cgpacker(object):'
1133 1137 elif p in self._full_nodes:
1134 1138 walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
1135 1139 if pp != nullrev])
1136 elif p in self._precomputed_ellipsis:
1137 walk.extend([pp for pp in self._precomputed_ellipsis[p]
1140 elif p in self._precomputedellipsis:
1141 walk.extend([pp for pp in self._precomputedellipsis[p]
1138 1142 if pp != nullrev])
1139 1143 else:
1140 1144 # In this case, we've got an ellipsis with parents
@@ -1188,7 +1192,8 b' class cgpacker(object):'
1188 1192 deltachunks=(diffheader, data),
1189 1193 )
1190 1194
1191 def _makecg1packer(repo, filematcher, bundlecaps, shallow=False):
1195 def _makecg1packer(repo, filematcher, bundlecaps, shallow=False,
1196 ellipsisroots=None):
1192 1197 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
1193 1198 d.node, d.p1node, d.p2node, d.linknode)
1194 1199
@@ -1199,9 +1204,11 b' def _makecg1packer(repo, filematcher, bu'
1199 1204 manifestsend=b'',
1200 1205 sendtreemanifests=False,
1201 1206 bundlecaps=bundlecaps,
1202 shallow=shallow)
1207 shallow=shallow,
1208 ellipsisroots=ellipsisroots)
1203 1209
1204 def _makecg2packer(repo, filematcher, bundlecaps, shallow=False):
1210 def _makecg2packer(repo, filematcher, bundlecaps, shallow=False,
1211 ellipsisroots=None):
1205 1212 builddeltaheader = lambda d: _CHANGEGROUPV2_DELTA_HEADER.pack(
1206 1213 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
1207 1214
@@ -1215,9 +1222,11 b' def _makecg2packer(repo, filematcher, bu'
1215 1222 manifestsend=b'',
1216 1223 sendtreemanifests=False,
1217 1224 bundlecaps=bundlecaps,
1218 shallow=shallow)
1225 shallow=shallow,
1226 ellipsisroots=ellipsisroots)
1219 1227
1220 def _makecg3packer(repo, filematcher, bundlecaps, shallow=False):
1228 def _makecg3packer(repo, filematcher, bundlecaps, shallow=False,
1229 ellipsisroots=None):
1221 1230 builddeltaheader = lambda d: _CHANGEGROUPV3_DELTA_HEADER.pack(
1222 1231 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
1223 1232
@@ -1228,7 +1237,8 b' def _makecg3packer(repo, filematcher, bu'
1228 1237 manifestsend=closechunk(),
1229 1238 sendtreemanifests=True,
1230 1239 bundlecaps=bundlecaps,
1231 shallow=shallow)
1240 shallow=shallow,
1241 ellipsisroots=ellipsisroots)
1232 1242
1233 1243 _packermap = {'01': (_makecg1packer, cg1unpacker),
1234 1244 # cg2 adds support for exchanging generaldelta
@@ -1289,7 +1299,7 b' def safeversion(repo):'
1289 1299 return min(versions)
1290 1300
1291 1301 def getbundler(version, repo, bundlecaps=None, filematcher=None,
1292 shallow=False):
1302 shallow=False, ellipsisroots=None):
1293 1303 assert version in supportedoutgoingversions(repo)
1294 1304
1295 1305 if filematcher is None:
@@ -1305,7 +1315,8 b' def getbundler(version, repo, bundlecaps'
1305 1315 filematcher)
1306 1316
1307 1317 fn = _packermap[version][0]
1308 return fn(repo, filematcher, bundlecaps, shallow=shallow)
1318 return fn(repo, filematcher, bundlecaps, shallow=shallow,
1319 ellipsisroots=ellipsisroots)
1309 1320
1310 1321 def getunbundler(version, fh, alg, extras=None):
1311 1322 return _packermap[version][1](fh, alg, extras=extras)
@@ -1401,13 +1412,12 b' def _packellipsischangegroup(repo, commo'
1401 1412 # sending that node's data. We override close() to detect
1402 1413 # pending ellipsis nodes and flush them.
1403 1414 packer = getbundler(version, repo, filematcher=match,
1404 shallow=depth is not None)
1415 shallow=depth is not None,
1416 ellipsisroots=ellipsisroots)
1405 1417 # Give the packer the list of nodes which should not be
1406 1418 # ellipsis nodes. We store this rather than the set of nodes
1407 1419 # that should be an ellipsis because for very large histories
1408 1420 # we expect this to be significantly smaller.
1409 1421 packer._full_nodes = relevant_nodes
1410 # Maps ellipsis revs to their roots at the changelog level.
1411 packer._precomputed_ellipsis = ellipsisroots
1412 1422
1413 1423 return packer.generate(common, visitnodes, False, source)
General Comments 0
You need to be logged in to leave comments. Login now