Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15409188
D12893.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12893.diff
View Options
diff --git a/scripts/repository/save_lint.php b/scripts/repository/save_lint.php
--- a/scripts/repository/save_lint.php
+++ b/scripts/repository/save_lint.php
@@ -17,35 +17,38 @@
->parse(array(
array(
'name' => 'all',
- 'help' =>
+ 'help' => pht(
'Discover problems in the whole repository instead of just changes '.
- 'since the last run.',
+ 'since the last run.'),
),
array(
'name' => 'arc',
'param' => 'path',
'default' => 'arc',
- 'help' => 'Path to Arcanist executable.',
+ 'help' => pht('Path to Arcanist executable.'),
),
array(
'name' => 'severity',
'param' => 'string',
'default' => ArcanistLintSeverity::SEVERITY_ADVICE,
- 'help' => 'Minimum severity, one of ArcanistLintSeverity constants.',
+ 'help' => pht(
+ 'Minimum severity, one of %s constants.',
+ 'ArcanistLintSeverity'),
),
array(
'name' => 'chunk-size',
'param' => 'number',
'default' => 256,
- 'help' => 'Number of paths passed to `arc` at once.',
+ 'help' => pht('Number of paths passed to `%s` at once.', 'arc'),
),
array(
'name' => 'blame',
- 'help' => 'Assign lint errors to authors who last modified the line.',
+ 'help' => pht(
+ 'Assign lint errors to authors who last modified the line.'),
),
));
-echo "Saving lint errors to database...\n";
+echo pht('Saving lint errors to database...')."\n";
$count = id(new DiffusionLintSaveRunner())
->setAll($args->getArg('all', false))
@@ -55,4 +58,4 @@
->setNeedsBlame($args->getArg('blame'))
->run('.');
-echo "\nProcessed {$count} files.\n";
+echo "\n".pht('Processed %d files.', $count)."\n";
diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php
--- a/src/applications/diffusion/DiffusionLintSaveRunner.php
+++ b/src/applications/diffusion/DiffusionLintSaveRunner.php
@@ -58,17 +58,31 @@
}
}
- $project_id = $working_copy->getProjectID();
- $project = id(new PhabricatorRepositoryArcanistProject())
- ->loadOneWhere('name = %s', $project_id);
- if (!$project || !$project->getRepositoryID()) {
- throw new Exception("Couldn't find repository for {$project_id}.");
+ $callsign = $configuration_manager->getConfigFromAnySource(
+ 'repository.callsign');
+ $uuid = $api->getRepositoryUUID();
+ $remote_uri = $api->getRemoteURI();
+
+ $repository_query = id(new PhabricatorRepositoryQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser());
+
+ if ($callsign) {
+ $repository_query->withCallsigns(array($callsign));
+ } else if ($uuid) {
+ $repository_query->withUUIDs(array($uuid));
+ } else if ($remote_uri) {
+ $repository_query->withRemoteURIs(array($remote_uri));
}
+ $repository = $repository_query->executeOne();
$branch_name = $api->getBranchName();
+ if (!$repository) {
+ throw new Exception(pht('No repository was found.'));
+ }
+
$this->branch = PhabricatorRepositoryBranch::loadOrCreateBranch(
- $project->getRepositoryID(),
+ $repository->getID(),
$branch_name);
$this->conn = $this->branch->establishConnection('w');
diff --git a/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php
--- a/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php
@@ -12,15 +12,15 @@
}
public function getMethodDescription() {
- return 'Get lint messages for existing code.';
+ return pht('Get lint messages for existing code.');
}
protected function defineParamTypes() {
return array(
- 'arcanistProject' => 'required string',
- 'branch' => 'optional string',
- 'commit' => 'optional string',
- 'files' => 'required list<string>',
+ 'repositoryPHID' => 'required phid',
+ 'branch' => 'required string',
+ 'commit' => 'optional string',
+ 'files' => 'required list<string>',
);
}
@@ -29,25 +29,31 @@
}
protected function execute(ConduitAPIRequest $request) {
- $project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere(
- 'name = %s',
- $request->getValue('arcanistProject'));
- if (!$project || !$project->getRepositoryID()) {
- return array();
+ $viewer = $request->getUser();
+
+ $repository_phid = $request->getValue('repositoryPHID');
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
+
+ if (!$repository) {
+ throw new Exception(
+ pht('No repository exists with PHID "%s".', $repository_phid));
}
$branch_name = $request->getValue('branch');
if ($branch_name == '') {
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
- ->withIDs(array($project->getRepositoryID()))
+ ->withIDs(array($repository->getID()))
->executeOne();
$branch_name = $repository->getDefaultArcanistBranch();
}
$branch = id(new PhabricatorRepositoryBranch())->loadOneWhere(
'repositoryID = %d AND name = %s',
- $project->getRepositoryID(),
+ $repository->getID(),
$branch_name);
if (!$branch || !$branch->getLintCommit()) {
return array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 3:34 AM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7698824
Default Alt Text
D12893.diff (5 KB)
Attached To
Mode
D12893: Change "lint save" to not use Arcanist Projects
Attached
Detach File
Event Timeline
Log In to Comment