protected $path;
protected $diffLinesOfContext = 0x7FFF;
+ private $workingCopyIdentity;
abstract public function getSourceControlSystemName();
return $this;
}
+ public function getWorkingCopyIdentity() {
+ return $this->workingCopyIdentity;
+ }
+
public static function newAPIFromWorkingCopyIdentity(
ArcanistWorkingCopyIdentity $working_copy) {
// check if we're in an svn working copy
list($err) = exec_manual('svn info');
if (!$err) {
- return newv('ArcanistSubversionAPI', array($root));
+ $api = newv('ArcanistSubversionAPI', array($root));
+ $api->workingCopyIdentity = $working_copy;
+ return $api;
}
if (Filesystem::pathExists($root.'/.hg')) {
- return newv('ArcanistMercurialAPI', array($root));
+ $api = newv('ArcanistMercurialAPI', array($root));
+ $api->workingCopyIdentity = $working_copy;
+ return $api;
}
$git_root = self::discoverGitBaseDirectory($root);
"is '{$git_root}'. Move '.arcconfig' file to the working copy root.");
}
- return newv('ArcanistGitAPI', array($root));
+ $api = newv('ArcanistGitAPI', array($root));
+ $api->workingCopyIdentity = $working_copy;
+ return $api;
}
throw new ArcanistUsageException(
$default_relative = $this->readScratchFile('default-relative-commit');
$do_write = false;
+
+ if (!$default_relative) {
+ $working_copy = $this->getWorkingCopyIdentity();
+ if ($working_copy) {
+ $default_relative = $working_copy->getConfig(
+ 'git.default-relative-commit');
+ }
+ }
+
if (!$default_relative) {
// TODO: Remove the history lesson soon.