##// END OF EJS Templates
changegroup: move _packellipsischangegroup() from narrow...
Gregory Szorc -
r38920:a2f52177 default
parent child Browse files
Show More
@@ -50,40 +50,6 b' def getrepocaps_narrow(orig, repo, **kwa'
50 caps[NARROWCAP] = ['v0']
50 caps[NARROWCAP] = ['v0']
51 return caps
51 return caps
52
52
53 def _packellipsischangegroup(repo, common, match, relevant_nodes,
54 ellipsisroots, visitnodes, depth, source, version):
55 if version in ('01', '02'):
56 raise error.Abort(
57 'ellipsis nodes require at least cg3 on client and server, '
58 'but negotiated version %s' % version)
59 # We wrap cg1packer.revchunk, using a side channel to pass
60 # relevant_nodes into that area. Then if linknode isn't in the
61 # set, we know we have an ellipsis node and we should defer
62 # sending that node's data. We override close() to detect
63 # pending ellipsis nodes and flush them.
64 packer = changegroup.getbundler(version, repo,
65 filematcher=match)
66 # Give the packer the list of nodes which should not be
67 # ellipsis nodes. We store this rather than the set of nodes
68 # that should be an ellipsis because for very large histories
69 # we expect this to be significantly smaller.
70 packer.full_nodes = relevant_nodes
71 # Maps ellipsis revs to their roots at the changelog level.
72 packer.precomputed_ellipsis = ellipsisroots
73 # Maps CL revs to per-revlog revisions. Cleared in close() at
74 # the end of each group.
75 packer.clrev_to_localrev = {}
76 packer.next_clrev_to_localrev = {}
77 # Maps changelog nodes to changelog revs. Filled in once
78 # during changelog stage and then left unmodified.
79 packer.clnode_to_rev = {}
80 packer.changelog_done = False
81 # If true, informs the packer that it is serving shallow content and might
82 # need to pack file contents not introduced by the changes being packed.
83 packer.is_shallow = depth is not None
84
85 return packer.generate(common, visitnodes, False, source)
86
87 # Serve a changegroup for a client with a narrow clone.
53 # Serve a changegroup for a client with a narrow clone.
88 def getbundlechangegrouppart_narrow(bundler, repo, source,
54 def getbundlechangegrouppart_narrow(bundler, repo, source,
89 bundlecaps=None, b2caps=None, heads=None,
55 bundlecaps=None, b2caps=None, heads=None,
@@ -150,7 +116,7 b' def getbundlechangegrouppart_narrow(bund'
150 newvisit, newfull, newellipsis = exchange._computeellipsis(
116 newvisit, newfull, newellipsis = exchange._computeellipsis(
151 repo, set(), common, known, newmatch)
117 repo, set(), common, known, newmatch)
152 if newvisit:
118 if newvisit:
153 cg = _packellipsischangegroup(
119 cg = changegroup._packellipsischangegroup(
154 repo, common, newmatch, newfull, newellipsis,
120 repo, common, newmatch, newfull, newellipsis,
155 newvisit, depth, source, version)
121 newvisit, depth, source, version)
156 part = bundler.newpart('changegroup', data=cg)
122 part = bundler.newpart('changegroup', data=cg)
@@ -163,7 +129,7 b' def getbundlechangegrouppart_narrow(bund'
163
129
164 repo.ui.debug('Found %d relevant revs\n' % len(relevant_nodes))
130 repo.ui.debug('Found %d relevant revs\n' % len(relevant_nodes))
165 if visitnodes:
131 if visitnodes:
166 cg = _packellipsischangegroup(
132 cg = changegroup._packellipsischangegroup(
167 repo, common, newmatch, relevant_nodes, ellipsisroots,
133 repo, common, newmatch, relevant_nodes, ellipsisroots,
168 visitnodes, depth, source, version)
134 visitnodes, depth, source, version)
169 part = bundler.newpart('changegroup', data=cg)
135 part = bundler.newpart('changegroup', data=cg)
@@ -1055,3 +1055,36 b' def _addchangegroupfiles(repo, source, r'
1055 (f, hex(n)))
1055 (f, hex(n)))
1056
1056
1057 return revisions, files
1057 return revisions, files
1058
1059 def _packellipsischangegroup(repo, common, match, relevant_nodes,
1060 ellipsisroots, visitnodes, depth, source, version):
1061 if version in ('01', '02'):
1062 raise error.Abort(
1063 'ellipsis nodes require at least cg3 on client and server, '
1064 'but negotiated version %s' % version)
1065 # We wrap cg1packer.revchunk, using a side channel to pass
1066 # relevant_nodes into that area. Then if linknode isn't in the
1067 # set, we know we have an ellipsis node and we should defer
1068 # sending that node's data. We override close() to detect
1069 # pending ellipsis nodes and flush them.
1070 packer = getbundler(version, repo, filematcher=match)
1071 # Give the packer the list of nodes which should not be
1072 # ellipsis nodes. We store this rather than the set of nodes
1073 # that should be an ellipsis because for very large histories
1074 # we expect this to be significantly smaller.
1075 packer.full_nodes = relevant_nodes
1076 # Maps ellipsis revs to their roots at the changelog level.
1077 packer.precomputed_ellipsis = ellipsisroots
1078 # Maps CL revs to per-revlog revisions. Cleared in close() at
1079 # the end of each group.
1080 packer.clrev_to_localrev = {}
1081 packer.next_clrev_to_localrev = {}
1082 # Maps changelog nodes to changelog revs. Filled in once
1083 # during changelog stage and then left unmodified.
1084 packer.clnode_to_rev = {}
1085 packer.changelog_done = False
1086 # If true, informs the packer that it is serving shallow content and might
1087 # need to pack file contents not introduced by the changes being packed.
1088 packer.is_shallow = depth is not None
1089
1090 return packer.generate(common, visitnodes, False, source)
General Comments 0
You need to be logged in to leave comments. Login now