Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionBrowseResultSet {
|
|
|
|
|
|
|
|
const REASON_IS_FILE = 'is-file';
|
|
|
|
const REASON_IS_DELETED = 'is-deleted';
|
|
|
|
const REASON_IS_NONEXISTENT = 'nonexistent';
|
|
|
|
const REASON_BAD_COMMIT = 'bad-commit';
|
|
|
|
const REASON_IS_EMPTY = 'empty';
|
|
|
|
const REASON_IS_UNTRACKED_PARENT = 'untracked-parent';
|
|
|
|
|
|
|
|
private $paths;
|
|
|
|
private $isValidResults;
|
|
|
|
private $reasonForEmptyResultSet;
|
|
|
|
private $existedAtCommit;
|
|
|
|
private $deletedAtCommit;
|
|
|
|
|
|
|
|
public function setPaths(array $paths) {
|
|
|
|
assert_instances_of($paths, 'DiffusionRepositoryPath');
|
|
|
|
$this->paths = $paths;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getPaths() {
|
|
|
|
return $this->paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setIsValidResults($is_valid) {
|
|
|
|
$this->isValidResults = $is_valid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function isValidResults() {
|
|
|
|
return $this->isValidResults;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setReasonForEmptyResultSet($reason) {
|
|
|
|
$this->reasonForEmptyResultSet = $reason;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getReasonForEmptyResultSet() {
|
|
|
|
return $this->reasonForEmptyResultSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setExistedAtCommit($existed_at_commit) {
|
|
|
|
$this->existedAtCommit = $existed_at_commit;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getExistedAtCommit() {
|
|
|
|
return $this->existedAtCommit;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDeletedAtCommit($deleted_at_commit) {
|
|
|
|
$this->deletedAtCommit = $deleted_at_commit;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getDeletedAtCommit() {
|
|
|
|
return $this->deletedAtCommit;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function toDictionary() {
|
2013-05-21 22:47:06 +02:00
|
|
|
$paths = $this->getPathDicts();
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
|
|
|
|
return array(
|
|
|
|
'paths' => $paths,
|
|
|
|
'isValidResults' => $this->isValidResults(),
|
|
|
|
'reasonForEmptyResultSet' => $this->getReasonForEmptyResultSet(),
|
|
|
|
'existedAtCommit' => $this->getExistedAtCommit(),
|
2013-05-21 22:47:06 +02:00
|
|
|
'deletedAtCommit' => $this->getDeletedAtCommit());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPathDicts() {
|
|
|
|
$paths = $this->getPaths();
|
|
|
|
if ($paths) {
|
|
|
|
return mpull($paths, 'toDictionary');
|
|
|
|
}
|
|
|
|
return array();
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function newFromConduit(array $data) {
|
|
|
|
$paths = array();
|
|
|
|
$path_dicts = $data['paths'];
|
|
|
|
foreach ($path_dicts as $dict) {
|
|
|
|
$paths[] = DiffusionRepositoryPath::newFromDictionary($dict);
|
|
|
|
}
|
|
|
|
return id(new DiffusionBrowseResultSet())
|
|
|
|
->setPaths($paths)
|
|
|
|
->setIsValidResults($data['isValidResults'])
|
|
|
|
->setReasonForEmptyResultSet($data['reasonForEmptyResultSet'])
|
|
|
|
->setExistedAtCommit($data['existedAtCommit'])
|
2013-05-21 22:47:06 +02:00
|
|
|
->setDeletedAtCommit($data['deletedAtCommit']);
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
}
|
|
|
|
}
|