1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Fix exception on diff parse on FreeBSD

FreeBSD 9.2 comes with diff tool version 2.8.7 which behaves
a bit different from how it is expected to. Namely for diff
between two binary files it says:

  Files A and B are differ

This was leading to an exception when browsing revisions with
changes in binary files.

Tweaked parse patterns in order to fix this issue. Now both
older and newer diff tools are supported.

See: <https://github.com/facebook/arcanist/pull/139>

Reviewed by: epriestley
This commit is contained in:
Sergey Sharybin 2014-01-17 16:37:55 +06:00 committed by epriestley
parent a247e21093
commit 2c2c5663cb
3 changed files with 6 additions and 2 deletions

View file

@ -220,7 +220,7 @@ final class ArcanistDiffParser {
'(?P<type>rcsdiff -u) (?P<oldnew>.*)',
// This is a unified diff, probably from "diff -u" or synthetic diffing.
'(?P<type>---) (?P<old>.+)\s+\d{4}-\d{2}-\d{2}.*',
'(?P<binary>Binary) files '.
'(?P<binary>Binary files|Files) '.
'(?P<old>.+)\s+\d{4}-\d{2}-\d{2} and '.
'(?P<new>.+)\s+\d{4}-\d{2}-\d{2} differ.*',
// This is a normal Mercurial text change, probably from "hg diff". It
@ -705,7 +705,7 @@ final class ArcanistDiffParser {
// We can get this in git, or in SVN when a file exists in the repository
// WITHOUT a binary mime-type and is changed and given a binary mime-type.
$is_binary_diff = preg_match(
'/^Binary files .* and .* differ$/',
'/^(Binary files|Files) .* and .* differ$/',
rtrim($line));
if ($is_binary_diff) {
$this->nextNonemptyLine(); // Binary files x and y differ

View file

@ -217,6 +217,7 @@ EOTEXT
$change->getNewProperties());
break;
case 'svn-binary-diff.svndiff':
case 'svn-binary-diff-freebsd.svndiff':
$this->assertEqual(1, count($changes));
$change = reset($changes);
$this->assertEqual(

View file

@ -0,0 +1,3 @@
Index: html/images/sprite/autogen/8f2jjp.png
===================================================================
Files trunk/lib/tests/tracking/synthetic-point-motion.blend 9999-99-99 and trunk/lib/tests/tracking/synthetic-point-motion.blend 9999-99-99 differ