Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistLandEngine.php
Show First 20 Lines • Show All 1,251 Lines • ▼ Show 20 Lines | try { | ||||
$should_push = false; | $should_push = false; | ||||
} else if ($is_incremental) { | } else if ($is_incremental) { | ||||
$should_push = true; | $should_push = true; | ||||
} else { | } else { | ||||
$is_last = ($set_key === $last_key); | $is_last = ($set_key === $last_key); | ||||
$should_push = $is_last; | $should_push = $is_last; | ||||
} | } | ||||
if ($should_push) { | if ($should_push === false) { | ||||
break; | |||||
} | |||||
cspeckmim: The number of scope/blocks was tripping me up a little so I inverted this condition to break… | |||||
try { | try { | ||||
$this->pushChange($into_commit); | $this->pushChange($into_commit); | ||||
$this->setHasUnpushedChanges(false); | $this->setHasUnpushedChanges(false); | ||||
} catch (ArcanistLandPushFailureException $ex) { | } catch (ArcanistLandPushFailureException $ex) { | ||||
// TODO: If the push fails, fetch and retry if the remote ref | // TODO: If the push fails, fetch and retry if the remote ref | ||||
Lint: TODO Comment This comment has a TODO. Lint: TODO Comment: This comment has a TODO. | |||||
// has moved ahead of us. | // has moved ahead of us. | ||||
if ($this->getIntoLocal()) { | if ($this->getIntoLocal()) { | ||||
$can_retry = false; | $can_retry = false; | ||||
} else if ($this->getIntoEmpty()) { | } else if ($this->getIntoEmpty()) { | ||||
$can_retry = false; | $can_retry = false; | ||||
} else if ($this->getIntoRemote() !== $this->getOntoRemote()) { | } else if ($this->getIntoRemote() !== $this->getOntoRemote()) { | ||||
$can_retry = false; | $can_retry = false; | ||||
} else { | } else { | ||||
$can_retry = false; | $can_retry = false; | ||||
} | } | ||||
if ($can_retry) { | if ($can_retry) { | ||||
// New commit state here | // New commit state here | ||||
$into_commit = '..'; | $into_commit = '..'; | ||||
continue; | continue; | ||||
} | } | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
$ex->getMessage()); | $ex->getMessage()); | ||||
} | } | ||||
if ($need_cascade) { | if ($need_cascade) { | ||||
// NOTE: We cascade each set we've pushed, but we're going to | // NOTE: We cascade each set we've pushed, but we're going to | ||||
// cascade them from most recent to least recent. This way, | // cascade them from most recent to least recent. This way, | ||||
// branches which descend from more recent changes only cascade | // branches which descend from more recent changes only cascade | ||||
// once, directly in to the correct state. | // once, directly in to the correct state. | ||||
$need_cascade = array_reverse($need_cascade); | $need_cascade = array_reverse($need_cascade); | ||||
foreach ($need_cascade as $cascade_set) { | foreach ($need_cascade as $cascade_set) { | ||||
$this->cascadeState($set, $into_commit); | $this->cascadeState($cascade_set, $into_commit); | ||||
cspeckmimAuthorUnsubmitted Done Inline ActionsCoincidentally someone ran into this issue yesterday evening completely unrelated to discussion in D21680#inline-60963. Fortunately we were able to resurrect their missing commits from .hg/strip-backup without too much issue. cspeckmim: Coincidentally someone ran into this issue yesterday evening completely unrelated to discussion… | |||||
} | } | ||||
$need_cascade = array(); | $need_cascade = array(); | ||||
} | } | ||||
if (!$is_keep) { | if (!$is_keep) { | ||||
$this->pruneBranches($need_prune); | $this->pruneBranches($need_prune); | ||||
$need_prune = array(); | $need_prune = array(); | ||||
} | } | ||||
} | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if ($is_hold) { | if ($is_hold) { | ||||
$this->didHoldChanges($into_commit); | $this->didHoldChanges($into_commit); | ||||
$local_state->discardLocalState(); | $local_state->discardLocalState(); | ||||
▲ Show 20 Lines • Show All 304 Lines • Show Last 20 Lines |
The number of scope/blocks was tripping me up a little so I inverted this condition to break early allowing the rest of the code in this loop to be indented one level less. I don't feel too strong about this so if preferred I can revert the change.