in reply to How to apply a patch on Windows?
Patch tells you exactly what you're doing wrong.
Here is a short patch tutorial for you in the form of a shell/batch file
Here is the output of the run (notice the same error message)md tmp cd tmp md old md old1 md old2 md old3 md new echo >old/f1 echo >old1/f1 echo >old2/f1 echo >old3/f1 echo >new/f1 echo >>new/f1 diff -ruN old new >temp.patch patch -p0 -dold1 < temp.patch patch -p1 -dold1 < temp.patch cd old2 patch < ../temp.patch cd ../old3 patch -p0 < ../temp.patch patch -p1 < ../temp.patch cd .. cat old/f1 cat old1/f1 cat old2/f1 cat old3/f1 cat new/f1 cat temp.patch
$ md tmp $ cd tmp $ md old $ md old1 $ md old2 $ md old3 $ md new $ echo >old\f1 $ echo >old1\f1 $ echo >old2\f1 $ echo >old3\f1 $ $ echo >new\f1 $ echo >>new\f1 $ $ diff -ruN old new >temp.patch $ $ patch -p0 -dold1 < temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:57:33.843750000 -0700 |+++ new/f1 2010-04-22 23:57:33.859375000 -0700 -------------------------- File to patch: patch -p1 -dold1 < temp.patch patch: No such file or directory Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ cd old2 $ patch < ../temp.patch patching file f1 $ cd ../old3 $ patch -p0 < ../temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:57:33.843750000 -0700 |+++ new/f1 2010-04-22 23:57:33.859375000 -0700 -------------------------- File to patch: patch -p1 < ../temp.patch patch: No such file or directory Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ cd .. $ cat old\f1 ECHO is on. $ cat old1\f1 ECHO is on. $ cat old2\f1 ECHO is on. ECHO is on. $ cat old3\f1 ECHO is on. $ cat new\f1 ECHO is on. ECHO is on. $ cat temp.patch diff -ruN old/f1 new/f1 --- old/f1 2010-04-22 23:57:33.843750000 -0700 +++ new/f1 2010-04-22 23:57:33.859375000 -0700 @@ -1 +1,2 @@ ECHO is on. +ECHO is on. $ cd .. $ rm -rf tmp $ sscite snap.bat $ pwd D:\tmp $ call snap.bat $ md tmp $ cd tmp $ md old $ md old1 $ md old2 $ md old3 $ md new $ echo 1>old/f1 $ echo 1>old1/f1 $ echo 1>old2/f1 $ echo 1>old3/f1 $ echo 1>new/f1 $ echo 1>>new/f1 $ diff -ruN old new 1>temp.patch $ patch -p0 -dold1 0<temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:59:47.968750000 -0700 |+++ new/f1 2010-04-22 23:59:47.968750000 -0700 -------------------------- File to patch: Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ patch -p1 -dold1 0<temp.patch patching file f1 $ cd old2 $ patch 0<../temp.patch patching file f1 $ cd ../old3 $ patch -p0 0<../temp.patch can't find file to patch at input line 4 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff -ruN old/f1 new/f1 |--- old/f1 2010-04-22 23:59:47.968750000 -0700 |+++ new/f1 2010-04-22 23:59:47.968750000 -0700 -------------------------- File to patch: Skip this patch? [y] Skipping patch. 1 out of 1 hunk ignored $ patch -p1 0<../temp.patch patching file f1 $ cd .. $ cat old/f1 ECHO is on. $ cat old1/f1 ECHO is on. ECHO is on. $ cat old2/f1 ECHO is on. ECHO is on. $ cat old3/f1 ECHO is on. ECHO is on. $ cat new/f1 ECHO is on. ECHO is on. $ cat temp.patch diff -ruN old/f1 new/f1 --- old/f1 2010-04-22 23:59:47.968750000 -0700 +++ new/f1 2010-04-22 23:59:47.968750000 -0700 @@ -1 +1,2 @@ ECHO is on. +ECHO is on. $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to apply a patch on Windows?
by BrowserUk (Patriarch) on Apr 23, 2010 at 07:17 UTC | |
by Anonymous Monk on Apr 23, 2010 at 08:37 UTC | |
by BrowserUk (Patriarch) on Apr 23, 2010 at 09:11 UTC | |
by Anonymous Monk on Apr 28, 2010 at 01:58 UTC |