private $status;
private $relativeCommit = null;
- private $relativeExplanation = '???';
private $repositoryHasNoCommits = false;
const SEARCH_LENGTH_FOR_PARENT_REVISIONS = 16;
$this->relativeCommit = self::GIT_MAGIC_ROOT_COMMIT;
if ($this->repositoryHasNoCommits) {
- $this->relativeExplanation = "the repository has no commits.";
+ $this->setBaseCommitExplanation(
+ "the repository has no commits.");
} else {
- $this->relativeExplanation = "the repository has only one commit.";
+ $this->setBaseCommitExplanation(
+ "the repository has only one commit.");
}
return $this->relativeCommit;
if ($working_copy) {
$default_relative = $working_copy->getConfig(
'git.default-relative-commit');
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the merge-base of '{$default_relative}' and HEAD, as ".
"specified in 'git.default-relative-commit' in '.arcconfig'. This ".
- "setting overrides other settings.";
+ "setting overrides other settings.");
}
if (!$default_relative) {
if (!$err) {
$default_relative = trim($upstream);
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the merge-base of '{$default_relative}' (the Git upstream ".
- "of the current branch) HEAD.";
+ "of the current branch) HEAD.");
}
}
$default_relative = $this->readScratchFile('default-relative-commit');
$default_relative = trim($default_relative);
if ($default_relative) {
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the merge-base of '{$default_relative}' and HEAD, as ".
- "specified in '.git/arc/default-relative-commit'.";
+ "specified in '.git/arc/default-relative-commit'.");
}
}
// Don't perform this write until we've verified that the object is a
// valid commit name.
$this->writeScratchFile('default-relative-commit', $default_relative);
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the merge-base of '{$default_relative}' and HEAD, as you ".
- "just specified.";
+ "just specified.");
}
list($merge_base) = $this->execxLocal(
$base = reset($argv);
if ($base == ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT) {
$merge_base = $base;
- $this->relativeExplanation =
- "you explicitly specified the empty tree.";
+ $this->setBaseCommitExplanation(
+ "you explicitly specified the empty tree.");
} else {
list($err, $merge_base) = $this->execManualLocal(
'merge-base %s HEAD',
throw new ArcanistUsageException(
"Unable to find any git commit named '{$base}' in this repository.");
}
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the merge-base of '{$base}' and HEAD, as you explicitly ".
- "specified.";
+ "specified.");
}
$this->setRelativeCommit(trim($merge_base));
}
$this->execxLocal('pull');
}
- public function getRelativeExplanation() {
- return $this->relativeExplanation;
- }
-
public function getCommitSummary($commit) {
if ($commit == self::GIT_MAGIC_ROOT_COMMIT) {
return '(The Empty Tree)';
private $status;
private $base;
private $relativeCommit;
- private $relativeExplanation;
private $workingCopyRevision;
private $localCommitInfo;
private $includeDirectoryStateInDiffs;
if (!$logs) {
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"you have no outgoing commits, so arc assumes you intend to submit ".
- "uncommitted changes in the working copy.";
+ "uncommitted changes in the working copy.");
// In Mercurial, we support operations against uncommitted changes.
$this->setRelativeCommit($this->getWorkingCopyRevision());
return $this->relativeCommit;
}
if ($against == 'null') {
- $this->relativeExplanation =
- "this is a new repository (all changes are outgoing).";
+ $this->setBaseCommitExplanation(
+ "this is a new repository (all changes are outgoing).");
} else {
- $this->relativeExplanation =
+ $this->setBaseCommitExplanation(
"it is the first commit reachable from the working copy state ".
- "which is not outgoing.";
+ "which is not outgoing.");
}
$this->setRelativeCommit($against);
throw new ArcanistUsageException("Specify only one commit.");
}
- $this->relativeExplanation = "you explicitly specified it.";
+ $this->setBaseCommitExplanation("you explicitly specified it.");
// This does the "hg id" call we need to normalize/validate the revision
// identifier.
$this->localCommitInfo = null;
}
- public function getRelativeExplanation() {
- return $this->relativeExplanation;
- }
-
public function getCommitSummary($commit) {
if ($commit == 'null') {
return '(The Empty Void)';
protected $path;
protected $diffLinesOfContext = 0x7FFF;
+ private $baseCommitExplanation = '???';
private $workingCopyIdentity;
abstract public function getSourceControlSystemName();
throw new ArcanistCapabilityNotSupportedException($this);
}
- public function getRelativeExplanation() {
- throw new ArcanistCapabilityNotSupportedException($this);
+ public function getBaseCommitExplanation() {
+ return $this->baseCommitExplanation;
+ }
+
+ public function setBaseCommitExplanation($explanation) {
+ $this->baseCommitExplanation = $explanation;
+ return $this;
}
public function getCommitSummary($commit) {