Skip to content

Instantly share code, notes, and snippets.

@yiding
Created June 9, 2014 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yiding/0c6779fbca92282ce7a1 to your computer and use it in GitHub Desktop.
Save yiding/0c6779fbca92282ce7a1 to your computer and use it in GitHub Desktop.
phabricator basic stgit compatibility
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index ba7adb4..8c4031c 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -157,6 +157,7 @@ phutil_register_library_map(array(
'ArcanistSpellingDefaultData' => 'lint/linter/spelling/ArcanistSpellingDefaultData.php',
'ArcanistSpellingLinter' => 'lint/linter/ArcanistSpellingLinter.php',
'ArcanistSpellingLinterTestCase' => 'lint/linter/__tests__/ArcanistSpellingLinterTestCase.php',
+ 'ArcanistStgitAPI' => 'repository/api/ArcanistStgitAPI.php',
'ArcanistSubversionAPI' => 'repository/api/ArcanistSubversionAPI.php',
'ArcanistSubversionHookAPI' => 'repository/hookapi/ArcanistSubversionHookAPI.php',
'ArcanistSvnHookPreCommitWorkflow' => 'workflow/ArcanistSvnHookPreCommitWorkflow.php',
@@ -323,6 +324,7 @@ phutil_register_library_map(array(
'ArcanistSingleLintEngine' => 'ArcanistLintEngine',
'ArcanistSpellingLinter' => 'ArcanistLinter',
'ArcanistSpellingLinterTestCase' => 'ArcanistArcanistLinterTestCase',
+ 'ArcanistStgitAPI' => 'ArcanistGitAPI',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php
index 45bae42..f2d973a 100644
--- a/src/repository/api/ArcanistGitAPI.php
+++ b/src/repository/api/ArcanistGitAPI.php
@@ -5,7 +5,7 @@
*
* @group workingcopy
*/
-final class ArcanistGitAPI extends ArcanistRepositoryAPI {
+class ArcanistGitAPI extends ArcanistRepositoryAPI {
private $repositoryHasNoCommits = false;
const SEARCH_LENGTH_FOR_PARENT_REVISIONS = 16;
diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php
index 69a89b5..191c8c4 100644
--- a/src/repository/api/ArcanistRepositoryAPI.php
+++ b/src/repository/api/ArcanistRepositoryAPI.php
@@ -76,7 +76,13 @@ abstract class ArcanistRepositoryAPI {
$api = new ArcanistMercurialAPI($root);
break;
case 'git':
- $api = new ArcanistGitAPI($root);
+ list($code, $out, $err) = exec_manual('stg series');
+ if ($code == 0) {
+ echo "using stg\n";
+ $api = new ArcanistStgitAPI($root);
+ } else {
+ $api = new ArcanistGitAPI($root);
+ }
break;
default:
throw new Exception(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment