]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Align usages of "\1" and "\2" in MercurialRepositoryAPI
authorRichard van Velzen <rvanvelzen1@gmail.com>
Sun, 2 Feb 2014 16:26:25 +0000 (08:26 -0800)
committerepriestley <git@epriestley.com>
Sun, 2 Feb 2014 16:26:25 +0000 (08:26 -0800)
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

index 24f41a48397705599d1878ea9073c5ae301977d7..2af7bbb49ce216c8d55a010d28479855cc6734c3 100644 (file)
@@ -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)));