1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30: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(
'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,
)));

View file

@ -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);

View file

@ -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(

View file

@ -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);

View file

@ -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,

View file

@ -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(

View file

@ -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(

View file

@ -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) {

View file

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