[SVN]svn如何生成patch和打(导入)patch文件的简单方法


转自 svn生成patch和打(导入)patch文件的方法_怎么用svn生成自己的ppk文件_ameyume的博客-CSDN博客

生成patch文件:
svn diff > patchFile // 整个工程的变动生成patch
或svn diff file > patchFile // 某个文件单独变动的patch

svn回滚:
svn revert FILE // 单个文件回滚
svn revert DIR --depth=infinity // 整个目录进行递归回滚

打patch:
patch -p0 < test.patch // -p0 选项要从当前目录查找目的文件(夹)

patch -p1 < test.patch // -p1 选项要从当前目录查找目的文件,不包含patch中的最上级目录(夹)
例如两个版本以a,b开头,而a,b并不是真正有效地代码路径,则这时候需要使用"-p1"参数。
a/src/…
b/src/…

svn patch test.patch


实例 注意p0和p1的区别

linbo@atel4gdonglesrv3-pc:/home/atel4gdonglesrv3/work/linbo/work/k80/job/asr1826/trunk/base$ patch -p1 < 0001.patch 
patching file package/kernel/mrvl-fastpath/files/fp_common.h
patching file package/kernel/mrvl-fastpath/files/fp_database.h
patching file package/kernel/mrvl-fastpath/files/fp_database_hash.c
patching file package/kernel/mrvl-fastpath/files/fp_learner_nc.c
linbo@atel4gdonglesrv3-pc:/home/atel4gdonglesrv3/work/linbo/work/k80/job/asr1826/trunk/base$ patch -p0 < 0001.patch  
can't find file to patch at input line 7
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/package/kernel/mrvl-fastpath/files/fp_common.h b/package/kernel/mrvl-fastpath/files/fp_common.h
|old mode 100644
|new mode 100755
|index 88d9a9a..cccd8c6
|--- a/package/kernel/mrvl-fastpath/files/fp_common.h
|+++ b/package/kernel/mrvl-fastpath/files/fp_common.h
--------------------------
File to patch: 




在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/xiaowang_lj/article/details/132045464