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