From: epriestley Date: Mon, 25 Aug 2014 19:45:49 +0000 (-0700) Subject: Fix `arc browse path:line` X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e336b04aa10bde5cc0e3a609a4ca4fa4551e2c4e;p=arcanist.git Fix `arc browse path:line` Summary: Ref T5781. This was broken in some earlier changes in T5781. Test Plan: Ran `arc browse README`, `arc browse README:10`. Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5781 Differential Revision: https://secure.phabricator.com/D10346 --- diff --git a/src/workflow/ArcanistBrowseWorkflow.php b/src/workflow/ArcanistBrowseWorkflow.php index d80430f3..1c144cfc 100644 --- a/src/workflow/ArcanistBrowseWorkflow.php +++ b/src/workflow/ArcanistBrowseWorkflow.php @@ -144,7 +144,13 @@ EOTEXT // If we fail, try to resolve them as paths. foreach ($things as $key => $path) { - $path = preg_replace('/:([0-9]+)$/', '$\1', $path); + $line = null; + $parts = explode(':', $path); + if (count($parts) > 1) { + $line = (int)array_pop($parts); + } + $path = implode(':', $parts); + $full_path = Filesystem::resolvePath($path); if (!$is_force && !Filesystem::pathExists($full_path)) { @@ -165,7 +171,13 @@ EOTEXT } $base_uri = $this->getBaseURI(); - $uris[] = $base_uri.$path; + $uri = $base_uri.$path; + + if ($line) { + $uri = $uri.'$'.$line; + } + + $uris[] = $uri; } } else { if ($things) {