Linux补丁忽略行号 [英] linux patch ignoring line numbers

查看:58
本文介绍了Linux补丁忽略行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个产品(例如版本1),并且对其进行了一些自定义更改(例如版本1.x).我正在这些版本上运行差异并创建补丁文件.

I have an product (say version 1) and there are some custom changes made to it (say version 1.x). I am running a diff on these versions and creating a patch file.

现在有该产品的更高版本(例如版本2).我希望将从版本1和版本1.x创建的补丁应用到版本2.这里的困难是行号将不会保持恒定.我知道可能也有一些失败的请求,但是如果我可以在版本2上应用补丁(至少忽略行号,但请参考上下两行),则至少可以节省很多手动工作.

Now there is a later version of the product (say version 2). I wish to apply the patch created from version 1 and version 1.x onto version 2. The difficulty here is that the line numbers will not remain constant. I understand there might be some failed hunks as well but atleast it will save me a lot of manual effort if I can apply the patch on version 2 (by ignoring the line numbers but by referring the lines below and above).

最好的方法是什么?有什么建议么?还有什么有用的工具可以在这里提供帮助吗?

What's the best way to go about it? Any suggestions? Also any useful tools which can help here?

谢谢!高拉夫

推荐答案

补丁将正常执行此操作.您会看到它说类似

Patch will do that normally. You'll see it say something like

Hunk #1 succeeded at 6 (offset 5 lines).

在与原始行号不同的行号上应用补丁时.

when it applies a patch at a different line number from the original.

如果某些相邻的行已更改,但是仍然有足够的上下文来确定在何处应用补丁,它将显示 fuzz N ,其中N是未添加的上下文行的数量.t匹配.

If some of the neighboring lines have changed, but there is still enough context to determine where to apply the patch, it will say with fuzz N where N is the number of context lines that didn't match.

这篇关于Linux补丁忽略行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆