1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Detect library conflicts in Arcanist and raise a very specific error message

Summary:
When you run one copy of arcanist against another copy, you previously got a
meaningless error. After D311 you get a slightly more meaningful error.

Capture the new exception and raise an extremely specific error.

NOTE: Adding arcanist to .arcconfig forces the library conflict error to
trigger; otherwise there's just an implicit conflict because 'arc' reads the
running-copy library amp instead of the working-copy library map. This only
worked before because arcanist includes itself.

Test Plan:
Ran arcanist on a different copy of arcanist, got a good error message.

Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, jungejason, epriestley
Differential Revision: 312
This commit is contained in:
epriestley 2011-05-19 10:13:44 -07:00
parent 292c995d57
commit 7e4bde114e
2 changed files with 18 additions and 1 deletions

View file

@ -4,5 +4,8 @@
"lint_engine" : "PhutilLintEngine", "lint_engine" : "PhutilLintEngine",
"unit_engine" : "PhutilUnitTestEngine", "unit_engine" : "PhutilUnitTestEngine",
"remote_hooks_installed" : true, "remote_hooks_installed" : true,
"copyright_holder" : "Facebook, Inc." "copyright_holder" : "Facebook, Inc.",
"phutil_libraries" : {
"arcanist" : "src/"
}
} }

View file

@ -100,6 +100,20 @@ try {
$name, $name,
$location); $location);
throw new ArcanistUsageException($error_msg); throw new ArcanistUsageException($error_msg);
} catch (PhutilLibraryConflictException $ex) {
if ($ex->getLibrary() != 'arcanist') {
throw $ex;
}
$arc_dir = dirname(dirname(__FILE__));
$error_msg =
"You are trying to run one copy of Arcanist on another copy of ".
"Arcanist. This operation is not supported. To execute Arcanist ".
"operations against this working copy, run './bin/arc' (from the ".
"current working copy) not some other copy of 'arc' (you ran one ".
"from '{$arc_dir}').";
throw new ArcanistUsageException($error_msg);
} }
} }
} }