From 02344602c1fa2875f7227ef8cc4769d267c5f4f8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 31 Aug 2011 11:51:56 -0700 Subject: [PATCH] Some mercurial parsing fixes Summary: Parse some other fields which I hadn't seen yet from "hg log". Select the right "hg log" range for local commit info. Test Plan: Ran "arc diff" in my test mercurial repository from a branch with tags. Looked at "local commits" in Differential. Reviewers: Makinde, aran, jungejason, tuomaspelkonen Reviewed By: Makinde CC: aran, Makinde Differential Revision: 880 --- .../api/mercurial/ArcanistMercurialAPI.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/repository/api/mercurial/ArcanistMercurialAPI.php b/src/repository/api/mercurial/ArcanistMercurialAPI.php index d9de1a1b..0891313f 100644 --- a/src/repository/api/mercurial/ArcanistMercurialAPI.php +++ b/src/repository/api/mercurial/ArcanistMercurialAPI.php @@ -88,7 +88,13 @@ class ArcanistMercurialAPI extends ArcanistRepositoryAPI { $this->getPath(), $this->getRelativeCommit(), 'tip'); - return $this->parseMercurialLog($info); + $logs = $this->parseMercurialLog($info); + + // Get rid of the first log, it's not actually part of the diff. "hg log" + // is inclusive, while "hg diff" is exclusive. + array_shift($logs); + + return $logs; } @@ -304,6 +310,12 @@ class ArcanistMercurialAPI extends ArcanistRepositoryAPI { 'rev' => $rev, ); break; + case 'branch': + $commit['branch'] = $value; + break; + case 'tag': + $commit['tag'] = $value; + break; default: throw new Exception("Unknown Mercurial log field '{$name}'!"); } -- 2.43.0