##// END OF EJS Templates
narrow: drop server support for widening using the getbundle command (BC)...
Martin von Zweigbergk -
r43537:e94f4579 default
parent child Browse files
Show More
@@ -11,10 +11,7 b' import errno'
11 import struct
11 import struct
12
12
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial.node import (
14 from mercurial.node import nullid
15 bin,
16 nullid,
17 )
18 from mercurial import (
15 from mercurial import (
19 bundle2,
16 bundle2,
20 changegroup,
17 changegroup,
@@ -65,42 +62,24 b' def getbundlechangegrouppart_narrow('
65 raise ValueError(_(b'no common changegroup version'))
62 raise ValueError(_(b'no common changegroup version'))
66 version = max(cgversions)
63 version = max(cgversions)
67
64
68 oldinclude = sorted(filter(bool, kwargs.get(r'oldincludepats', [])))
65 include = sorted(filter(bool, kwargs.get(r'includepats', [])))
69 oldexclude = sorted(filter(bool, kwargs.get(r'oldexcludepats', [])))
66 exclude = sorted(filter(bool, kwargs.get(r'excludepats', [])))
70 newinclude = sorted(filter(bool, kwargs.get(r'includepats', [])))
71 newexclude = sorted(filter(bool, kwargs.get(r'excludepats', [])))
72 known = {bin(n) for n in kwargs.get(r'known', [])}
73 generateellipsesbundle2(
67 generateellipsesbundle2(
74 bundler,
68 bundler,
75 repo,
69 repo,
76 oldinclude,
70 include,
77 oldexclude,
71 exclude,
78 newinclude,
79 newexclude,
80 version,
72 version,
81 common,
73 common,
82 heads,
74 heads,
83 known,
84 kwargs.get(r'depth', None),
75 kwargs.get(r'depth', None),
85 )
76 )
86
77
87
78
88 def generateellipsesbundle2(
79 def generateellipsesbundle2(
89 bundler,
80 bundler, repo, include, exclude, version, common, heads, depth,
90 repo,
91 oldinclude,
92 oldexclude,
93 newinclude,
94 newexclude,
95 version,
96 common,
97 heads,
98 known,
99 depth,
100 ):
81 ):
101 newmatch = narrowspec.match(
82 match = narrowspec.match(repo.root, include=include, exclude=exclude)
102 repo.root, include=newinclude, exclude=newexclude
103 )
104 if depth is not None:
83 if depth is not None:
105 depth = int(depth)
84 depth = int(depth)
106 if depth < 1:
85 if depth < 1:
@@ -108,61 +87,9 b' def generateellipsesbundle2('
108
87
109 heads = set(heads or repo.heads())
88 heads = set(heads or repo.heads())
110 common = set(common or [nullid])
89 common = set(common or [nullid])
111 if known and (oldinclude != newinclude or oldexclude != newexclude):
112 # Steps:
113 # 1. Send kill for "$known & ::common"
114 #
115 # 2. Send changegroup for ::common
116 #
117 # 3. Proceed.
118 #
119 # In the future, we can send kills for only the specific
120 # nodes we know should go away or change shape, and then
121 # send a data stream that tells the client something like this:
122 #
123 # a) apply this changegroup
124 # b) apply nodes XXX, YYY, ZZZ that you already have
125 # c) goto a
126 #
127 # until they've built up the full new state.
128 # Convert to revnums and intersect with "common". The client should
129 # have made it a subset of "common" already, but let's be safe.
130 known = set(repo.revs(b"%ln & ::%ln", known, common))
131 # TODO: we could send only roots() of this set, and the
132 # list of nodes in common, and the client could work out
133 # what to strip, instead of us explicitly sending every
134 # single node.
135 deadrevs = known
136
137 def genkills():
138 for r in deadrevs:
139 yield _KILLNODESIGNAL
140 yield repo.changelog.node(r)
141 yield _DONESIGNAL
142
143 bundler.newpart(_CHANGESPECPART, data=genkills())
144 newvisit, newfull, newellipsis = exchange._computeellipsis(
145 repo, set(), common, known, newmatch
146 )
147 if newvisit:
148 packer = changegroup.getbundler(
149 version,
150 repo,
151 matcher=newmatch,
152 ellipses=True,
153 shallow=depth is not None,
154 ellipsisroots=newellipsis,
155 fullnodes=newfull,
156 )
157 cgdata = packer.generate(common, newvisit, False, b'narrow_widen')
158
159 part = bundler.newpart(b'changegroup', data=cgdata)
160 part.addparam(b'version', version)
161 if b'treemanifest' in repo.requirements:
162 part.addparam(b'treemanifest', b'1')
163
90
164 visitnodes, relevant_nodes, ellipsisroots = exchange._computeellipsis(
91 visitnodes, relevant_nodes, ellipsisroots = exchange._computeellipsis(
165 repo, common, heads, set(), newmatch, depth=depth
92 repo, common, heads, set(), match, depth=depth
166 )
93 )
167
94
168 repo.ui.debug(b'Found %d relevant revs\n' % len(relevant_nodes))
95 repo.ui.debug(b'Found %d relevant revs\n' % len(relevant_nodes))
@@ -170,7 +97,7 b' def generateellipsesbundle2('
170 packer = changegroup.getbundler(
97 packer = changegroup.getbundler(
171 version,
98 version,
172 repo,
99 repo,
173 matcher=newmatch,
100 matcher=match,
174 ellipses=True,
101 ellipses=True,
175 shallow=depth is not None,
102 shallow=depth is not None,
176 ellipsisroots=ellipsisroots,
103 ellipsisroots=ellipsisroots,
General Comments 0
You need to be logged in to leave comments. Login now