##// END OF EJS Templates
obsolete: do not exchange extinct changesets...
Pierre-Yves David -
r17206:70ebb4bd default
parent child Browse files
Show More
@@ -109,11 +109,13 b' def findcommonoutgoing(repo, other, only'
109 og.commonheads, _any, _hds = commoninc
109 og.commonheads, _any, _hds = commoninc
110
110
111 # compute outgoing
111 # compute outgoing
112 if not repo._phasecache.phaseroots[phases.secret]:
112 mayexclude = (repo._phasecache.phaseroots[phases.secret] or repo.obsstore)
113 if not mayexclude:
113 og.missingheads = onlyheads or repo.heads()
114 og.missingheads = onlyheads or repo.heads()
114 elif onlyheads is None:
115 elif onlyheads is None:
115 # use visible heads as it should be cached
116 # use visible heads as it should be cached
116 og.missingheads = visibleheads(repo)
117 og.missingheads = visibleheads(repo)
118 # extinct changesets are silently ignored
117 og.excluded = [ctx.node() for ctx in repo.set('secret()')]
119 og.excluded = [ctx.node() for ctx in repo.set('secret()')]
118 else:
120 else:
119 # compute common, missing and exclude secret stuff
121 # compute common, missing and exclude secret stuff
@@ -122,17 +124,18 b' def findcommonoutgoing(repo, other, only'
122 og._missing = missing = []
124 og._missing = missing = []
123 og.excluded = excluded = []
125 og.excluded = excluded = []
124 for node in allmissing:
126 for node in allmissing:
125 if repo[node].phase() >= phases.secret:
127 ctx = repo[node]
126 excluded.append(node)
128 if not ctx.extinct():
127 else:
129 # extinct changesets are silently ignored
128 missing.append(node)
130 if ctx.phase() >= phases.secret:
129 if excluded:
131 excluded.append(node)
130 # update missing heads
132 else:
133 missing.append(node)
134 if len(missing) == len(allmissing):
135 missingheads = onlyheads
136 else: # update missing heads
131 missingheads = phases.newheads(repo, onlyheads, excluded)
137 missingheads = phases.newheads(repo, onlyheads, excluded)
132 else:
133 missingheads = onlyheads
134 og.missingheads = missingheads
138 og.missingheads = missingheads
135
136 if portable:
139 if portable:
137 # recompute common and missingheads as if -r<rev> had been given for
140 # recompute common and missingheads as if -r<rev> had been given for
138 # each head of missing, and --base <rev> for each head of the proper
141 # each head of missing, and --base <rev> for each head of the proper
@@ -266,9 +269,10 b' def visibleheads(repo):'
266 """return the set of visible head of this repo"""
269 """return the set of visible head of this repo"""
267 # XXX we want a cache on this
270 # XXX we want a cache on this
268 sroots = repo._phasecache.phaseroots[phases.secret]
271 sroots = repo._phasecache.phaseroots[phases.secret]
269 if sroots:
272 if sroots or repo.obsstore:
270 # XXX very slow revset. storing heads or secret "boundary" would help.
273 # XXX very slow revset. storing heads or secret "boundary"
271 revset = repo.set('heads(not (%ln::))', sroots)
274 # would help.
275 revset = repo.set('heads(not (%ln:: + extinct()))', sroots)
272
276
273 vheads = [ctx.node() for ctx in revset]
277 vheads = [ctx.node() for ctx in revset]
274 if not vheads:
278 if not vheads:
@@ -277,12 +281,13 b' def visibleheads(repo):'
277 vheads = repo.heads()
281 vheads = repo.heads()
278 return vheads
282 return vheads
279
283
284
280 def visiblebranchmap(repo):
285 def visiblebranchmap(repo):
281 """return a branchmap for the visible set"""
286 """return a branchmap for the visible set"""
282 # XXX Recomputing this data on the fly is very slow. We should build a
287 # XXX Recomputing this data on the fly is very slow. We should build a
283 # XXX cached version while computin the standard branchmap version.
288 # XXX cached version while computin the standard branchmap version.
284 sroots = repo._phasecache.phaseroots[phases.secret]
289 sroots = repo._phasecache.phaseroots[phases.secret]
285 if sroots:
290 if sroots or repo.obsstore:
286 vbranchmap = {}
291 vbranchmap = {}
287 for branch, nodes in repo.branchmap().iteritems():
292 for branch, nodes in repo.branchmap().iteritems():
288 # search for secret heads.
293 # search for secret heads.
@@ -290,12 +295,12 b' def visiblebranchmap(repo):'
290 if repo[n].phase() >= phases.secret:
295 if repo[n].phase() >= phases.secret:
291 nodes = None
296 nodes = None
292 break
297 break
293 # if secreat heads where found we must compute them again
298 # if secret heads were found we must compute them again
294 if nodes is None:
299 if nodes is None:
295 s = repo.set('heads(branch(%s) - secret())', branch)
300 s = repo.set('heads(branch(%s) - secret() - extinct())',
301 branch)
296 nodes = [c.node() for c in s]
302 nodes = [c.node() for c in s]
297 vbranchmap[branch] = nodes
303 vbranchmap[branch] = nodes
298 else:
304 else:
299 vbranchmap = repo.branchmap()
305 vbranchmap = repo.branchmap()
300 return vbranchmap
306 return vbranchmap
301
@@ -152,6 +152,7 b' Destination repo does not have any data'
152 ---------------------------------------
152 ---------------------------------------
153
153
154 Try to pull markers
154 Try to pull markers
155 (extinct changeset are excluded but marker are pushed)
155
156
156 $ hg init tmpc
157 $ hg init tmpc
157 $ cd tmpc
158 $ cd tmpc
@@ -161,7 +162,7 b' Try to pull markers'
161 adding changesets
162 adding changesets
162 adding manifests
163 adding manifests
163 adding file changes
164 adding file changes
164 added 6 changesets with 6 changes to 6 files (+3 heads)
165 added 4 changesets with 4 changes to 4 files (+1 heads)
165 (run 'hg heads' to see heads, 'hg merge' to merge)
166 (run 'hg heads' to see heads, 'hg merge' to merge)
166 $ hg debugobsolete
167 $ hg debugobsolete
167 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f 0 {'date': '56 12', 'user': 'test'}
168 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f 0 {'date': '56 12', 'user': 'test'}
@@ -179,9 +180,9 b' Rollback//Transaction support'
179 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
180 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
180 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
181 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
181 $ hg rollback -n
182 $ hg rollback -n
182 repository tip rolled back to revision 5 (undo debugobsolete)
183 repository tip rolled back to revision 3 (undo debugobsolete)
183 $ hg rollback
184 $ hg rollback
184 repository tip rolled back to revision 5 (undo debugobsolete)
185 repository tip rolled back to revision 3 (undo debugobsolete)
185 $ hg debugobsolete
186 $ hg debugobsolete
186 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f 0 {'date': '56 12', 'user': 'test'}
187 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f 0 {'date': '56 12', 'user': 'test'}
187 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
188 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
@@ -196,12 +197,6 b' Try to pull markers'
196 $ hg -R tmpb push tmpd
197 $ hg -R tmpb push tmpd
197 pushing to tmpd
198 pushing to tmpd
198 searching for changes
199 searching for changes
199 abort: push includes an obsolete changeset: ca819180edb9!
200 [255]
201 $ hg -R tmpd debugobsolete
202 $ hg -R tmpb push tmpd --rev 'not obsolete()'
203 pushing to tmpd
204 searching for changes
205 adding changesets
200 adding changesets
206 adding manifests
201 adding manifests
207 adding file changes
202 adding file changes
@@ -227,7 +222,7 b' On pull'
227 adding changesets
222 adding changesets
228 adding manifests
223 adding manifests
229 adding file changes
224 adding file changes
230 added 6 changesets with 6 changes to 6 files (+3 heads)
225 added 4 changesets with 4 changes to 4 files (+1 heads)
231 (run 'hg heads' to see heads, 'hg merge' to merge)
226 (run 'hg heads' to see heads, 'hg merge' to merge)
232 $ hg debugobsolete
227 $ hg debugobsolete
233 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
228 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
@@ -254,26 +249,15 b' On push'
254 detect outgoing obsolete and unstable
249 detect outgoing obsolete and unstable
255 ---------------------------------------
250 ---------------------------------------
256
251
252
257 $ hg glog
253 $ hg glog
258 o changeset: 5:5601fb93a350
254 o changeset: 3:5601fb93a350
259 | tag: tip
255 | tag: tip
260 | parent: 1:7c3bad9141dc
256 | parent: 1:7c3bad9141dc
261 | user: test
257 | user: test
262 | date: Thu Jan 01 00:00:00 1970 +0000
258 | date: Thu Jan 01 00:00:00 1970 +0000
263 | summary: add new_3_c
259 | summary: add new_3_c
264 |
260 |
265 | x changeset: 4:ca819180edb9
266 |/ parent: 1:7c3bad9141dc
267 | user: test
268 | date: Thu Jan 01 00:00:00 1970 +0000
269 | summary: add new_2_c
270 |
271 | x changeset: 3:cdbce2fbb163
272 |/ parent: 1:7c3bad9141dc
273 | user: test
274 | date: Thu Jan 01 00:00:00 1970 +0000
275 | summary: add new_c
276 |
277 | o changeset: 2:245bde4270cd
261 | o changeset: 2:245bde4270cd
278 |/ user: test
262 |/ user: test
279 | date: Thu Jan 01 00:00:00 1970 +0000
263 | date: Thu Jan 01 00:00:00 1970 +0000
@@ -289,21 +273,34 b' detect outgoing obsolete and unstable'
289 date: Thu Jan 01 00:00:00 1970 +0000
273 date: Thu Jan 01 00:00:00 1970 +0000
290 summary: add a
274 summary: add a
291
275
292 $ hg up -q 'desc("new_2_c")'
276 $ hg up 'desc("new_3_c")'
277 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 $ mkcommit original_d
278 $ mkcommit original_d
279 $ mkcommit original_e
280 $ hg debugobsolete `getid original_d` -d '0 0'
281 $ hg log -r 'obsolete()'
282 changeset: 4:7c694bff0650
283 user: test
284 date: Thu Jan 01 00:00:00 1970 +0000
285 summary: add original_d
286
294 $ hg glog -r '::unstable()'
287 $ hg glog -r '::unstable()'
295 @ changeset: 6:7878242aeece
288 @ changeset: 5:6e572121998e
296 | tag: tip
289 | tag: tip
297 | parent: 4:ca819180edb9
290 | user: test
291 | date: Thu Jan 01 00:00:00 1970 +0000
292 | summary: add original_e
293 |
294 x changeset: 4:7c694bff0650
298 | user: test
295 | user: test
299 | date: Thu Jan 01 00:00:00 1970 +0000
296 | date: Thu Jan 01 00:00:00 1970 +0000
300 | summary: add original_d
297 | summary: add original_d
301 |
298 |
302 x changeset: 4:ca819180edb9
299 o changeset: 3:5601fb93a350
303 | parent: 1:7c3bad9141dc
300 | parent: 1:7c3bad9141dc
304 | user: test
301 | user: test
305 | date: Thu Jan 01 00:00:00 1970 +0000
302 | date: Thu Jan 01 00:00:00 1970 +0000
306 | summary: add new_2_c
303 | summary: add new_3_c
307 |
304 |
308 o changeset: 1:7c3bad9141dc
305 o changeset: 1:7c3bad9141dc
309 | user: test
306 | user: test
@@ -315,18 +312,77 b' detect outgoing obsolete and unstable'
315 date: Thu Jan 01 00:00:00 1970 +0000
312 date: Thu Jan 01 00:00:00 1970 +0000
316 summary: add a
313 summary: add a
317
314
315
316 refuse to push obsolete changeset
317
318 $ hg push ../tmpc/ -r 'desc("original_d")'
319 pushing to ../tmpc/
320 searching for changes
321 abort: push includes an obsolete changeset: 7c694bff0650!
322 [255]
323
324 refuse to push unstable changeset
325
318 $ hg push ../tmpc/
326 $ hg push ../tmpc/
319 pushing to ../tmpc/
327 pushing to ../tmpc/
320 searching for changes
328 searching for changes
321 abort: push includes an unstable changeset: 7878242aeece!
329 abort: push includes an unstable changeset: 6e572121998e!
322 [255]
330 [255]
323
331
324 Test that extinct changeset are properly detected
332 Test that extinct changeset are properly detected
325
333
326 $ hg log -r 'extinct()'
334 $ hg log -r 'extinct()'
327 changeset: 3:cdbce2fbb163
335
336 Don't try to push extinct changeset
337
338 $ hg init ../tmpf
339 $ hg out ../tmpf
340 comparing with ../tmpf
341 searching for changes
342 changeset: 0:1f0dee641bb7
343 user: test
344 date: Thu Jan 01 00:00:00 1970 +0000
345 summary: add a
346
347 changeset: 1:7c3bad9141dc
348 user: test
349 date: Thu Jan 01 00:00:00 1970 +0000
350 summary: add b
351
352 changeset: 2:245bde4270cd
353 user: test
354 date: Thu Jan 01 00:00:00 1970 +0000
355 summary: add original_c
356
357 changeset: 3:5601fb93a350
328 parent: 1:7c3bad9141dc
358 parent: 1:7c3bad9141dc
329 user: test
359 user: test
330 date: Thu Jan 01 00:00:00 1970 +0000
360 date: Thu Jan 01 00:00:00 1970 +0000
331 summary: add new_c
361 summary: add new_3_c
362
363 changeset: 4:7c694bff0650
364 user: test
365 date: Thu Jan 01 00:00:00 1970 +0000
366 summary: add original_d
367
368 changeset: 5:6e572121998e
369 tag: tip
370 user: test
371 date: Thu Jan 01 00:00:00 1970 +0000
372 summary: add original_e
332
373
374 $ hg push ../tmpf -f # -f because be push unstable too
375 pushing to ../tmpf
376 searching for changes
377 adding changesets
378 adding manifests
379 adding file changes
380 added 6 changesets with 6 changes to 6 files (+1 heads)
381
382 no warning displayed
383
384 $ hg push ../tmpf
385 pushing to ../tmpf
386 searching for changes
387 no changes found
388 [1]
General Comments 0
You need to be logged in to leave comments. Login now