From e336b04aa10bde5cc0e3a609a4ca4fa4551e2c4e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 25 Aug 2014 12:45:49 -0700 Subject: [PATCH] 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 --- src/workflow/ArcanistBrowseWorkflow.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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) { -- 2.43.0