用于有选择地排除 diff 文件的某些部分的交互式程序

发布于 2024-11-28 16:54:15 字数 482 浏览 2 评论 0原文

是否有一个程序(最好在 Cygwin 上可用)可以用来交互式地“过滤” diff 文件?即我想要类似 git Interactive add 的东西,除了我想对 diff 文件进行操作。我已经发现了 filterdiff,但我不认为它支持交互式编辑,仅根据预定义的搜索条件包含/排除帅哥。

我的使用场景:我在 MQ 中有一个补丁,我想根据此处的教程将其拆分: https://www.mercurial-scm.org/wiki/MqTutorial#Split_a_patch_into_multiple_patches。为了做到这一点,我必须编辑一个补丁文件,以便它只包含我想要的(许多)更改,并且使用文本编辑器手动执行此操作有点痛苦。

谢谢!

Is there a program (preferably available on Cygwin) which I can use to "filter" a diff file interactively? i.e. I want something like git interactive add, except that I want to operate on a diff file. I have already discovered filterdiff, but I don't think that it supports interactive editing, only inclusion/exclusion of hunks based on a pre-defined search criteria.

My usage scenario: I have a patch in MQ, which I would like to split up per the tutorial here: https://www.mercurial-scm.org/wiki/MqTutorial#Split_a_patch_into_multiple_patches. In order to do so, I have to edit a patch file so that it includes only the (many) changes I want, and doing this manually with a text editor is kind of a pain.

Thanks!

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

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

发布评论

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

评论(2

夜未央樱花落 2024-12-05 16:54:15

您可能可以使用记录扩展获得您想要的内容:https://www.mercurial-scm。 org/wiki/RecordExtension

应用补丁(但不要提交),然后使用 record 有选择地逐块提交。您可以在有或没有 mq 的情况下做到这一点。

You can probably get what you want using the record extension: https://www.mercurial-scm.org/wiki/RecordExtension

Apply the patch (but don't commit it) and then selectively commit chunk by chunk using record. You could do that with or without mq in the works.

情话已封尘 2024-12-05 16:54:15

Emacs 的 diff-mode 具有用于(取消)应用或删除 diff 的各个块的命令。它还允许编辑 hunk(自动保持 hunk 标头最新),并且它有一个 hunk-split 命令,该命令比 中的命令更强大>git add -p

Emacs’ diff-mode has commands to (un)apply or delete individual hunks of a diff. It also allows editing the hunks (keeping the hunk headers up to date automatically), and it has a hunk-split command that is a bit more powerful than that in git add -p.

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