summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-02-26 10:08:37 -0600
committerDan Davison <dandavison7@gmail.com>2020-02-26 10:14:41 -0600
commitc674f36bd854b55af471588c56379cb042237c17 (patch)
treecf3ef39ca45235cef46d3921488523443d0a6bd5
parent10871b1814ae6d09bc3c7a872e25d91201a257dd (diff)
Support SVN diff output
Fixes #105
-rw-r--r--src/delta.rs2
-rw-r--r--testing/105-svn-1.diff10
-rw-r--r--testing/105-svn-2.diff18
-rw-r--r--testing/105-svn-3.diff15
4 files changed, 45 insertions, 0 deletions
diff --git a/src/delta.rs b/src/delta.rs
index 7f8aff5a..2f296342 100644
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -181,7 +181,9 @@ where
} else if line.starts_with("diff -u ")
|| line.starts_with("diff -U")
|| line.starts_with("--- ")
+ || line.starts_with("Index: ")
{
+ // "Index: " indicates subversion, which we handle as unified diff.
Source::DiffUnified
} else {
Source::Unknown
diff --git a/testing/105-svn-1.diff b/testing/105-svn-1.diff
new file mode 100644
index 00000000..e894de47
--- /dev/null
+++ b/testing/105-svn-1.diff
@@ -0,0 +1,10 @@
+Index: file.c
+===================================================================
+--- file.c (revision 14)
++++ file.c (working copy)
+@@ -1 +1,4 @@
+-void aa(){}
++void ab(){}
++
++
++int aaa
diff --git a/testing/105-svn-2.diff b/testing/105-svn-2.diff
new file mode 100644
index 00000000..5dcc9ef0
--- /dev/null
+++ b/testing/105-svn-2.diff
@@ -0,0 +1,18 @@
+Index: f1
+===================================================================
+--- f1 (revision 11)
++++ f1 (working copy)
+@@ -1 +1,4 @@
+ line1
++lnie2
++
++aaa
+Index: file.c
+===================================================================
+--- file.c (nonexistent)
++++ file.c (working copy)
+@@ -0,0 +1,4 @@
++void ab(){}
++
++
++int aaa;
diff --git a/testing/105-svn-3.diff b/testing/105-svn-3.diff
new file mode 100644
index 00000000..4dfff91b
--- /dev/null
+++ b/testing/105-svn-3.diff
@@ -0,0 +1,15 @@
+Index: f1
+===================================================================
+--- f1 (.../branches/b1) (revision 14)
++++ f1 (.../trunk) (revision 14)
+@@ -1 +1,4 @@
+ line1
++lnie2
++
++aaa
+Index: file.c
+===================================================================
+--- file.c (.../branches/b1) (nonexistent)
++++ file.c (.../trunk) (revision 14)
+@@ -0,0 +1 @@
++void aa(){}