mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 23:02:41 +01:00
arc browse: Support line number and reduce conduit call
Summary: support common "filename:line number" format. Also, remove redundent conduit call. Test Plan: arc browse with and without :33 suffix. Reviewers: epriestley, vrana Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D6451
This commit is contained in:
parent
ad9cb418c4
commit
46bb3dbc36
1 changed files with 5 additions and 10 deletions
|
@ -79,6 +79,7 @@ EOTEXT
|
||||||
$in_paths = $this->getArgument('paths');
|
$in_paths = $this->getArgument('paths');
|
||||||
$paths = array();
|
$paths = array();
|
||||||
foreach ($in_paths as $key => $path) {
|
foreach ($in_paths as $key => $path) {
|
||||||
|
$path = preg_replace('/:([0-9]+)$/', '$\1', $path);
|
||||||
$full_path = Filesystem::resolvePath($path);
|
$full_path = Filesystem::resolvePath($path);
|
||||||
|
|
||||||
$paths[$key] = Filesystem::readablePath(
|
$paths[$key] = Filesystem::readablePath(
|
||||||
|
@ -87,7 +88,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$paths) {
|
if (!$paths) {
|
||||||
throw new ArcanistUsageException("Specify a path to browse");
|
throw new ArcanistUsageException("Specify a path to browse.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$base_uri = $this->getBaseURI();
|
$base_uri = $this->getBaseURI();
|
||||||
|
@ -97,7 +98,7 @@ EOTEXT
|
||||||
$ret_code = phutil_passthru("%s %s", $browser, $base_uri . $path);
|
$ret_code = phutil_passthru("%s %s", $browser, $base_uri . $path);
|
||||||
if ($ret_code) {
|
if ($ret_code) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"It seems we failed to open the browser; Perhaps you should try to ".
|
"It seems we failed to open the browser; perhaps you should try to ".
|
||||||
"set the 'browser' config option. The command we tried to use was: ".
|
"set the 'browser' config option. The command we tried to use was: ".
|
||||||
$browser);
|
$browser);
|
||||||
}
|
}
|
||||||
|
@ -115,16 +116,10 @@ EOTEXT
|
||||||
'name' => $project_id,
|
'name' => $project_id,
|
||||||
));
|
));
|
||||||
|
|
||||||
$repo_phid = $project_info['repositoryPHID'];
|
$repo_info = $project_info['repository'];
|
||||||
$repo_info = $this->getConduit()->callMethodSynchronous(
|
|
||||||
'phid.query',
|
|
||||||
array(
|
|
||||||
'phids' => array($repo_phid),
|
|
||||||
));
|
|
||||||
|
|
||||||
$branch = $this->getArgument('branch', 'master');
|
$branch = $this->getArgument('branch', 'master');
|
||||||
|
|
||||||
return $repo_info[$repo_phid]['uri'].'browse/'.$branch.'/';
|
return $repo_info['uri'].'browse/'.$branch.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBrowserCommand() {
|
private function getBrowserCommand() {
|
||||||
|
|
Loading…
Reference in a new issue