in src/flow/workflow/ICSyncWorkflow.php [66:146]
public function run() {
$default_branch = $this->getDefaultRemoteBranch();
$dependencies = $this->getArgument('dependencies', false);
$revisions = $this->getArgument('revisions', false);
$branch = idx($this->getArgument('branch', false), 0, $default_branch);
if (!$dependencies && !$revisions) {
$dependencies = true;
$revisions = true;
}
$this->setRootBranch($branch);
$graph = $this->loadGitBranchGraph();
$this->drawFlowTree();
if ($dependencies && $this->consoleConfirm(tsprintf(
'Each branch appearing in the graph above and meeting these two '.
'criteria will have at least one dependency assigned to it on '.
"differential.\n\n".
' - Branch has a differential revision associated with it.'.PHP_EOL.
' - Branch\'s parent also has a revision associated.'.
"\n\nFurthermore, all existing dependencies of any updated revisions ".
'will be removed. Please review the graph carefully.'.
"\n\nProceed assigning dependencies?"))) {
$parents = array();
foreach ($graph->getNodesInTopologicalOrder() as $branch_name) {
$feature = $this->getFeature($branch_name);
if (!$feature || ($graph->getDepth($branch_name) < 2)) {
continue;
}
$parent_branch = $graph->getUpstream($branch_name);
if ($parent_feature = $this->getFeature($parent_branch)) {
// do not add yourself as dependency
if ($parent_feature->getRevisionPHID() !=
$feature->getRevisionPHID()) {
$parents[$feature->getRevisionPHID()][] =
$parent_feature->getRevisionPHID();
}
}
}
$calls = array();
foreach ($parents as $revision_phid => $depends_on) {
$calls[] = $this->getConduit()->callMethod('differential.revision.edit',
array(
'objectIdentifier' => $revision_phid,
'transactions' => array(
array('type' => 'parents.set', 'value' => $depends_on),
),
));
}
foreach (new FutureIterator($calls) as $call) {
$call->resolve();
}
$this->writeInfo("Dependencies updated", '');
}
if ($revisions) {
$extra_diff_args = array();
if ($this->getArgument('no-unit')) {
$extra_diff_args[] = '--no-unit';
}
if ($this->getArgument('no-lint')) {
$extra_diff_args[] = '--no-lint';
}
if ($this->getArgument('plan-changes')) {
$extra_diff_args[] = '--plan-changes';
}
if ($this->getArgument('excuse')) {
$extra_diff_args[] = '--excuse';
$extra_diff_args[] = $this->getArgument('excuse');
}
if ($this->getArgument('noautoland')) {
$extra_diff_args[] = '--noautoland';
}
$this->runRevisionSync($extra_diff_args);
}
return 0;
}