##// END OF EJS Templates
changegroup: move fullnodes into cgpacker...
Gregory Szorc -
r38945:1af339c2 default
parent child Browse files
Show More
@@ -523,7 +523,7 b' class cgpacker(object):'
523 def __init__(self, repo, filematcher, version, allowreorder,
523 def __init__(self, repo, filematcher, version, allowreorder,
524 useprevdelta, builddeltaheader, manifestsend,
524 useprevdelta, builddeltaheader, manifestsend,
525 sendtreemanifests, bundlecaps=None, ellipses=False,
525 sendtreemanifests, bundlecaps=None, ellipses=False,
526 shallow=False, ellipsisroots=None):
526 shallow=False, ellipsisroots=None, fullnodes=None):
527 """Given a source repo, construct a bundler.
527 """Given a source repo, construct a bundler.
528
528
529 filematcher is a matcher that matches on files to include in the
529 filematcher is a matcher that matches on files to include in the
@@ -552,6 +552,10 b' class cgpacker(object):'
552
552
553 shallow indicates whether shallow data might be sent. The packer may
553 shallow indicates whether shallow data might be sent. The packer may
554 need to pack file contents not introduced by the changes being packed.
554 need to pack file contents not introduced by the changes being packed.
555
556 fullnodes is the list of nodes which should not be ellipsis nodes. We
557 store this rather than the set of nodes that should be ellipsis because
558 for very large histories we expect this to be significantly smaller.
555 """
559 """
556 assert filematcher
560 assert filematcher
557 self._filematcher = filematcher
561 self._filematcher = filematcher
@@ -568,6 +572,7 b' class cgpacker(object):'
568 bundlecaps = set()
572 bundlecaps = set()
569 self._bundlecaps = bundlecaps
573 self._bundlecaps = bundlecaps
570 self._isshallow = shallow
574 self._isshallow = shallow
575 self._fullnodes = fullnodes
571
576
572 # Maps ellipsis revs to their roots at the changelog level.
577 # Maps ellipsis revs to their roots at the changelog level.
573 self._precomputedellipsis = ellipsisroots
578 self._precomputedellipsis = ellipsisroots
@@ -744,7 +749,7 b' class cgpacker(object):'
744 # end up with bogus linkrevs specified for manifests and
749 # end up with bogus linkrevs specified for manifests and
745 # we skip some manifest nodes that we should otherwise
750 # we skip some manifest nodes that we should otherwise
746 # have sent.
751 # have sent.
747 if (x in self._full_nodes
752 if (x in self._fullnodes
748 or cl.rev(x) in self._precomputedellipsis):
753 or cl.rev(x) in self._precomputedellipsis):
749 n = c[0]
754 n = c[0]
750 # Record the first changeset introducing this manifest
755 # Record the first changeset introducing this manifest
@@ -1086,7 +1091,7 b' class cgpacker(object):'
1086
1091
1087 # This is a node to send in full, because the changeset it
1092 # This is a node to send in full, because the changeset it
1088 # corresponds to was a full changeset.
1093 # corresponds to was a full changeset.
1089 if linknode in self._full_nodes:
1094 if linknode in self._fullnodes:
1090 return self._revisiondeltanormal(store, rev, prev, linknode)
1095 return self._revisiondeltanormal(store, rev, prev, linknode)
1091
1096
1092 # At this point, a node can either be one we should skip or an
1097 # At this point, a node can either be one we should skip or an
@@ -1135,7 +1140,7 b' class cgpacker(object):'
1135 walk = walk[1:]
1140 walk = walk[1:]
1136 if p in self._clrevtolocalrev:
1141 if p in self._clrevtolocalrev:
1137 return self._clrevtolocalrev[p]
1142 return self._clrevtolocalrev[p]
1138 elif p in self._full_nodes:
1143 elif p in self._fullnodes:
1139 walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
1144 walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
1140 if pp != nullrev])
1145 if pp != nullrev])
1141 elif p in self._precomputedellipsis:
1146 elif p in self._precomputedellipsis:
@@ -1194,7 +1199,7 b' class cgpacker(object):'
1194 )
1199 )
1195
1200
1196 def _makecg1packer(repo, filematcher, bundlecaps, ellipses=False,
1201 def _makecg1packer(repo, filematcher, bundlecaps, ellipses=False,
1197 shallow=False, ellipsisroots=None):
1202 shallow=False, ellipsisroots=None, fullnodes=None):
1198 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
1203 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
1199 d.node, d.p1node, d.p2node, d.linknode)
1204 d.node, d.p1node, d.p2node, d.linknode)
1200
1205
@@ -1207,10 +1212,11 b' def _makecg1packer(repo, filematcher, bu'
1207 bundlecaps=bundlecaps,
1212 bundlecaps=bundlecaps,
1208 ellipses=ellipses,
1213 ellipses=ellipses,
1209 shallow=shallow,
1214 shallow=shallow,
1210 ellipsisroots=ellipsisroots)
1215 ellipsisroots=ellipsisroots,
1216 fullnodes=fullnodes)
1211
1217
1212 def _makecg2packer(repo, filematcher, bundlecaps, ellipses=False,
1218 def _makecg2packer(repo, filematcher, bundlecaps, ellipses=False,
1213 shallow=False, ellipsisroots=None):
1219 shallow=False, ellipsisroots=None, fullnodes=None):
1214 builddeltaheader = lambda d: _CHANGEGROUPV2_DELTA_HEADER.pack(
1220 builddeltaheader = lambda d: _CHANGEGROUPV2_DELTA_HEADER.pack(
1215 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
1221 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
1216
1222
@@ -1226,10 +1232,11 b' def _makecg2packer(repo, filematcher, bu'
1226 bundlecaps=bundlecaps,
1232 bundlecaps=bundlecaps,
1227 ellipses=ellipses,
1233 ellipses=ellipses,
1228 shallow=shallow,
1234 shallow=shallow,
1229 ellipsisroots=ellipsisroots)
1235 ellipsisroots=ellipsisroots,
1236 fullnodes=fullnodes)
1230
1237
1231 def _makecg3packer(repo, filematcher, bundlecaps, ellipses=False,
1238 def _makecg3packer(repo, filematcher, bundlecaps, ellipses=False,
1232 shallow=False, ellipsisroots=None):
1239 shallow=False, ellipsisroots=None, fullnodes=None):
1233 builddeltaheader = lambda d: _CHANGEGROUPV3_DELTA_HEADER.pack(
1240 builddeltaheader = lambda d: _CHANGEGROUPV3_DELTA_HEADER.pack(
1234 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
1241 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
1235
1242
@@ -1242,7 +1249,8 b' def _makecg3packer(repo, filematcher, bu'
1242 bundlecaps=bundlecaps,
1249 bundlecaps=bundlecaps,
1243 ellipses=ellipses,
1250 ellipses=ellipses,
1244 shallow=shallow,
1251 shallow=shallow,
1245 ellipsisroots=ellipsisroots)
1252 ellipsisroots=ellipsisroots,
1253 fullnodes=fullnodes)
1246
1254
1247 _packermap = {'01': (_makecg1packer, cg1unpacker),
1255 _packermap = {'01': (_makecg1packer, cg1unpacker),
1248 # cg2 adds support for exchanging generaldelta
1256 # cg2 adds support for exchanging generaldelta
@@ -1303,7 +1311,8 b' def safeversion(repo):'
1303 return min(versions)
1311 return min(versions)
1304
1312
1305 def getbundler(version, repo, bundlecaps=None, filematcher=None,
1313 def getbundler(version, repo, bundlecaps=None, filematcher=None,
1306 ellipses=False, shallow=False, ellipsisroots=None):
1314 ellipses=False, shallow=False, ellipsisroots=None,
1315 fullnodes=None):
1307 assert version in supportedoutgoingversions(repo)
1316 assert version in supportedoutgoingversions(repo)
1308
1317
1309 if filematcher is None:
1318 if filematcher is None:
@@ -1325,7 +1334,8 b' def getbundler(version, repo, bundlecaps'
1325
1334
1326 fn = _packermap[version][0]
1335 fn = _packermap[version][0]
1327 return fn(repo, filematcher, bundlecaps, ellipses=ellipses,
1336 return fn(repo, filematcher, bundlecaps, ellipses=ellipses,
1328 shallow=shallow, ellipsisroots=ellipsisroots)
1337 shallow=shallow, ellipsisroots=ellipsisroots,
1338 fullnodes=fullnodes)
1329
1339
1330 def getunbundler(version, fh, alg, extras=None):
1340 def getunbundler(version, fh, alg, extras=None):
1331 return _packermap[version][1](fh, alg, extras=extras)
1341 return _packermap[version][1](fh, alg, extras=extras)
@@ -1419,11 +1429,7 b' def _packellipsischangegroup(repo, commo'
1419 packer = getbundler(version, repo, filematcher=match,
1429 packer = getbundler(version, repo, filematcher=match,
1420 ellipses=True,
1430 ellipses=True,
1421 shallow=depth is not None,
1431 shallow=depth is not None,
1422 ellipsisroots=ellipsisroots)
1432 ellipsisroots=ellipsisroots,
1423 # Give the packer the list of nodes which should not be
1433 fullnodes=relevant_nodes)
1424 # ellipsis nodes. We store this rather than the set of nodes
1425 # that should be an ellipsis because for very large histories
1426 # we expect this to be significantly smaller.
1427 packer._full_nodes = relevant_nodes
1428
1434
1429 return packer.generate(common, visitnodes, False, source)
1435 return packer.generate(common, visitnodes, False, source)
General Comments 0
You need to be logged in to leave comments. Login now