Summary: When you run `hg diff -r x:y`, we get two "-r" arguments in the diff header. Currently, we parse this incorrectly.
Test Plan: Added unit test which previously failed; test now passes.
Reviewers: dschleimer, btrahan
Reviewed By: dschleimer
CC: aran, cakoose
Maniphest Tasks: T1550
Differential Revision: https://secure.phabricator.com/D3061
'(?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".
- '(?P<type>diff -r) (?P<hgrev>[a-f0-9]+) (?P<cur>.+)',
+ // This is a normal Mercurial text change, probably from "hg diff". It
+ // may have two "-r" blocks if it came from "hg diff -r x:y".
+ '(?P<type>diff -r) (?P<hgrev>[a-f0-9]+) (?:-r [a-f0-9]+ )?(?P<cur>.+)',
);
$ok = false;
$this->assertEqual('*', idx($new_properties, 'svn:executable'));
$this->assertEqual('text/html', idx($new_properties, 'svn:mime-type'));
break;
+ case 'hg-diff-range.hgdiff':
+ $this->assertEqual(1, count($changes));
+ $change = array_shift($changes);
+ $this->assertEqual(
+ 'Test.java',
+ $change->getOldPath());
+ $this->assertEqual(
+ 'Test.java',
+ $change->getCurrentPath());
+ break;
default:
throw new Exception("No test block for diff file {$diff_file}.");
break;
--- /dev/null
+diff -r 2ccefc36d42f -r 6a07a384974e Test.java
+--- a/Test.java Tue Jul 24 14:57:51 2012 -0700
++++ b/Test.java Tue Jul 24 14:59:23 2012 -0700
+@@ -2,6 +2,6 @@
+ {
+ public static void main(String[] args)
+ {
+- System.out.println("Hello!");
++ System.out.println("Hello, world!");
+ }
+ }