Show More
@@ -343,38 +343,13 b' def checkheads(pushop):' | |||||
343 | oldhs.update(unsyncedheads) |
|
343 | oldhs.update(unsyncedheads) | |
344 | candidate_newhs.update(unsyncedheads) |
|
344 | candidate_newhs.update(unsyncedheads) | |
345 | dhs = None # delta heads, the new heads on branch |
|
345 | dhs = None # delta heads, the new heads on branch | |
346 | discardedheads = set() |
|
|||
347 | if not repo.obsstore: |
|
346 | if not repo.obsstore: | |
|
347 | discardedheads = set() | |||
348 | newhs = candidate_newhs |
|
348 | newhs = candidate_newhs | |
349 | else: |
|
349 | else: | |
350 | # remove future heads which are actually obsoleted by another |
|
350 | newhs, discardedheads = _postprocessobsolete(pushop, | |
351 | # pushed element: |
|
351 | allfuturecommon, | |
352 | # |
|
352 | candidate_newhs) | |
353 | # XXX as above, There are several cases this code does not handle |
|
|||
354 | # XXX properly |
|
|||
355 | # |
|
|||
356 | # (1) if <nh> is public, it won't be affected by obsolete marker |
|
|||
357 | # and a new is created |
|
|||
358 | # |
|
|||
359 | # (2) if the new heads have ancestors which are not obsolete and |
|
|||
360 | # not ancestors of any other heads we will have a new head too. |
|
|||
361 | # |
|
|||
362 | # These two cases will be easy to handle for known changeset but |
|
|||
363 | # much more tricky for unsynced changes. |
|
|||
364 | # |
|
|||
365 | # In addition, this code is confused by prune as it only looks for |
|
|||
366 | # successors of the heads (none if pruned) leading to issue4354 |
|
|||
367 | newhs = set() |
|
|||
368 | for nh in candidate_newhs: |
|
|||
369 | if nh in repo and repo[nh].phase() <= phases.public: |
|
|||
370 | newhs.add(nh) |
|
|||
371 | else: |
|
|||
372 | for suc in obsolete.allsuccessors(repo.obsstore, [nh]): |
|
|||
373 | if suc != nh and suc in allfuturecommon: |
|
|||
374 | discardedheads.add(nh) |
|
|||
375 | break |
|
|||
376 | else: |
|
|||
377 | newhs.add(nh) |
|
|||
378 | unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) |
|
353 | unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) | |
379 | if unsynced: |
|
354 | if unsynced: | |
380 | if None in unsynced: |
|
355 | if None in unsynced: | |
@@ -434,3 +409,42 b' def checkheads(pushop):' | |||||
434 | repo.ui.note((" %s\n") % short(h)) |
|
409 | repo.ui.note((" %s\n") % short(h)) | |
435 | if errormsg: |
|
410 | if errormsg: | |
436 | raise error.Abort(errormsg, hint=hint) |
|
411 | raise error.Abort(errormsg, hint=hint) | |
|
412 | ||||
|
413 | def _postprocessobsolete(pushop, futurecommon, candidate_newhs): | |||
|
414 | """post process the list of new heads with obsolescence information | |||
|
415 | ||||
|
416 | Exists as a subfunction to contain the complexity and allow extensions to | |||
|
417 | experiment with smarter logic. | |||
|
418 | Returns (newheads, discarded_heads) tuple | |||
|
419 | """ | |||
|
420 | # remove future heads which are actually obsoleted by another | |||
|
421 | # pushed element: | |||
|
422 | # | |||
|
423 | # XXX as above, There are several cases this code does not handle | |||
|
424 | # XXX properly | |||
|
425 | # | |||
|
426 | # (1) if <nh> is public, it won't be affected by obsolete marker | |||
|
427 | # and a new is created | |||
|
428 | # | |||
|
429 | # (2) if the new heads have ancestors which are not obsolete and | |||
|
430 | # not ancestors of any other heads we will have a new head too. | |||
|
431 | # | |||
|
432 | # These two cases will be easy to handle for known changeset but | |||
|
433 | # much more tricky for unsynced changes. | |||
|
434 | # | |||
|
435 | # In addition, this code is confused by prune as it only looks for | |||
|
436 | # successors of the heads (none if pruned) leading to issue4354 | |||
|
437 | repo = pushop.repo | |||
|
438 | newhs = set() | |||
|
439 | discarded = set() | |||
|
440 | for nh in candidate_newhs: | |||
|
441 | if nh in repo and repo[nh].phase() <= phases.public: | |||
|
442 | newhs.add(nh) | |||
|
443 | else: | |||
|
444 | for suc in obsolete.allsuccessors(repo.obsstore, [nh]): | |||
|
445 | if suc != nh and suc in futurecommon: | |||
|
446 | discarded.add(nh) | |||
|
447 | break | |||
|
448 | else: | |||
|
449 | newhs.add(nh) | |||
|
450 | return newhs, discarded |
General Comments 0
You need to be logged in to leave comments.
Login now