linux - 我应该如何应用这种类型的补丁?

标签 linux bash patch

一些补丁只是提供

317c317
<                global $wgScript, $wgUser, $wgParser, $wgTitle, $wgOut;
---
>                global $wgScript, $wgUser, $wgParser, $wgTitle, $wgOut, $wgLocalTZoffset;
370c370,371
<                               $output .= "<div class='news-bulletin-time'>" . date("M j, Y g:i a",strtotime($row->cl_timestamp)) . "</div>";
---
>                               //Patched to display correct time in current time zone
>                               $output .= "<div class='news-bulletin-time'>" . date("M j, Y g:i a",strtotime($row->cl_timestamp) + ($wgLocalTZoffset * 60)) . "</div>";

如何打补丁?

最佳答案

只需使用 patch工具,以及您的文件。

patch original.txt diffs.patch

这成立,如果 diffs.patch 是由 diff 生成的补丁,没有额外的参数(你的例子似乎是)。例如,如果你有一个统一的差异(diff -u),你必须通过传递适当的标志(-u)来告诉 patch > 用于统一差异)。

关于linux - 我应该如何应用这种类型的补丁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10123133/

相关文章:

ruby - Monkeypatching Vagrant 插件

linux - 如何删除损坏的文件?

linux - 关闭 STDOUT 如何影响 printf

linux - 如何获得一个进程的总内存,该进程在 linux 中使用 shell fork 了许多子进程?

linux - find 命令适用于提示,而不是 bash 脚本 - 通过变量传递多个参数

linux - 不使用 "crontab -e"命令编辑crontab文件有什么风险?

java - 无法从 Java 为 Latex 运行终端命令

.net - 将.Net Web应用程序部署到非Windows服务器

eclipse - 是否可以根据已提交的更改在 Eclipse 中创建补丁?

python - 装饰 lxml.etree._Element 方法