(n00b) Научите пользоваться diff/patch

Bird_V

Субж под Win32/MinGW :

$ diff --version
diff - GNU diffutils version 2.7

$ patch --version
patch 2.5
Copyright 1988 Larry Wall
Copyright 1997 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

written by Larry Wall with lots o' patches by Paul Eggert


В частности, есть diff следующего вида:

diff -Nurd --exclude-from=diff_ign.txt nh343orig/README.nh343jl nh343jl/README.nh343jl
--- nh343orig/README.nh343jl 1970-01-01 02:00:00.000000000 +0200
+++ nh343jl/README.nh343jl 2004-07-13 17:21:18.804554288 +0300
@@ -0,0 +1,104 @@
+nh343jl.diff is a diff for Nethack 3.4.3, containing the following
+patches (better explanations and diffs for most individual patches
+available at http://www.netsonic.fi/~walker/nethack.html) :
(.... cut ....)
diff -Nurd --exclude-from=diff_ign.txt nh343orig/dat/opthelp nh343jl/dat/opthelp
--- nh343orig/dat/opthelp 2003-12-08 01:39:13.000000000 +0200
+++ nh343jl/dat/opthelp 2004-03-13 11:25:44.000000000 +0200
@@ -51,6 +51,10 @@

There are further boolean options controlled by compilation flags.

+Boolean option if ITEMCAT was set at compile time:
+like_swimming allow category "Items known to be Rustprone" in
+ selection menus [FALSE]
+
(...................)

Есть распакованный исходник этого NetHack-а с такой же структурой директорий.
Надо этот патч применить.

valentin160962

patch --help

Bird_V

И что? Читал я этот help. Но имею в результате фигу:

CYBERNOTE ~
$ patch --input nh343jl.diff --verbose
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nurd --exclude-from=diff_ign.txt nh343orig/README.nh343jl nh343jl/README.nh343jl
|--- nh343orig/README.nh343jl 1970-01-01 02:00:00.000000000 +0200
|+++ nh343jl/README.nh343jl 2004-07-13 17:21:18.804554288 +0300
--------------------------
Patching file `README.nh343jl' using Plan A...
Hunk succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
can't find file to patch at input line 112
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nurd --exclude-from=diff_ign.txt nh343orig/dat/opthelp nh343jl/dat/opthelp
|--- nh343orig/dat/opthelp 2003-12-08 01:39:13.000000000 +0200
|+++ nh343jl/dat/opthelp 2004-03-13 11:25:44.000000000 +0200
--------------------------
File to patch:


CYBERNOTE ~/nh343orig/dat
$ ls opt*
opthelp

Как видно из 1 листинга, он успешно читает файл, и даже создаёт README.nh434jl, правда почему-то в текущей директории. После чего почему-то не находит входной файл nh343orig/dat/opthelp, хотя он есть (см 2й листинг). В чём проблема?

Ivan8209

> В чём проблема?
Аллах не ведёт неверных?
А что ты делал, чтобы решить проблему?
Уверен, что патч именно к этому дереву?
---
"Vyroba umelych lidi, slecno, je tovarni tajemstvi."

dgaf

cd nh343orig
patch -p1 nh343jl.diff

Bird_V

, спасибо!
Оставить комментарий
Имя или ник:
Комментарий: