From ba12102eb6ee70181193e762db30a2af20f10a2a Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 27 Sep 2017 10:22:00 -0700 Subject: [PATCH] Support automatic "Depends On" detection in Mercurial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Depends on D18651. Allows Mercurial to auto-detect depends-on revisions. Test Plan: See D18652 and D18653. Didn't actually test the empty repository states but they're probably okay. The `experimental` branch is an untamed wild. ¯\_(ツ)_/¯ Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D18654 --- src/repository/api/ArcanistGitAPI.php | 7 ++++++- src/repository/api/ArcanistMercurialAPI.php | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index a73cbe07..fe7d839f 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1054,7 +1054,12 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { } public function getBaseCommitRef() { - $base_commit = $this->getSourceControlBaseRevision(); + $base_commit = $this->getBaseCommit(); + + if ($base_commit === self::GIT_MAGIC_ROOT_COMMIT) { + return null; + } + $base_message = $this->getCommitMessage($base_commit); // TODO: We should also pull the tree hash. diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php index 8e9ea7e7..301cc88e 100644 --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -596,6 +596,20 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { return $refs; } + public function getBaseCommitRef() { + $base_commit = $this->getBaseCommit(); + + if ($base_commit === 'null') { + return null; + } + + $base_message = $this->getCommitMessage($base_commit); + + return $this->newCommitRef() + ->setCommitHash($base_commit) + ->attachMessage($base_message); + } + public function hasLocalCommit($commit) { try { $this->getCanonicalRevisionName($commit);