[nycbug-talk] Reversed (or previously applied) patch detected

Francisco Reyes lists at stringsutils.com
Tue Dec 28 15:10:10 EST 2010


I was doing some exercises to get familiar with diff/patch.

Tried:
cd
mkdir tmp
cd tmp
mkdir original
mkdir changed
echo Line1 > original/File1
echo Line2 >>original/File1
echo Line4 >>original/File1

echo Line1 > changed/File1
echo Line2 >>changed/File1
echo Line3 >>changed/File1
echo Line4 >>changed/File1

echo 1 > original/File2
echo 2 >>original/File2
echo 4 >>original/File2

echo 1 > changed/File2
echo 2 >>changed/File2
echo 3 >>changed/File2
echo 4 >>changed/File2

diff -urN original changed > dir.diff

Which produced:
diff -ruN original/File1 changed/File1
--- original/File1 2010-12-26 23:07:41.000000000 -0500
+++ changed/File1 2010-12-26 23:08:26.000000000 -0500
@@ -1,3 +1,5 @@
Line1
Line2
+Line3
Line4
+Line5
diff -ruN original/File2 changed/File2
--- original/File2 2010-12-26 23:08:08.000000000 -0500
+++ changed/File2 2010-12-26 23:08:35.000000000 -0500
@@ -1,3 +1,8 @@
1
2
+3
4
+5
+6
+7
+8


Then tried
patch < dir.diff


The patch command gives the warning:
Reversed (or previously applied) patch detected

Tried a few other variations like
patch -p <dir.diff

It will run without errors with
patch -R < dir.diff

But that will make the "changed" files be like the original instead of
patching the original files.

Any ideas/hints?



More information about the talk mailing list