组合 2 个修补文件,修补目录中的多个文件 +解决冲突

发布于 2024-09-06 18:18:02 字数 426 浏览 8 评论 0原文

我有一个包含数千个文件的目录和两个适用于同一目录的补丁文件。每个补丁文件修补 dir 或其子目录中的 20-30 个文件。

如果我将任一补丁应用到共同祖先目录,它就会成功。

但是,如果我先应用一个修补程序文件,然后再应用另一个修补程序文件,则会失败,因为应用一个修补程序文件后行编号已更改。 (两个补丁文件都存储与共同祖先的差异)。另外,在某些地方存在冲突,我想使用一些图形工具(如 meld)进行三向合并。

我的目标是对补丁文件进行 3 路合并,然后根据共同祖先递归地比较最终目录以创建单个补丁文件。

一种方法是创建共同祖先的 2 个副本,将不同的补丁应用到其中 2 个副本,然后使用 meld 进行合并。 meld 会花费大量时间比较未更改的文件(dir 有数千个文件)。有更好的方法吗?

如果您输入准确的命令,我将不胜感激,因为我是 Linux 新手。

I have a dir with thousands of files and 2 patch files that apply to the same dir. Each patch file patches 20-30 files in dir or it's subdirs.

If I apply either patch to the common ancestor dir, it succeeds.

But if I apply one patch file followed by the other, it fails because the line numbering has changed after one patch file is applied. (Both patch files store the diff from the common ancestor). Also at some places there are conflicts that I would like to do 3-way merge using some graphical tool like meld.

My goal is to do a 3-way merge from the patch files and then diff this final dir recursively against the common ancestor to create a single patch file.

One way to do it would be creating 2 copies of the common ancestor, applying the different patches to 2 of the copies and then doing a merge using meld. meld would spend a lot of time comparing files that did not change (dir has thousands of files). Is there a better way of doing this?

I would appreciate if you put in exact commands since I'm a linux newbie.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

郁金香雨 2024-09-13 18:18:02

后者似乎是一个不错的选择:合并两个修补的文件树。除非您可以通过在合并之前删除未更改的文件来优化流程,从而在每个修补的文件树中留下文件集的并集。然而,只有当需要经常这样做时才有意义。

The latter seems to be a good choice: merging of 2 patched file trees. Except you can optimize process by dropping out unchanged files before merging leaving union of file sets in each patched file tree. However, it makes sense only if it's needed quite often to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文