From 9a2c68fd8848b28cde1bd3761554cb6f3bf89378 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 May 2014 13:51:45 -0700 Subject: [PATCH] Rename "stableCommitName" to "stableCommit" Summary: Ref T2683. This is closely related to "symbolicCommit", but has an inconsistent "name" on the end. Also, `diffusion.searchquery` uses this parameter inconsistently. Test Plan: - `grep`ed for callsites. - Ran searches in Git and Mercurial repositories. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2683 Differential Revision: https://secure.phabricator.com/D9091 --- ...onduitAPI_diffusion_readmequery_Method.php | 4 +-- ...onduitAPI_diffusion_searchquery_Method.php | 8 +++--- .../controller/DiffusionBrowseController.php | 2 +- .../DiffusionBrowseMainController.php | 2 +- .../DiffusionBrowseSearchController.php | 4 +-- .../controller/DiffusionChangeController.php | 2 +- .../controller/DiffusionHistoryController.php | 2 +- .../diffusion/request/DiffusionRequest.php | 25 ++++++++++--------- .../diffusion/request/DiffusionSvnRequest.php | 2 +- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php index b6d781e3ef..7c2b29877b 100644 --- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php +++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_readmequery_Method.php @@ -55,7 +55,7 @@ final class ConduitAPI_diffusion_readmequery_Method array( 'user' => $request->getUser(), 'repository' => $drequest->getRepository(), - 'commit' => $drequest->getStableCommitName(), + 'commit' => $drequest->getStableCommit(), 'path' => $readme->getFullPath(), )); @@ -65,7 +65,7 @@ final class ConduitAPI_diffusion_readmequery_Method $readme_request, 'diffusion.filecontentquery', array( - 'commit' => $drequest->getStableCommitName(), + 'commit' => $drequest->getStableCommit(), 'path' => $readme->getFullPath(), 'needsBlame' => false, ))); diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_searchquery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_searchquery_Method.php index 0c4a1016b5..cfbe60a1bb 100644 --- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_searchquery_Method.php +++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_searchquery_Method.php @@ -17,7 +17,7 @@ final class ConduitAPI_diffusion_searchquery_Method protected function defineCustomParamTypes() { return array( 'path' => 'required string', - 'stableCommitName' => 'required string', + 'commit' => 'optional string', 'grep' => 'required string', 'limit' => 'optional int', 'offset' => 'optional int', @@ -46,7 +46,6 @@ final class ConduitAPI_diffusion_searchquery_Method protected function getGitResult(ConduitAPIRequest $request) { $drequest = $this->getDiffusionRequest(); $path = $drequest->getPath(); - $stable_commit_name = $request->getValue('stableCommitName'); $grep = $request->getValue('grep'); $repository = $drequest->getRepository(); $limit = $request->getValue('limit'); @@ -57,7 +56,7 @@ final class ConduitAPI_diffusion_searchquery_Method // NOTE: --perl-regexp is available only with libpcre compiled in. 'grep --extended-regexp --null -n --no-color -e %s %s -- %s', $grep, - $stable_commit_name, + $drequest->getStableCommit(), $path); $binary_pattern = '/Binary file [^:]*:(.+) matches/'; @@ -84,7 +83,6 @@ final class ConduitAPI_diffusion_searchquery_Method protected function getMercurialResult(ConduitAPIRequest $request) { $drequest = $this->getDiffusionRequest(); $path = $drequest->getPath(); - $stable_commit_name = $request->getValue('stableCommitName'); $grep = $request->getValue('grep'); $repository = $drequest->getRepository(); $limit = $request->getValue('limit'); @@ -93,7 +91,7 @@ final class ConduitAPI_diffusion_searchquery_Method $results = array(); $future = $repository->getLocalCommandFuture( 'grep --rev %s --print0 --line-number %s %s', - hgsprintf('ancestors(%s)', $stable_commit_name), + hgsprintf('ancestors(%s)', $drequest->getStableCommit()), $grep, $path); diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index aaea1ca964..26f2ab952a 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -141,7 +141,7 @@ abstract class DiffusionBrowseController extends DiffusionController { ->setUser($viewer) ->setActionList($actions); - $stable_commit = $drequest->getStableCommitName(); + $stable_commit = $drequest->getStableCommit(); $callsign = $drequest->getRepository()->getCallsign(); $view->addProperty( diff --git a/src/applications/diffusion/controller/DiffusionBrowseMainController.php b/src/applications/diffusion/controller/DiffusionBrowseMainController.php index cac240f80b..f0f32d7823 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseMainController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseMainController.php @@ -19,7 +19,7 @@ final class DiffusionBrowseMainController extends DiffusionBrowseController { 'diffusion.browsequery', array( 'path' => $drequest->getPath(), - 'commit' => $drequest->getStableCommitName(), + 'commit' => $drequest->getStableCommit(), ))); $reason = $results->getReasonForEmptyResultSet(); $is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE); diff --git a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php index 0a79f709ed..ce12ba3609 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php @@ -61,7 +61,7 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController { 'diffusion.searchquery', array( 'grep' => $query_string, - 'stableCommitName' => $drequest->getStableCommitName(), + 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page, @@ -73,7 +73,7 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController { 'diffusion.querypaths', array( 'pattern' => $query_string, - 'commit' => $drequest->getStableCommitName(), + 'commit' => $drequest->getStableCommit(), 'path' => $drequest->getPath(), 'limit' => $limit + 1, 'offset' => $page, diff --git a/src/applications/diffusion/controller/DiffusionChangeController.php b/src/applications/diffusion/controller/DiffusionChangeController.php index 1c0c81c52b..c3b5dc22b5 100644 --- a/src/applications/diffusion/controller/DiffusionChangeController.php +++ b/src/applications/diffusion/controller/DiffusionChangeController.php @@ -139,7 +139,7 @@ final class DiffusionChangeController extends DiffusionController { ->setUser($viewer) ->setActionList($actions); - $stable_commit = $drequest->getStableCommitName(); + $stable_commit = $drequest->getStableCommit(); $callsign = $drequest->getRepository()->getCallsign(); $view->addProperty( diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php index 91e4479acf..9010dc9f02 100644 --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -152,7 +152,7 @@ final class DiffusionHistoryController extends DiffusionController { ->setUser($viewer) ->setActionList($actions); - $stable_commit = $drequest->getStableCommitName(); + $stable_commit = $drequest->getStableCommit(); $callsign = $drequest->getRepository()->getCallsign(); $view->addProperty( diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php index 928cc15422..6cbcfe0617 100644 --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -15,16 +15,17 @@ abstract class DiffusionRequest { protected $callsign; protected $path; protected $line; - protected $symbolicCommit; protected $commit; protected $commitType = 'commit'; protected $branch; protected $lint; + protected $symbolicCommit; + protected $stableCommit; + protected $repository; protected $repositoryCommit; protected $repositoryCommitData; - protected $stableCommitName; protected $arcanistProjects; private $initFromConduit = true; @@ -315,11 +316,11 @@ abstract class DiffusionRequest { * @return string Stable commit name, like a git hash or SVN revision. Not * a symbolic commit reference. */ - public function getStableCommitName() { - if (!$this->stableCommitName) { - $this->queryStableCommitName(); + public function getStableCommit() { + if (!$this->stableCommit) { + $this->queryStableCommit(); } - return $this->stableCommitName; + return $this->stableCommit; } final public function getRawCommit() { @@ -347,7 +348,7 @@ abstract class DiffusionRequest { if (empty($params['stable'])) { $default_commit = $this->getRawCommit(); } else { - $default_commit = $this->getStableCommitName(); + $default_commit = $this->getStableCommit(); } $defaults = array( @@ -636,10 +637,10 @@ abstract class DiffusionRequest { return $this->commitType; } - private function queryStableCommitName() { + private function queryStableCommit() { if ($this->commit) { - $this->stableCommitName = $this->commit; - return $this->stableCommitName; + $this->stableCommit = $this->commit; + return $this->stableCommit; } if ($this->getSupportsBranches()) { @@ -656,8 +657,8 @@ abstract class DiffusionRequest { pht('Ref "%s" is ambiguous or does not exist.', $branch)); } - $this->stableCommitName = idx(head($matches), 'identifier'); - return $this->stableCommitName; + $this->stableCommit = idx(head($matches), 'identifier'); + return $this->stableCommit; } protected function getResolvableBranchName($branch) { diff --git a/src/applications/diffusion/request/DiffusionSvnRequest.php b/src/applications/diffusion/request/DiffusionSvnRequest.php index 20ae4d5c1c..85020c6c63 100644 --- a/src/applications/diffusion/request/DiffusionSvnRequest.php +++ b/src/applications/diffusion/request/DiffusionSvnRequest.php @@ -27,7 +27,7 @@ final class DiffusionSvnRequest extends DiffusionRequest { return $this->commit; } - return $this->getStableCommitName(); + return $this->getStableCommit(); } }