Index: src/parser/ArcanistDiffParser.php =================================================================== --- src/parser/ArcanistDiffParser.php +++ src/parser/ArcanistDiffParser.php @@ -13,6 +13,7 @@ protected $lineSaved; protected $isGit; protected $isMercurial; + protected $isRCS; protected $detectBinaryFiles = false; protected $tryEncoding; protected $rawDiff; @@ -205,6 +206,8 @@ // This is a git diff, probably from "git show" or "git diff". // Note that the filenames may appear quoted. '(?Pdiff --git) (?P.*)', + // RCS Diff + '(?Prcsdiff -u) (?P.*)', // This is a unified diff, probably from "diff -u" or synthetic diffing. '(?P---) (?P.+)\s+\d{4}-\d{2}-\d{2}.*', '(?PBinary) files '. @@ -303,6 +306,10 @@ $this->setIsMercurial(true); $this->parseIndexHunk($change); break; + case 'rcsdiff -u': + $this->isRCS = true; + $this->parseIndexHunk($change); + break; default: $this->didFailParse("Unknown diff type."); break; @@ -777,13 +784,30 @@ $remainder = '\t.*'; } - $ok = preg_match( + if ($this->isRCS) { + $remainder = '\t.*'; + $this->nextLine(); + $this->nextLine(); + $this->nextLine(); + + $rcs_pattern = '/^[-+]{3}\s[ab]\/.*'.$remainder.'$/'; + + $ok = preg_match($rcs_pattern, $line, $matches); + if (!ok) { + $this->didFailParse("Not a good Rcs diff or may be rcs parser."); + } + + } else { + $ok = preg_match( '@^[-+]{3} (?:[ab]/)?(?P.*?)'.$remainder.'$@', $line, $matches); - if (!$ok) { - $this->didFailParse( - "Expected hunk target '+++ path/to/file.ext (revision N)'."); + + if (!$ok) { + $this->didFailParse( + "Expected hunk target '+++ path/to/file.ext (revision N)'."); + } + } $this->nextLine(); Index: src/parser/__tests__/ArcanistDiffParserTestCase.php =================================================================== --- src/parser/__tests__/ArcanistDiffParserTestCase.php +++ src/parser/__tests__/ArcanistDiffParserTestCase.php @@ -549,6 +549,20 @@ case 'svn-property-windows.svndiff': $this->assertEqual(1, count($changes)); break; + case 'rcs-addline.rcsdiff': + $this->assertEqual(1, count($changes)); + $change = array_shift($changes); + $this->assertEqual( + ArcanistDiffChangeType::TYPE_CHANGE, + $change->getType()); + break; + case 'rcs-deleteline.rcs.diff': + $this->assertEqual(1, count($changes)); + $change = array_shift($changes); + $this->assertEqual( + ArcanistDiffChangeType::TYPE_CHANGE, + $change->getType()); + break; default: throw new Exception("No test block for diff file {$diff_file}."); break; Index: src/parser/__tests__/diff/rcs-addline.rcsdiff =================================================================== --- /dev/null +++ src/parser/__tests__/diff/rcs-addline.rcsdiff @@ -0,0 +1,13 @@ +rcsdiff -u a/testing.php +=================================================================== +RCS file: a/RCS/testing.php,v +retrieving revision 1.1 +diff -u -r1.1 a/testing.php +--- a/testing.php 2013/03/11 16:41:39 1.1 ++++ a/testing.php 2013/03/11 16:44:10 +@@ -1,3 +1,4 @@ + + Index: src/parser/__tests__/diff/rcs-deleteline.rcsdiff =================================================================== --- /dev/null +++ src/parser/__tests__/diff/rcs-deleteline.rcsdiff @@ -0,0 +1,14 @@ +rcsdiff -u a/testing.php +=================================================================== +RCS file: a/RCS/testing.php,v +retrieving revision 1.2 +diff -u -r1.2 a/testing.php +--- a/testing.php 2013/03/11 16:45:50 1.2 ++++ a/testing.php +2013/03/11 16:46:19 +@@ -1,4 +1,3 @@ + +