return 'git';
}
+ public function getMetadataPath() {
+ return $this->getPath('.git');
+ }
+
public function getHasCommits() {
return !$this->repositoryHasNoCommits;
}
if ($default_relative) {
$this->relativeExplanation =
"it is the merge-base of '{$default_relative}' and HEAD, as ".
- "specified in '.arc/default-relative-commit'.";
+ "specified in '.git/arc/default-relative-commit'.";
}
}
abstract public function supportsRelativeLocalCommits();
abstract public function getWorkingCopyRevision();
abstract public function updateWorkingCopy();
+ abstract public function getMetadataPath();
abstract public function loadWorkingCopyDifferentialRevisions(
ConduitClient $conduit,
array $query);
* @task scratch
*/
public function getScratchFilePath($path) {
- return $this->getPath('.arc/'.$path);
+ $new_scratch_path = Filesystem::resolvePath(
+ 'arc',
+ $this->getMetadataPath());
+
+ static $checked = false;
+ if (!$checked) {
+ $checked = true;
+ $old_scratch_path = $this->getPath('.arc');
+ // we only want to do the migration once
+ // unfortunately, people have checked in .arc directories which
+ // means that the old one may get recreated after we delete it
+ if (Filesystem::pathExists($old_scratch_path) &&
+ !Filesystem::pathExists($new_scratch_path)) {
+ Filesystem::createDirectory($new_scratch_path);
+ $existing_files = Filesystem::listDirectory($old_scratch_path, true);
+ foreach ($existing_files as $file) {
+ $new_path = Filesystem::resolvePath($file, $new_scratch_path);
+ $old_path = Filesystem::resolvePath($file, $old_scratch_path);
+ Filesystem::writeFile(
+ $new_path,
+ Filesystem::readFile($old_path));
+ }
+ Filesystem::remove($old_scratch_path);
+ }
+ }
+ return Filesystem::resolvePath($path, $new_scratch_path);
}
}