From: epriestley Date: Wed, 7 Mar 2012 04:14:25 +0000 (-0800) Subject: Improve ArcanistMercurialParser's handling of unusual branch names X-Git-Tag: conduit-4~121 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=81019a790ee74cd3bd6bd6ea076da47ddc871ae8;p=arcanist.git Improve ArcanistMercurialParser's handling of unusual branch names Summary: See . Mercurial branch names may contain any characters, but we currently reject branch names with spaces. NOTE: Mercurial allows you to name branches things like ` ` (five spaces). We do not parse this correctly. Die in a well fire. Test Plan: - Added some horrible-but-possible test cases for crazy branch names. - Unit tests now pass. Reviewers: btrahan, Makinde, killermonk Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1795 --- diff --git a/src/repository/parser/mercurial/ArcanistMercurialParser.php b/src/repository/parser/mercurial/ArcanistMercurialParser.php index 7820768a..7ce13097 100644 --- a/src/repository/parser/mercurial/ArcanistMercurialParser.php +++ b/src/repository/parser/mercurial/ArcanistMercurialParser.php @@ -1,7 +1,7 @@ assertEqual( + array( + 'm m m m m 2:ffffffffffff (inactive)', + 'xxx yyy zzz', + 'default', + "'", + ), + array_keys($output)); + $this->assertEqual( + array('0b9d8290c4e0', '78963faacfc7', '5db03c5500c6', 'ffffffffffff'), + array_values(ipull($output, 'rev'))); + break; case 'log-basic.txt': $output = ArcanistMercurialParser::parseMercurialLog($data); $this->assertEqual( diff --git a/src/repository/parser/mercurial/__tests__/data/branches-with-spaces.txt b/src/repository/parser/mercurial/__tests__/data/branches-with-spaces.txt new file mode 100644 index 00000000..30c999b5 --- /dev/null +++ b/src/repository/parser/mercurial/__tests__/data/branches-with-spaces.txt @@ -0,0 +1,4 @@ +m m m m m 2:ffffffffffff (inactive) 8:0b9d8290c4e0 +xxx yyy zzz 7:78963faacfc7 (inactive) +default 6:5db03c5500c6 (inactive) +' 9:ffffffffffff (inactive) \ No newline at end of file