1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

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
This commit is contained in:
epriestley 2014-05-13 13:51:45 -07:00
parent 7cc9720d60
commit 9a2c68fd88
9 changed files with 25 additions and 26 deletions

View file

@ -55,7 +55,7 @@ final class ConduitAPI_diffusion_readmequery_Method
array( array(
'user' => $request->getUser(), 'user' => $request->getUser(),
'repository' => $drequest->getRepository(), 'repository' => $drequest->getRepository(),
'commit' => $drequest->getStableCommitName(), 'commit' => $drequest->getStableCommit(),
'path' => $readme->getFullPath(), 'path' => $readme->getFullPath(),
)); ));
@ -65,7 +65,7 @@ final class ConduitAPI_diffusion_readmequery_Method
$readme_request, $readme_request,
'diffusion.filecontentquery', 'diffusion.filecontentquery',
array( array(
'commit' => $drequest->getStableCommitName(), 'commit' => $drequest->getStableCommit(),
'path' => $readme->getFullPath(), 'path' => $readme->getFullPath(),
'needsBlame' => false, 'needsBlame' => false,
))); )));

View file

@ -17,7 +17,7 @@ final class ConduitAPI_diffusion_searchquery_Method
protected function defineCustomParamTypes() { protected function defineCustomParamTypes() {
return array( return array(
'path' => 'required string', 'path' => 'required string',
'stableCommitName' => 'required string', 'commit' => 'optional string',
'grep' => 'required string', 'grep' => 'required string',
'limit' => 'optional int', 'limit' => 'optional int',
'offset' => 'optional int', 'offset' => 'optional int',
@ -46,7 +46,6 @@ final class ConduitAPI_diffusion_searchquery_Method
protected function getGitResult(ConduitAPIRequest $request) { protected function getGitResult(ConduitAPIRequest $request) {
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$path = $drequest->getPath(); $path = $drequest->getPath();
$stable_commit_name = $request->getValue('stableCommitName');
$grep = $request->getValue('grep'); $grep = $request->getValue('grep');
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$limit = $request->getValue('limit'); $limit = $request->getValue('limit');
@ -57,7 +56,7 @@ final class ConduitAPI_diffusion_searchquery_Method
// NOTE: --perl-regexp is available only with libpcre compiled in. // NOTE: --perl-regexp is available only with libpcre compiled in.
'grep --extended-regexp --null -n --no-color -e %s %s -- %s', 'grep --extended-regexp --null -n --no-color -e %s %s -- %s',
$grep, $grep,
$stable_commit_name, $drequest->getStableCommit(),
$path); $path);
$binary_pattern = '/Binary file [^:]*:(.+) matches/'; $binary_pattern = '/Binary file [^:]*:(.+) matches/';
@ -84,7 +83,6 @@ final class ConduitAPI_diffusion_searchquery_Method
protected function getMercurialResult(ConduitAPIRequest $request) { protected function getMercurialResult(ConduitAPIRequest $request) {
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$path = $drequest->getPath(); $path = $drequest->getPath();
$stable_commit_name = $request->getValue('stableCommitName');
$grep = $request->getValue('grep'); $grep = $request->getValue('grep');
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$limit = $request->getValue('limit'); $limit = $request->getValue('limit');
@ -93,7 +91,7 @@ final class ConduitAPI_diffusion_searchquery_Method
$results = array(); $results = array();
$future = $repository->getLocalCommandFuture( $future = $repository->getLocalCommandFuture(
'grep --rev %s --print0 --line-number %s %s', 'grep --rev %s --print0 --line-number %s %s',
hgsprintf('ancestors(%s)', $stable_commit_name), hgsprintf('ancestors(%s)', $drequest->getStableCommit()),
$grep, $grep,
$path); $path);

View file

@ -141,7 +141,7 @@ abstract class DiffusionBrowseController extends DiffusionController {
->setUser($viewer) ->setUser($viewer)
->setActionList($actions); ->setActionList($actions);
$stable_commit = $drequest->getStableCommitName(); $stable_commit = $drequest->getStableCommit();
$callsign = $drequest->getRepository()->getCallsign(); $callsign = $drequest->getRepository()->getCallsign();
$view->addProperty( $view->addProperty(

View file

@ -19,7 +19,7 @@ final class DiffusionBrowseMainController extends DiffusionBrowseController {
'diffusion.browsequery', 'diffusion.browsequery',
array( array(
'path' => $drequest->getPath(), 'path' => $drequest->getPath(),
'commit' => $drequest->getStableCommitName(), 'commit' => $drequest->getStableCommit(),
))); )));
$reason = $results->getReasonForEmptyResultSet(); $reason = $results->getReasonForEmptyResultSet();
$is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE); $is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE);

View file

@ -61,7 +61,7 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController {
'diffusion.searchquery', 'diffusion.searchquery',
array( array(
'grep' => $query_string, 'grep' => $query_string,
'stableCommitName' => $drequest->getStableCommitName(), 'commit' => $drequest->getStableCommit(),
'path' => $drequest->getPath(), 'path' => $drequest->getPath(),
'limit' => $limit + 1, 'limit' => $limit + 1,
'offset' => $page, 'offset' => $page,
@ -73,7 +73,7 @@ final class DiffusionBrowseSearchController extends DiffusionBrowseController {
'diffusion.querypaths', 'diffusion.querypaths',
array( array(
'pattern' => $query_string, 'pattern' => $query_string,
'commit' => $drequest->getStableCommitName(), 'commit' => $drequest->getStableCommit(),
'path' => $drequest->getPath(), 'path' => $drequest->getPath(),
'limit' => $limit + 1, 'limit' => $limit + 1,
'offset' => $page, 'offset' => $page,

View file

@ -139,7 +139,7 @@ final class DiffusionChangeController extends DiffusionController {
->setUser($viewer) ->setUser($viewer)
->setActionList($actions); ->setActionList($actions);
$stable_commit = $drequest->getStableCommitName(); $stable_commit = $drequest->getStableCommit();
$callsign = $drequest->getRepository()->getCallsign(); $callsign = $drequest->getRepository()->getCallsign();
$view->addProperty( $view->addProperty(

View file

@ -152,7 +152,7 @@ final class DiffusionHistoryController extends DiffusionController {
->setUser($viewer) ->setUser($viewer)
->setActionList($actions); ->setActionList($actions);
$stable_commit = $drequest->getStableCommitName(); $stable_commit = $drequest->getStableCommit();
$callsign = $drequest->getRepository()->getCallsign(); $callsign = $drequest->getRepository()->getCallsign();
$view->addProperty( $view->addProperty(

View file

@ -15,16 +15,17 @@ abstract class DiffusionRequest {
protected $callsign; protected $callsign;
protected $path; protected $path;
protected $line; protected $line;
protected $symbolicCommit;
protected $commit; protected $commit;
protected $commitType = 'commit'; protected $commitType = 'commit';
protected $branch; protected $branch;
protected $lint; protected $lint;
protected $symbolicCommit;
protected $stableCommit;
protected $repository; protected $repository;
protected $repositoryCommit; protected $repositoryCommit;
protected $repositoryCommitData; protected $repositoryCommitData;
protected $stableCommitName;
protected $arcanistProjects; protected $arcanistProjects;
private $initFromConduit = true; private $initFromConduit = true;
@ -315,11 +316,11 @@ abstract class DiffusionRequest {
* @return string Stable commit name, like a git hash or SVN revision. Not * @return string Stable commit name, like a git hash or SVN revision. Not
* a symbolic commit reference. * a symbolic commit reference.
*/ */
public function getStableCommitName() { public function getStableCommit() {
if (!$this->stableCommitName) { if (!$this->stableCommit) {
$this->queryStableCommitName(); $this->queryStableCommit();
} }
return $this->stableCommitName; return $this->stableCommit;
} }
final public function getRawCommit() { final public function getRawCommit() {
@ -347,7 +348,7 @@ abstract class DiffusionRequest {
if (empty($params['stable'])) { if (empty($params['stable'])) {
$default_commit = $this->getRawCommit(); $default_commit = $this->getRawCommit();
} else { } else {
$default_commit = $this->getStableCommitName(); $default_commit = $this->getStableCommit();
} }
$defaults = array( $defaults = array(
@ -636,10 +637,10 @@ abstract class DiffusionRequest {
return $this->commitType; return $this->commitType;
} }
private function queryStableCommitName() { private function queryStableCommit() {
if ($this->commit) { if ($this->commit) {
$this->stableCommitName = $this->commit; $this->stableCommit = $this->commit;
return $this->stableCommitName; return $this->stableCommit;
} }
if ($this->getSupportsBranches()) { if ($this->getSupportsBranches()) {
@ -656,8 +657,8 @@ abstract class DiffusionRequest {
pht('Ref "%s" is ambiguous or does not exist.', $branch)); pht('Ref "%s" is ambiguous or does not exist.', $branch));
} }
$this->stableCommitName = idx(head($matches), 'identifier'); $this->stableCommit = idx(head($matches), 'identifier');
return $this->stableCommitName; return $this->stableCommit;
} }
protected function getResolvableBranchName($branch) { protected function getResolvableBranchName($branch) {

View file

@ -27,7 +27,7 @@ final class DiffusionSvnRequest extends DiffusionRequest {
return $this->commit; return $this->commit;
} }
return $this->getStableCommitName(); return $this->getStableCommit();
} }
} }