1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

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
This commit is contained in:
Richard van Velzen 2014-02-02 08:26:25 -08:00 committed by epriestley
parent 988a482ff3
commit 114bb9f25b

View file

@ -628,15 +628,16 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
public function getCommitMessageLog() { public function getCommitMessageLog() {
$base_commit = $this->getBaseCommit(); $base_commit = $this->getBaseCommit();
list($stdout) = $this->execxLocal( 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), hgsprintf('(%s::. - %s)', $base_commit, $base_commit),
$this->getBranchName()); $this->getBranchName());
$map = array(); $map = array();
$logs = explode("\1", trim($stdout)); $logs = explode("\2", trim($stdout));
foreach (array_filter($logs) as $log) { foreach (array_filter($logs) as $log) {
list($node, $desc) = explode("\2", $log); list($node, $desc) = explode("\1", $log);
$map[$node] = $desc; $map[$node] = $desc;
} }
@ -898,7 +899,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
if (preg_match('/^nodiff\((.+)\)$/', $name, $matches)) { if (preg_match('/^nodiff\((.+)\)$/', $name, $matches)) {
list($results) = $this->execxLocal( list($results) = $this->execxLocal(
'log --template %s --rev %s', 'log --template %s --rev %s',
'{node}\1{desc}\2', "{node}\1{desc}\2",
sprintf('ancestor(.,%s)::.^', $matches[1])); sprintf('ancestor(.,%s)::.^', $matches[1]));
$results = array_reverse(explode("\2", trim($results))); $results = array_reverse(explode("\2", trim($results)));