]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Clean up some "arc" edge cases in Mercurial
authorepriestley <git@epriestley.com>
Fri, 4 May 2012 22:46:10 +0000 (15:46 -0700)
committerepriestley <git@epriestley.com>
Fri, 4 May 2012 22:46:10 +0000 (15:46 -0700)
Summary:
  - We no longer need color options since we fake our way through parsing ANSI colorized diffs and use HGPLAIN (on Windows, too!). Drop 'em.
  - In the case where you have nothing outgoing, we don't cache the relative commit and thus run "hg outgoing" too many times, which is fairly slow (even if you have nothing outgoing). Cache it.

Test Plan: Ran "arc diff --trace" in a mercurial working copy with nothing outgoing; verified we run "hg outgoing" only once.

Reviewers: Makinde, csilvers, btrahan

Reviewed By: Makinde

CC: aran
Differential Revision: https://secure.phabricator.com/D2399

src/repository/api/mercurial/ArcanistMercurialAPI.php

index 98f5176acf9e53750a97fc042428e53de917c1d9..b2d6150e94daacb5ca5a1904e42a947c77fa9ee6 100644 (file)
@@ -108,7 +108,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
 
       if (!$logs) {
         // In Mercurial, we support operations against uncommitted changes.
-        return $this->getWorkingCopyRevision();
+        $this->setRelativeCommit($this->getWorkingCopyRevision());
+        return $this->relativeCommit;
       }
 
       $outgoing_revs = ipull($logs, 'rev');
@@ -281,11 +282,6 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
   private function getDiffOptions() {
     $options = array(
       '--git',
-      // NOTE: We can't use "--color never" because that flag is provided
-      // by the color extension, which may or may not be enabled. Instead,
-      // set the color mode configuration so that color is disabled regardless
-      // of whether the extension is present or not.
-      '--config color.mode=off',
       '-U'.$this->getDiffLinesOfContext(),
     );
     return implode(' ', $options);