in src/workflow/ArcanistDiffWorkflow.php [1641:1739]
private function buildCommitMessage() {
if ($this->getArgument('preview') || $this->getArgument('only')) {
return null;
}
$is_create = $this->getArgument('create');
$is_update = $this->getArgument('update');
$is_raw = $this->isRawDiffSource();
$is_message = $this->getArgument('use-commit-message');
$is_verbatim = $this->getArgument('verbatim');
if ($is_message) {
return $this->getCommitMessageFromCommit($is_message);
}
if ($is_verbatim) {
return $this->getCommitMessageFromUser();
}
$revision = null;
if (!$is_raw && !$is_create && !$is_update) {
$repository_api = $this->getRepositoryAPI();
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions(
$this->getConduit(),
array(
'authors' => array($this->getUserPHID()),
'status' => 'status-open',
));
if (!$revisions) {
$is_create = true;
} else if (count($revisions) == 1) {
$revision = head($revisions);
$is_update = $revision['id'];
} else {
throw new ArcanistUsageException(
pht(
"There are several revisions which match the working copy:\n\n%s\n".
"Use '%s' to choose one, or '%s' to create a new revision.",
$this->renderRevisionList($revisions),
'--update',
'--create'));
}
}
$message = null;
if ($is_create) {
$message_file = $this->getArgument('message-file');
if ($message_file) {
return $this->getCommitMessageFromFile($message_file);
} else {
return $this->getCommitMessageFromUser();
}
} else if ($is_update) {
$revision_id = $this->normalizeRevisionID($is_update);
if (!is_numeric($revision_id)) {
throw new ArcanistUsageException(
pht(
'Parameter to %s must be a Differential Revision number.',
'--update'));
}
// UBER CODE
if ($this->commonPrePromptChecks()) {
$revision_for_fields = $revision;
// Try load revision data if it does not exist.
if ($revision_for_fields === null && $is_update) {
$repository_api = $this->getRepositoryAPI();
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions(
$this->getConduit(),
array(
'authors' => array($this->getUserPHID()),
'status' => 'status-open',
));
foreach ($revisions as $rev) {
if ($rev['id'] == $revision_id) {
$revision_for_fields = $rev;
break;
}
}
}
// This value should not be null. But if execution path exist when it is
// then just skip the validation.
if ($revision_for_fields) {
$affected_paths = $this->selectPathsForWorkflow(array(), null);
id(new UberMandatoryFields($this))->validateRevision(
$revision_for_fields, $affected_paths);
}
}
// UBER CODE END
return $this->getCommitMessageFromRevision($revision_id);
} else {
// This is --raw without enough info to create a revision, so force just
// a diff.
return null;
}
}