Show More
@@ -16,6 +16,7 b' from .node import (' | |||
|
16 | 16 | ) |
|
17 | 17 | from . import ( |
|
18 | 18 | mdiff, |
|
19 | phases, | |
|
19 | 20 | pycompat, |
|
20 | 21 | setdiscovery, |
|
21 | 22 | ) |
@@ -30,8 +31,25 b' def pull(pullop):' | |||
|
30 | 31 | common, fetch, remoteheads = _pullchangesetdiscovery( |
|
31 | 32 | repo, remote, pullop.heads, abortwhenunrelated=pullop.force) |
|
32 | 33 | |
|
34 | # And fetch the data. | |
|
33 | 35 | pullheads = pullop.heads or remoteheads |
|
34 | _fetchchangesets(repo, tr, remote, common, fetch, pullheads) | |
|
36 | csetres = _fetchchangesets(repo, tr, remote, common, fetch, pullheads) | |
|
37 | ||
|
38 | # New revisions are written to the changelog. But all other updates | |
|
39 | # are deferred. Do those now. | |
|
40 | ||
|
41 | # Ensure all new changesets are draft by default. If the repo is | |
|
42 | # publishing, the phase will be adjusted by the loop below. | |
|
43 | if csetres['added']: | |
|
44 | phases.registernew(repo, tr, phases.draft, csetres['added']) | |
|
45 | ||
|
46 | # And adjust the phase of all changesets accordingly. | |
|
47 | for phase in phases.phasenames: | |
|
48 | if phase == b'secret' or not csetres['nodesbyphase'][phase]: | |
|
49 | continue | |
|
50 | ||
|
51 | phases.advanceboundary(repo, tr, phases.phasenames.index(phase), | |
|
52 | csetres['nodesbyphase'][phase]) | |
|
35 | 53 | |
|
36 | 54 | def _pullchangesetdiscovery(repo, remote, heads, abortwhenunrelated=True): |
|
37 | 55 | """Determine which changesets need to be pulled.""" |
@@ -65,9 +83,6 b' def _pullchangesetdiscovery(repo, remote' | |||
|
65 | 83 | return common, fetch, remoteheads |
|
66 | 84 | |
|
67 | 85 | def _fetchchangesets(repo, tr, remote, common, fetch, remoteheads): |
|
68 | if not fetch: | |
|
69 | return | |
|
70 | ||
|
71 | 86 | # TODO consider adding a step here where we obtain the DAG shape first |
|
72 | 87 | # (or ask the server to slice changesets into chunks for us) so that |
|
73 | 88 | # we can perform multiple fetches in batches. This will facilitate |
@@ -76,7 +91,7 b' def _fetchchangesets(repo, tr, remote, c' | |||
|
76 | 91 | with remote.commandexecutor() as e: |
|
77 | 92 | objs = e.callcommand(b'changesetdata', { |
|
78 | 93 | b'noderange': [sorted(common), sorted(remoteheads)], |
|
79 | b'fields': {b'parents', b'revision'}, | |
|
94 | b'fields': {b'parents', b'phase', b'revision'}, | |
|
80 | 95 | }).result() |
|
81 | 96 | |
|
82 | 97 | # The context manager waits on all response data when exiting. So |
@@ -108,15 +123,28 b' def _processchangesetdata(repo, tr, objs' | |||
|
108 | 123 | def onchangeset(cl, node): |
|
109 | 124 | progress.increment() |
|
110 | 125 | |
|
126 | nodesbyphase = {phase: set() for phase in phases.phasenames} | |
|
127 | ||
|
111 | 128 | # addgroup() expects a 7-tuple describing revisions. This normalizes |
|
112 | 129 | # the wire data to that format. |
|
130 | # | |
|
131 | # This loop also aggregates non-revision metadata, such as phase | |
|
132 | # data. | |
|
113 | 133 | def iterrevisions(): |
|
114 | 134 | for cset in objs: |
|
115 | assert b'revisionsize' in cset | |
|
135 | node = cset[b'node'] | |
|
136 | ||
|
137 | if b'phase' in cset: | |
|
138 | nodesbyphase[cset[b'phase']].add(node) | |
|
139 | ||
|
140 | # Some entries might only be metadata only updates. | |
|
141 | if b'revisionsize' not in cset: | |
|
142 | continue | |
|
143 | ||
|
116 | 144 | data = next(objs) |
|
117 | 145 | |
|
118 | 146 | yield ( |
|
119 |
|
|
|
147 | node, | |
|
120 | 148 | cset[b'parents'][0], |
|
121 | 149 | cset[b'parents'][1], |
|
122 | 150 | # Linknode is always itself for changesets. |
@@ -135,4 +163,5 b' def _processchangesetdata(repo, tr, objs' | |||
|
135 | 163 | |
|
136 | 164 | return { |
|
137 | 165 | 'added': added, |
|
166 | 'nodesbyphase': nodesbyphase, | |
|
138 | 167 | } |
@@ -55,6 +55,7 b' Test basic clone' | |||
|
55 | 55 | sending command changesetdata: { |
|
56 | 56 | 'fields': set([ |
|
57 | 57 | 'parents', |
|
58 | 'phase', | |
|
58 | 59 | 'revision' |
|
59 | 60 | ]), |
|
60 | 61 | 'noderange': [ |
@@ -66,7 +67,7 b' Test basic clone' | |||
|
66 | 67 | ] |
|
67 | 68 | } |
|
68 | 69 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
69 |
received frame(size=8 |
|
|
70 | received frame(size=871; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
70 | 71 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
71 | 72 | add changeset 3390ef850073 |
|
72 | 73 | add changeset 4432d83626e8 |
@@ -74,7 +75,7 b' Test basic clone' | |||
|
74 | 75 | add changeset e96ae20f4188 |
|
75 | 76 | add changeset caa2a465451d |
|
76 | 77 | updating the branch cache |
|
77 | new changesets 3390ef850073:caa2a465451d | |
|
78 | new changesets 3390ef850073:caa2a465451d (3 drafts) | |
|
78 | 79 | |
|
79 | 80 | All changesets should have been transferred |
|
80 | 81 | |
@@ -87,11 +88,11 b' All changesets should have been transfer' | |||
|
87 | 88 | 4 4 caa2a465451d e96ae20f4188 000000000000 |
|
88 | 89 | |
|
89 | 90 | $ hg -R client-simple log -G -T '{rev} {node} {phase}\n' |
|
90 |
o 4 caa2a465451dd1facda0f5b12312c355584188a1 |
|
|
91 | o 4 caa2a465451dd1facda0f5b12312c355584188a1 draft | |
|
91 | 92 | | |
|
92 |
o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 |
|
|
93 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 draft | |
|
93 | 94 | | |
|
94 |
| o 2 cd2534766bece138c7c1afdc6825302f0f62d81f |
|
|
95 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft | |
|
95 | 96 | | | |
|
96 | 97 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
97 | 98 | |/ |
@@ -126,6 +127,7 b' Cloning only a specific revision works' | |||
|
126 | 127 | sending command changesetdata: { |
|
127 | 128 | 'fields': set([ |
|
128 | 129 | 'parents', |
|
130 | 'phase', | |
|
129 | 131 | 'revision' |
|
130 | 132 | ]), |
|
131 | 133 | 'noderange': [ |
@@ -136,7 +138,7 b' Cloning only a specific revision works' | |||
|
136 | 138 | ] |
|
137 | 139 | } |
|
138 | 140 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
139 |
received frame(size=3 |
|
|
141 | received frame(size=353; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
140 | 142 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
141 | 143 | add changeset 3390ef850073 |
|
142 | 144 | add changeset 4432d83626e8 |
@@ -177,6 +179,7 b' Incremental pull works' | |||
|
177 | 179 | sending command changesetdata: { |
|
178 | 180 | 'fields': set([ |
|
179 | 181 | 'parents', |
|
182 | 'phase', | |
|
180 | 183 | 'revision' |
|
181 | 184 | ]), |
|
182 | 185 | 'noderange': [ |
@@ -190,13 +193,73 b' Incremental pull works' | |||
|
190 | 193 | ] |
|
191 | 194 | } |
|
192 | 195 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) |
|
193 |
received frame(size= |
|
|
196 | received frame(size=571; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
194 | 197 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) |
|
195 | 198 | add changeset cd2534766bec |
|
196 | 199 | add changeset e96ae20f4188 |
|
197 | 200 | add changeset caa2a465451d |
|
198 | 201 | updating the branch cache |
|
199 | new changesets cd2534766bec:caa2a465451d | |
|
202 | new changesets cd2534766bec:caa2a465451d (3 drafts) | |
|
203 | (run 'hg update' to get a working copy) | |
|
204 | ||
|
205 | $ hg log -G -T '{rev} {node} {phase}\n' | |
|
206 | o 4 caa2a465451dd1facda0f5b12312c355584188a1 draft | |
|
207 | | | |
|
208 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 draft | |
|
209 | | | |
|
210 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft | |
|
211 | | | | |
|
212 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public | |
|
213 | |/ | |
|
214 | o 0 3390ef850073fbc2f0dfff2244342c8e9229013a public | |
|
215 | ||
|
216 | ||
|
217 | Phase-only update works | |
|
218 | ||
|
219 | $ hg -R ../server-simple phase --public -r caa2a465451dd | |
|
220 | $ hg --debug pull | |
|
221 | pulling from http://localhost:$HGPORT/ | |
|
222 | using http://localhost:$HGPORT/ | |
|
223 | sending capabilities command | |
|
224 | query 1; heads | |
|
225 | sending 2 commands | |
|
226 | sending command heads: {} | |
|
227 | sending command known: { | |
|
228 | 'nodes': [ | |
|
229 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f', | |
|
230 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1' | |
|
231 | ] | |
|
232 | } | |
|
233 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
234 | received frame(size=43; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
235 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
236 | received frame(size=11; request=3; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
237 | received frame(size=3; request=3; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
238 | received frame(size=0; request=3; stream=2; streamflags=; type=command-response; flags=eos) | |
|
239 | searching for changes | |
|
240 | all remote heads known locally | |
|
241 | sending 1 commands | |
|
242 | sending command changesetdata: { | |
|
243 | 'fields': set([ | |
|
244 | 'parents', | |
|
245 | 'phase', | |
|
246 | 'revision' | |
|
247 | ]), | |
|
248 | 'noderange': [ | |
|
249 | [ | |
|
250 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', | |
|
251 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' | |
|
252 | ], | |
|
253 | [ | |
|
254 | '\xca\xa2\xa4eE\x1d\xd1\xfa\xcd\xa0\xf5\xb1#\x12\xc3UXA\x88\xa1', | |
|
255 | '\xcd%4vk\xec\xe18\xc7\xc1\xaf\xdch%0/\x0fb\xd8\x1f' | |
|
256 | ] | |
|
257 | ] | |
|
258 | } | |
|
259 | received frame(size=11; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=continuation) | |
|
260 | received frame(size=92; request=1; stream=2; streamflags=; type=command-response; flags=continuation) | |
|
261 | received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) | |
|
262 | 2 local changesets published | |
|
200 | 263 | (run 'hg update' to get a working copy) |
|
201 | 264 | |
|
202 | 265 | $ hg log -G -T '{rev} {node} {phase}\n' |
@@ -204,7 +267,7 b' Incremental pull works' | |||
|
204 | 267 | | |
|
205 | 268 | o 3 e96ae20f4188487b9ae4ef3941c27c81143146e5 public |
|
206 | 269 | | |
|
207 |
| o 2 cd2534766bece138c7c1afdc6825302f0f62d81f |
|
|
270 | | o 2 cd2534766bece138c7c1afdc6825302f0f62d81f draft | |
|
208 | 271 | | | |
|
209 | 272 | | o 1 4432d83626e8a98655f062ec1f2a43b07f7fbbb0 public |
|
210 | 273 | |/ |
General Comments 0
You need to be logged in to leave comments.
Login now