##// END OF EJS Templates
checkheads: extract obsolete post processing in its own function...
Pierre-Yves David -
r31586:df82f375 default
parent child Browse files
Show More
@@ -343,38 +343,13 b' def checkheads(pushop):'
343 343 oldhs.update(unsyncedheads)
344 344 candidate_newhs.update(unsyncedheads)
345 345 dhs = None # delta heads, the new heads on branch
346 discardedheads = set()
347 346 if not repo.obsstore:
347 discardedheads = set()
348 348 newhs = candidate_newhs
349 349 else:
350 # remove future heads which are actually obsoleted by another
351 # pushed element:
352 #
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)
350 newhs, discardedheads = _postprocessobsolete(pushop,
351 allfuturecommon,
352 candidate_newhs)
378 353 unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
379 354 if unsynced:
380 355 if None in unsynced:
@@ -434,3 +409,42 b' def checkheads(pushop):'
434 409 repo.ui.note((" %s\n") % short(h))
435 410 if errormsg:
436 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