Show More
@@ -146,7 +146,7 b' def pullbundle2extraprepare(orig, pullop' | |||
|
146 | 146 | kwargs['excludepats'] = exclude |
|
147 | 147 | # calculate known nodes only in ellipses cases because in non-ellipses cases |
|
148 | 148 | # we have all the nodes |
|
149 | if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities(): | |
|
149 | if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities(): | |
|
150 | 150 | kwargs['known'] = [node.hex(ctx.node()) for ctx in |
|
151 | 151 | repo.set('::%ln', pullop.common) |
|
152 | 152 | if ctx.node() != node.nullid] |
@@ -253,7 +253,14 b' def _widen(ui, repo, remote, commoninc, ' | |||
|
253 | 253 | # then send that information to server whether we want ellipses or not. |
|
254 | 254 | # Theoretically a non-ellipses repo should be able to use narrow |
|
255 | 255 | # functionality from an ellipses enabled server |
|
256 |
|
|
|
256 | remotecap = remote.capabilities() | |
|
257 | ellipsesremote = any(cap in remotecap | |
|
258 | for cap in wireprototypes.SUPPORTED_ELLIPSESCAP) | |
|
259 | ||
|
260 | # check whether we are talking to a server which supports old version of | |
|
261 | # ellipses capabilities | |
|
262 | isoldellipses = (ellipsesremote and wireprototypes.ELLIPSESCAP1 in | |
|
263 | remotecap and wireprototypes.ELLIPSESCAP not in remotecap) | |
|
257 | 264 | |
|
258 | 265 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
259 | 266 | orig(pullop, kwargs) |
@@ -279,8 +286,31 b' def _widen(ui, repo, remote, commoninc, ' | |||
|
279 | 286 | with ds.parentchange(): |
|
280 | 287 | ds.setparents(node.nullid, node.nullid) |
|
281 | 288 | with wrappedextraprepare: |
|
282 | with repo.ui.configoverride(overrides, 'widen'): | |
|
289 | if isoldellipses: | |
|
283 | 290 | exchange.pull(repo, remote, heads=common) |
|
291 | else: | |
|
292 | known = [node.hex(ctx.node()) for ctx in | |
|
293 | repo.set('::%ln', common) | |
|
294 | if ctx.node() != node.nullid] | |
|
295 | ||
|
296 | with remote.commandexecutor() as e: | |
|
297 | bundle = e.callcommand('narrow_widen', { | |
|
298 | 'oldincludes': oldincludes, | |
|
299 | 'oldexcludes': oldexcludes, | |
|
300 | 'newincludes': newincludes, | |
|
301 | 'newexcludes': newexcludes, | |
|
302 | 'cgversion': '03', | |
|
303 | 'commonheads': common, | |
|
304 | 'known': known, | |
|
305 | 'ellipses': True, | |
|
306 | }).result() | |
|
307 | trmanager = exchange.transactionmanager(repo, 'widen', | |
|
308 | remote.url()) | |
|
309 | with trmanager: | |
|
310 | op = bundle2.bundleoperation(repo, | |
|
311 | trmanager.transaction, source='widen') | |
|
312 | bundle2.processbundle(repo, bundle, op=op) | |
|
313 | ||
|
284 | 314 | with ds.parentchange(): |
|
285 | 315 | ds.setparents(p1, p2) |
|
286 | 316 | else: |
@@ -13,12 +13,15 b' from mercurial import (' | |||
|
13 | 13 | extensions, |
|
14 | 14 | hg, |
|
15 | 15 | narrowspec, |
|
16 | node as nodemod, | |
|
16 | 17 | pycompat, |
|
17 | 18 | wireprototypes, |
|
18 | 19 | wireprotov1peer, |
|
19 | 20 | wireprotov1server, |
|
20 | 21 | ) |
|
21 | 22 | |
|
23 | from . import narrowbundle2 | |
|
24 | ||
|
22 | 25 | def uisetup(): |
|
23 | 26 | wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden |
|
24 | 27 | |
@@ -69,21 +72,26 b' def narrow_widen(repo, proto, oldinclude' | |||
|
69 | 72 | narrowspec.validatepatterns(set(newexcludes)) |
|
70 | 73 | |
|
71 | 74 | common = wireprototypes.decodelist(commonheads) |
|
72 | known = None | |
|
73 | if known: | |
|
74 | known = wireprototypes.decodelist(known) | |
|
75 | known = wireprototypes.decodelist(known) | |
|
76 | known = {nodemod.bin(n) for n in known} | |
|
75 | 77 | if ellipses == '0': |
|
76 | 78 | ellipses = False |
|
77 | 79 | else: |
|
78 | 80 | ellipses = bool(ellipses) |
|
79 | 81 | cgversion = cgversion |
|
80 | newmatch = narrowspec.match(repo.root, include=newincludes, | |
|
81 | exclude=newexcludes) | |
|
82 | oldmatch = narrowspec.match(repo.root, include=oldincludes, | |
|
83 | exclude=oldexcludes) | |
|
84 | 82 | |
|
85 | bundler = bundle2.widen_bundle(repo, oldmatch, newmatch, common, known, | |
|
86 | cgversion, ellipses) | |
|
83 | if not ellipses: | |
|
84 | newmatch = narrowspec.match(repo.root, include=newincludes, | |
|
85 | exclude=newexcludes) | |
|
86 | oldmatch = narrowspec.match(repo.root, include=oldincludes, | |
|
87 | exclude=oldexcludes) | |
|
88 | bundler = bundle2.widen_bundle(repo, oldmatch, newmatch, common, | |
|
89 | known, cgversion, ellipses) | |
|
90 | else: | |
|
91 | bundler = bundle2.bundle20(repo.ui) | |
|
92 | narrowbundle2.generateellipsesbundle2(bundler, repo, oldincludes, | |
|
93 | oldexcludes, newincludes, newexcludes, cgversion, common, | |
|
94 | list(common), known, None) | |
|
87 | 95 | except error.Abort as exc: |
|
88 | 96 | bundler = bundle2.bundle20(repo.ui) |
|
89 | 97 | manargs = [('message', pycompat.bytestr(exc))] |
@@ -30,7 +30,9 b" SSHV2 = 'exp-ssh-v2-0003'" | |||
|
30 | 30 | HTTP_WIREPROTO_V2 = 'exp-http-v2-0003' |
|
31 | 31 | |
|
32 | 32 | NARROWCAP = 'exp-narrow-1' |
|
33 | ELLIPSESCAP = 'exp-ellipses-1' | |
|
33 | ELLIPSESCAP1 = 'exp-ellipses-1' | |
|
34 | ELLIPSESCAP = 'exp-ellipses-2' | |
|
35 | SUPPORTED_ELLIPSESCAP = (ELLIPSESCAP1, ELLIPSESCAP) | |
|
34 | 36 | |
|
35 | 37 | # All available wire protocol transports. |
|
36 | 38 | TRANSPORTS = { |
@@ -135,13 +135,11 b' widen the narrow checkout' | |||
|
135 | 135 | $ hg tracked --removeexclude dir1/dirA |
|
136 | 136 | comparing with ssh://user@dummy/master |
|
137 | 137 | searching for changes |
|
138 | no changes found | |
|
139 | 138 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
140 | 139 | adding changesets |
|
141 | 140 | adding manifests |
|
142 | 141 | adding file changes |
|
143 | 142 | added 9 changesets with 6 changes to 6 files |
|
144 | new changesets *:* (glob) | |
|
145 | 143 | $ hg tracked |
|
146 | 144 | I path:dir1 |
|
147 | 145 | I path:dir2 |
@@ -195,13 +193,11 b' widen narrow spec again, but exclude a f' | |||
|
195 | 193 | deleting data/dir1/dirA/bar.i (reporevlogstore !) |
|
196 | 194 | deleting data/dir1/dirA/bar/0eca1d0cbdaea4651d1d04d71976a6d2d9bfaae5 (reposimplestore !) |
|
197 | 195 | deleting data/dir1/dirA/bar/index (reposimplestore !) |
|
198 | no changes found | |
|
199 | 196 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
200 | 197 | adding changesets |
|
201 | 198 | adding manifests |
|
202 | 199 | adding file changes |
|
203 | 200 | added 11 changesets with 7 changes to 7 files |
|
204 | new changesets *:* (glob) | |
|
205 | 201 | $ hg tracked |
|
206 | 202 | I path:dir1 |
|
207 | 203 | I path:dir2 |
@@ -253,13 +249,11 b' widen narrow spec yet again, excluding a' | |||
|
253 | 249 | deleting data/dir1/dirA/foo.i (reporevlogstore !) |
|
254 | 250 | deleting data/dir1/dirA/foo/162caeb3d55dceb1fee793aa631ac8c73fcb8b5e (reposimplestore !) |
|
255 | 251 | deleting data/dir1/dirA/foo/index (reposimplestore !) |
|
256 | no changes found | |
|
257 | 252 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
258 | 253 | adding changesets |
|
259 | 254 | adding manifests |
|
260 | 255 | adding file changes |
|
261 | 256 | added 13 changesets with 8 changes to 8 files |
|
262 | new changesets *:* (glob) | |
|
263 | 257 | $ hg tracked |
|
264 | 258 | I path:dir1 |
|
265 | 259 | I path:dir2 |
@@ -312,13 +306,11 b' include a directory that was previously ' | |||
|
312 | 306 | $ hg tracked --removeexclude dir1/dirA |
|
313 | 307 | comparing with ssh://user@dummy/master |
|
314 | 308 | searching for changes |
|
315 | no changes found | |
|
316 | 309 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
317 | 310 | adding changesets |
|
318 | 311 | adding manifests |
|
319 | 312 | adding file changes |
|
320 | 313 | added 13 changesets with 9 changes to 9 files |
|
321 | new changesets *:* (glob) | |
|
322 | 314 | $ hg tracked |
|
323 | 315 | I path:dir1 |
|
324 | 316 | I path:dir2 |
@@ -389,13 +381,11 b' clone a narrow portion of the master, su' | |||
|
389 | 381 | $ hg tracked --addinclude dir1 |
|
390 | 382 | comparing with ssh://user@dummy/master |
|
391 | 383 | searching for changes |
|
392 | no changes found | |
|
393 | 384 | saved backup bundle to $TESTTMP/narrow2/.hg/strip-backup/*-widen.hg (glob) |
|
394 | 385 | adding changesets |
|
395 | 386 | adding manifests |
|
396 | 387 | adding file changes |
|
397 | 388 | added 10 changesets with 6 changes to 6 files |
|
398 | new changesets *:* (glob) | |
|
399 | 389 | $ find * | sort |
|
400 | 390 | dir1 |
|
401 | 391 | dir1/bar |
@@ -145,13 +145,11 b' Testing the --import-rules flag of `hg t' | |||
|
145 | 145 | looking for local changes to affected paths |
|
146 | 146 | deleting data/inside/f.i |
|
147 | 147 | deleting meta/inside/00manifest.i (tree !) |
|
148 | no changes found | |
|
149 | 148 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
150 | 149 | adding changesets |
|
151 | 150 | adding manifests |
|
152 | 151 | adding file changes |
|
153 | 152 | added 2 changesets with 0 changes to 0 files |
|
154 | new changesets *:* (glob) | |
|
155 | 153 |
$ |
|
156 | 154 | I path:outisde |
|
157 | 155 | X path:inside |
@@ -166,13 +164,11 b' Testing the --import-rules flag with --a' | |||
|
166 | 164 | $ hg tracked --import-rules specs --addinclude 'wider/' |
|
167 | 165 | comparing with ssh://user@dummy/master |
|
168 | 166 | searching for changes |
|
169 | no changes found | |
|
170 | 167 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
171 | 168 | adding changesets |
|
172 | 169 | adding manifests |
|
173 | 170 | adding file changes |
|
174 | 171 | added 3 changesets with 1 changes to 1 files |
|
175 | new changesets *:* (glob) | |
|
176 | 172 |
$ |
|
177 | 173 | I path:outisde |
|
178 | 174 | I path:wider |
@@ -211,13 +207,11 b' Testing with passing a out of wdir file' | |||
|
211 | 207 | $ hg tracked --import-rules ../nspecs |
|
212 | 208 | comparing with ssh://user@dummy/master |
|
213 | 209 | searching for changes |
|
214 | no changes found | |
|
215 | 210 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
216 | 211 | adding changesets |
|
217 | 212 | adding manifests |
|
218 | 213 | adding file changes |
|
219 | 214 | added 3 changesets with 0 changes to 0 files |
|
220 | new changesets *:* (glob) | |
|
221 | 215 | |
|
222 | 216 |
$ |
|
223 | 217 |
@@ -95,13 +95,11 b' added upstream revisions.' | |||
|
95 | 95 | $ hg tracked --addinclude widest/f |
|
96 | 96 | comparing with ssh://user@dummy/master |
|
97 | 97 | searching for changes |
|
98 | no changes found | |
|
99 | 98 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
100 | 99 | adding changesets |
|
101 | 100 | adding manifests |
|
102 | 101 | adding file changes |
|
103 | 102 | added 3 changesets with 2 changes to 2 files |
|
104 | new changesets *:* (glob) | |
|
105 | 103 |
$ |
|
106 | 104 | I path:inside |
|
107 | 105 | I path:widest/f |
@@ -154,13 +152,11 b' widen the narrow spec to include the wid' | |||
|
154 | 152 | $ hg tracked --addinclude wider |
|
155 | 153 | comparing with ssh://user@dummy/master |
|
156 | 154 | searching for changes |
|
157 | no changes found | |
|
158 | 155 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
159 | 156 | adding changesets |
|
160 | 157 | adding manifests |
|
161 | 158 | adding file changes |
|
162 | 159 | added 8 changesets with 7 changes to 3 files |
|
163 | new changesets *:* (glob) | |
|
164 | 160 |
$ |
|
165 | 161 | I path:inside |
|
166 | 162 | I path:wider |
@@ -261,13 +257,11 b' make narrow clone with every third node.' | |||
|
261 | 257 | $ hg tracked --addinclude d1 |
|
262 | 258 | comparing with ssh://user@dummy/upstream |
|
263 | 259 | searching for changes |
|
264 | no changes found | |
|
265 | 260 | saved backup bundle to $TESTTMP/narrow2/.hg/strip-backup/*-widen.hg (glob) |
|
266 | 261 | adding changesets |
|
267 | 262 | adding manifests |
|
268 | 263 | adding file changes |
|
269 | 264 | added 9 changesets with 5 changes to 5 files |
|
270 | new changesets *:* (glob) | |
|
271 | 265 |
$ |
|
272 | 266 | I path:d0 |
|
273 | 267 | I path:d1 |
@@ -342,7 +336,6 b' Widening that fails can be recovered fro' | |||
|
342 | 336 | $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 |
|
343 | 337 | comparing with ssh://user@dummy/upstream |
|
344 | 338 | searching for changes |
|
345 | no changes found | |
|
346 | 339 | saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/*-widen.hg (glob) |
|
347 | 340 | adding changesets |
|
348 | 341 | adding manifests |
@@ -290,13 +290,11 b' Can widen the empty clone' | |||
|
290 | 290 | $ hg tracked --addinclude d0 |
|
291 | 291 | comparing with ssh://user@dummy/master |
|
292 | 292 | searching for changes |
|
293 | no changes found | |
|
294 | 293 | saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob) |
|
295 | 294 | adding changesets |
|
296 | 295 | adding manifests |
|
297 | 296 | adding file changes |
|
298 | 297 | added 3 changesets with 1 changes to 1 files |
|
299 | new changesets *:* (glob) | |
|
300 | 298 |
$ |
|
301 | 299 | I path:d0 |
|
302 | 300 |
$ |
General Comments 0
You need to be logged in to leave comments.
Login now