From: Richard van Velzen Date: Sun, 2 Feb 2014 16:26:25 +0000 (-0800) Subject: Align usages of "\1" and "\2" in MercurialRepositoryAPI X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=114bb9f25bc55b2c5af9dc4e86aed73000bf032f;p=arcanist.git 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 --- 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)));