Test case for splitting with file adding/removing
authorJoachim Breitner <mail@joachim-breitner.de>
Sun, 22 Aug 2010 17:56:13 +0000 (17:56 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Sun, 22 Aug 2010 17:56:13 +0000 (17:56 +0000)
14 files changed:
tests/split2/after/changes [new file with mode: 0644]
tests/split2/after/patches/addfile.patch [new file with mode: 0644]
tests/split2/after/patches/featureA.patch [new file with mode: 0644]
tests/split2/after/patches/removefile.patch [new file with mode: 0644]
tests/split2/after/patches/series [new file with mode: 0644]
tests/split2/after/patches/testpatch [new file with mode: 0644]
tests/split2/after/src/code [new file with mode: 0644]
tests/split2/after/src/oldfile [new file with mode: 0644]
tests/split2/before/changes [new file with mode: 0644]
tests/split2/before/patches/series [new file with mode: 0644]
tests/split2/before/patches/testpatch [new file with mode: 0644]
tests/split2/before/src/code [new file with mode: 0644]
tests/split2/before/src/oldfile [new file with mode: 0644]
tests/split2/run.sh [new file with mode: 0644]

diff --git a/tests/split2/after/changes b/tests/split2/after/changes
new file mode 100644 (file)
index 0000000..325ceab
--- /dev/null
@@ -0,0 +1,5 @@
+unreleased:
+ * Some change
+
+version 0.1:
+ * Initial Version
diff --git a/tests/split2/after/patches/addfile.patch b/tests/split2/after/patches/addfile.patch
new file mode 100644 (file)
index 0000000..bcf4fd1
--- /dev/null
@@ -0,0 +1,5 @@
+diff -Nur old/src/newfile new/src/newfile
+--- old/src/newfile    ignored date
++++ new/src/newfile    ignored date
+@@ -0,0 +1 @@
++This is a newly added file.
diff --git a/tests/split2/after/patches/featureA.patch b/tests/split2/after/patches/featureA.patch
new file mode 100644 (file)
index 0000000..115cc1a
--- /dev/null
@@ -0,0 +1,18 @@
+diff -Nur old/changes new/changes
+--- old/changes        ignored date
++++ new/changes        ignored date
+@@ -1,5 +1,6 @@
+ unreleased:
+  * Some change
++ * Adding feature A
+ version 0.1:
+  * Initial Version
+diff -Nur old/src/code new/src/code
+--- old/src/code       ignored date
++++ new/src/code       ignored date
+@@ -1,3 +1,3 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
diff --git a/tests/split2/after/patches/removefile.patch b/tests/split2/after/patches/removefile.patch
new file mode 100644 (file)
index 0000000..97e74cf
--- /dev/null
@@ -0,0 +1,5 @@
+diff -Nur old/src/oldfile new/src/oldfile
+--- old/src/oldfile    ignored date
++++ new/src/oldfile    ignored date
+@@ -1 +0,0 @@
+-This file should be removed
diff --git a/tests/split2/after/patches/series b/tests/split2/after/patches/series
new file mode 100644 (file)
index 0000000..9f964bd
--- /dev/null
@@ -0,0 +1 @@
+testpatch
diff --git a/tests/split2/after/patches/testpatch b/tests/split2/after/patches/testpatch
new file mode 100644 (file)
index 0000000..a3cc8de
--- /dev/null
@@ -0,0 +1,32 @@
+Index: before/changes
+===================================================================
+--- before.orig/changes        2010-08-22 19:25:48.000000000 +0200
++++ before/changes     2010-08-22 19:26:49.000000000 +0200
+@@ -1,5 +1,6 @@
+ unreleased:
+  * Some change
++ * Adding feature A
+ version 0.1:
+  * Initial Version
+Index: before/src/code
+===================================================================
+--- before.orig/src/code       2010-08-22 19:25:48.000000000 +0200
++++ before/src/code    2010-08-22 19:26:54.000000000 +0200
+@@ -1,3 +1,3 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
+Index: before/src/newfile
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ before/src/newfile 2010-08-22 19:27:23.000000000 +0200
+@@ -0,0 +1 @@
++This is a newly added file.
+Index: before/src/oldfile
+===================================================================
+--- before.orig/src/oldfile    2010-08-22 19:27:45.000000000 +0200
++++ /dev/null  1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-This file should be removed
diff --git a/tests/split2/after/src/code b/tests/split2/after/src/code
new file mode 100644 (file)
index 0000000..1646544
--- /dev/null
@@ -0,0 +1,3 @@
+This is the code.
+It has some lines.
+That we want to edit.
diff --git a/tests/split2/after/src/oldfile b/tests/split2/after/src/oldfile
new file mode 100644 (file)
index 0000000..fcd381c
--- /dev/null
@@ -0,0 +1 @@
+This file should be removed
diff --git a/tests/split2/before/changes b/tests/split2/before/changes
new file mode 100644 (file)
index 0000000..325ceab
--- /dev/null
@@ -0,0 +1,5 @@
+unreleased:
+ * Some change
+
+version 0.1:
+ * Initial Version
diff --git a/tests/split2/before/patches/series b/tests/split2/before/patches/series
new file mode 100644 (file)
index 0000000..9f964bd
--- /dev/null
@@ -0,0 +1 @@
+testpatch
diff --git a/tests/split2/before/patches/testpatch b/tests/split2/before/patches/testpatch
new file mode 100644 (file)
index 0000000..a3cc8de
--- /dev/null
@@ -0,0 +1,32 @@
+Index: before/changes
+===================================================================
+--- before.orig/changes        2010-08-22 19:25:48.000000000 +0200
++++ before/changes     2010-08-22 19:26:49.000000000 +0200
+@@ -1,5 +1,6 @@
+ unreleased:
+  * Some change
++ * Adding feature A
+ version 0.1:
+  * Initial Version
+Index: before/src/code
+===================================================================
+--- before.orig/src/code       2010-08-22 19:25:48.000000000 +0200
++++ before/src/code    2010-08-22 19:26:54.000000000 +0200
+@@ -1,3 +1,3 @@
+ This is the code.
+-It has some lines.
++It has some lines that we change to implement feature A.
+ That we want to edit.
+Index: before/src/newfile
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ before/src/newfile 2010-08-22 19:27:23.000000000 +0200
+@@ -0,0 +1 @@
++This is a newly added file.
+Index: before/src/oldfile
+===================================================================
+--- before.orig/src/oldfile    2010-08-22 19:27:45.000000000 +0200
++++ /dev/null  1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-This file should be removed
diff --git a/tests/split2/before/src/code b/tests/split2/before/src/code
new file mode 100644 (file)
index 0000000..1646544
--- /dev/null
@@ -0,0 +1,3 @@
+This is the code.
+It has some lines.
+That we want to edit.
diff --git a/tests/split2/before/src/oldfile b/tests/split2/before/src/oldfile
new file mode 100644 (file)
index 0000000..fcd381c
--- /dev/null
@@ -0,0 +1 @@
+This file should be removed
diff --git a/tests/split2/run.sh b/tests/split2/run.sh
new file mode 100644 (file)
index 0000000..de91c76
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+cd $(dirname $0)
+
+if test -x ../../dist/build/ipatch/ipatch
+then IPATCH=$PWD/../../dist/build/ipatch/ipatch
+else IPATCH=ipatch
+fi
+
+rm -rf tmp
+
+cp -r before/ tmp
+cd tmp
+export PATH="..:$PATH"
+( echo yynnpatches/featureA.patch
+  echo yynpatches/addfile.patch
+  echo yypatches/removefile.patch
+)| $IPATCH split patches/testpatch
+
+perl -p -i -e 's/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d.\d+ .\d\d\d\d/ignored date/' patches/featureA.patch patches/addfile.patch patches/removefile.patch
+cd ..
+diff -r tmp after
+rm -rf tmp
+echo "Test done"
+