From 12cd0d0b6756643d8906b84eedfba8de3cc5cf7b Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 27 Apr 2012 12:51:44 -0700 Subject: [PATCH] Handle symbolic commit names better in Diffusion Summary: We now allow symbolic commits, so let them through the pipeline. Test Plan: {F10571} Reviewers: davidreuss, btrahan, vrana Reviewed By: davidreuss CC: aran Maniphest Tasks: T1130 Differential Revision: https://secure.phabricator.com/D2315 --- .../request/base/DiffusionRequest.php | 21 ++++++++++++++----- .../base/__tests__/DiffusionURITestCase.php | 16 ++++++++++++++ .../view/taglist/DiffusionTagListView.php | 2 +- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/applications/diffusion/request/base/DiffusionRequest.php b/src/applications/diffusion/request/base/DiffusionRequest.php index c10146a981..5d4d0cafd8 100644 --- a/src/applications/diffusion/request/base/DiffusionRequest.php +++ b/src/applications/diffusion/request/base/DiffusionRequest.php @@ -351,6 +351,7 @@ abstract class DiffusionRequest { $path = "{$branch}{$path}"; if (strlen($commit)) { + $commit = str_replace('$', '$$', $commit); $commit = ';'.phutil_escape_uri($commit); } @@ -471,20 +472,30 @@ abstract class DiffusionRequest { // Consume the back part of the URI, up to the first "$". Use a negative // lookbehind to prevent matching '$$'. We double the '$' symbol when // encoding so that files with names like "money/$100" will survive. - if (preg_match('@(? array( 'branch' => 'a/b', ), + 'branch/path/;Version-1_0_0' => array( + 'branch' => 'branch', + 'path' => 'path/', + 'commit' => 'Version-1_0_0', + ), + 'branch/path/;$$moneytag$$' => array( + 'branch' => 'branch', + 'path' => 'path/', + 'commit' => '$moneytag$', + ), + 'branch/path/semicolon;;;;;$$;;semicolon;;$$$$$100' => array( + 'branch' => 'branch', + 'path' => 'path/semicolon;;', + 'commit' => '$;;semicolon;;$$', + 'line' => '100', + ), ); foreach ($map as $input => $expect) { diff --git a/src/applications/diffusion/view/taglist/DiffusionTagListView.php b/src/applications/diffusion/view/taglist/DiffusionTagListView.php index b26c147050..080f4a841d 100644 --- a/src/applications/diffusion/view/taglist/DiffusionTagListView.php +++ b/src/applications/diffusion/view/taglist/DiffusionTagListView.php @@ -62,7 +62,7 @@ final class DiffusionTagListView extends DiffusionView { 'href' => $drequest->generateURI( array( 'action' => 'browse', - 'commit' => $tag->getCommitIdentifier(), + 'commit' => $tag->getName(), )), ), phutil_escape_html($tag->getName()));