Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/DiffusionLintSaveRunner.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public function run($dir) { | ||||
| if ($api instanceof ArcanistGitAPI) { | if ($api instanceof ArcanistGitAPI) { | ||||
| $svn_fetch = $api->getGitConfig('svn-remote.svn.fetch'); | $svn_fetch = $api->getGitConfig('svn-remote.svn.fetch'); | ||||
| list($this->svnRoot) = explode(':', $svn_fetch); | list($this->svnRoot) = explode(':', $svn_fetch); | ||||
| if ($this->svnRoot != '') { | if ($this->svnRoot != '') { | ||||
| $this->svnRoot = '/'.$this->svnRoot; | $this->svnRoot = '/'.$this->svnRoot; | ||||
| } | } | ||||
| } | } | ||||
| $project_id = $working_copy->getProjectID(); | $callsign = $configuration_manager->getConfigFromAnySource( | ||||
| $project = id(new PhabricatorRepositoryArcanistProject()) | 'repository.callsign'); | ||||
| ->loadOneWhere('name = %s', $project_id); | $uuid = $api->getRepositoryUUID(); | ||||
| if (!$project || !$project->getRepositoryID()) { | $remote_uri = $api->getRemoteURI(); | ||||
| throw new Exception("Couldn't find repository for {$project_id}."); | |||||
| $repository_query = id(new PhabricatorRepositoryQuery()) | |||||
| ->setViewer(PhabricatorUser::getOmnipotentUser()); | |||||
joshuaspence: Maybe this should be changed to be `$this->actor` and then the omnipotent user is set via… | |||||
Not Done Inline ActionsIn the long run, the design of this is weird, anyway, in the context of modern CLI scripts. I think we should move it into bin at some point and make it (CLI) Workflow-based (e.g., bin/repository import-symbols), when it gets a getViewer() automatically (which just evaluates to the omnipotent user). Fixing it up in advance of that is fine, but maybe not worth bothering with. epriestley: In the long run, the design of this is weird, anyway, in the context of modern CLI scripts. I… | |||||
| 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(); | $branch_name = $api->getBranchName(); | ||||
| if (!$repository) { | |||||
| throw new Exception(pht('No repository was found.')); | |||||
| } | |||||
| $this->branch = PhabricatorRepositoryBranch::loadOrCreateBranch( | $this->branch = PhabricatorRepositoryBranch::loadOrCreateBranch( | ||||
| $project->getRepositoryID(), | $repository->getID(), | ||||
| $branch_name); | $branch_name); | ||||
| $this->conn = $this->branch->establishConnection('w'); | $this->conn = $this->branch->establishConnection('w'); | ||||
| $this->lintCommit = null; | $this->lintCommit = null; | ||||
| if (!$this->all) { | if (!$this->all) { | ||||
| $this->lintCommit = $this->branch->getLintCommit(); | $this->lintCommit = $this->branch->getLintCommit(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||
Maybe this should be changed to be $this->actor and then the omnipotent user is set via setActor.