From 114bb9f25bc55b2c5af9dc4e86aed73000bf032f Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Sun, 2 Feb 2014 08:26:25 -0800 Subject: [PATCH] Align usages of "\1" and "\2" in MercurialRepositoryAPI Summary: Especially on Windows it is hard to use "\1" type escapes in shell commands. The direct usage resulted in some undefined variables because the \1 and \2 weren't actually passed as control characters. By passing them through the regular arguments list they get sent in the "correct way" regardless of OS Test Plan: Executed `arc diff` in a HG repo and did not get undefined indexes back Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D8129 --- src/repository/api/ArcanistMercurialAPI.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php index 24f41a48..2af7bbb4 100644 --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -628,15 +628,16 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { public function getCommitMessageLog() { $base_commit = $this->getBaseCommit(); list($stdout) = $this->execxLocal( - "log --template '{node}\\2{desc}\\1' --rev %s --branch %s --", + "log --template %s --rev %s --branch %s --", + "{node}\1{desc}\2", hgsprintf('(%s::. - %s)', $base_commit, $base_commit), $this->getBranchName()); $map = array(); - $logs = explode("\1", trim($stdout)); + $logs = explode("\2", trim($stdout)); foreach (array_filter($logs) as $log) { - list($node, $desc) = explode("\2", $log); + list($node, $desc) = explode("\1", $log); $map[$node] = $desc; } @@ -898,7 +899,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { if (preg_match('/^nodiff\((.+)\)$/', $name, $matches)) { list($results) = $this->execxLocal( 'log --template %s --rev %s', - '{node}\1{desc}\2', + "{node}\1{desc}\2", sprintf('ancestor(.,%s)::.^', $matches[1])); $results = array_reverse(explode("\2", trim($results)));