- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我收到了上下文差异格式的补丁,我需要在 Git 中应用它。据我所知,Git 只能应用统一差异格式的补丁。
有什么方法可以将上下文差异转换为统一差异格式,以便我可以 git apply
修改后的补丁?
最佳答案
这是我最近在寻找同一问题的解决方案时找到的解决方案。使用quilt :
dev-util/quilt-0.65::gentoo was built with the following:
USE="-emacs -graphviz" ABI_X86="(64)"
从 gentoo 和以下命令行 session ,我能够轻松地将上下文差异转换为统一差异,并将 strip 级别(补丁中的选项 -p)从 -p0 调整为 -p1(请始终使用 -p1 伙计们,这将使您和其他人的生活更加轻松!)
$ tar xf SDL2-2.0.8.tar.gz
$ cd SDL2-2.0.8
$ quilt new SDL2-2.0.8.unified.patch
$ quilt --quiltrc - fold -p 0 < ../SDL2-2.0.8.context.patch # arbitrary -p0 context diff I created for this exercise
$ quilt refresh
# your new -p1 unified diff can be found at SDL2-2.0.8/patches/SDL2-2.0.8.unified.patch
在这里回答这个问题,因为这是谷歌中与将上下文差异转换为统一差异相关的查询的最高结果之一。
应该在任何发行版中工作,为了后代,我只是准确地报告我所拥有的。
刚刚找到了一个“更好”的方法,但需要自己的准备工作。为此,您只需要补丁文件本身。您将需要 patchutils
dev-util/patchutils-0.3.4::gentoo was built with the following:
USE="-test" ABI_X86="(64)"
$ $EDITOR SDL2-2.0.8.context.patch
# remove all lines like: 1 diff -cr SDL2-2.0.8/src/SDL.c SDL2-2.0.8.new/src/SDL.c (apparently not needed in current git)
# save and quit
$ filterdiff --format=unified < SDL2-2.0.8.context.patch > SDL2-2.0.8.unified.patch
# you can even do this inside vim with
:%!filterdiff --format=unified
希望这对您有所帮助!
关于git - 将上下文差异转换为统一差异格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50166072/
我正在为期末考试学习,但我无法理解这个 FC 算法: 我理解你标准化每条规则的部分。然后我认为下一行是说对于满足广义 Modus Ponens (p'_iTheta = p_iTheta) 的每个 t
我有一个 3d 世界,它有一个 simpel 平台和一个代表玩家的立方体。当我旋转平台时,立方体会滑动并按照您预期的方式执行,增加和减少物理 Material 中的摩擦力。 我希望立方体在输入例如 f
所以我的 Unity 项目有一个大问题。我昨天工作,我没有做备份今天,在我打开项目后,我的笔记本电脑因电池电量不足而关机。之后,当我进入项目时,我得到了这个:加载“Assets/MyScene.uni
好的,我正在尝试创建一个函数来确定元组列表是否是可传递的,即如果 (x,y) 和 (y,z) 在列表中,那么 (x,z) 也在列表中。 例如,[(1,2), (2,3), (1,3)]是传递的。 现在
这个问题在这里已经有了答案: How to pass data between scenes in Unity (5 个回答) 9 个月前关闭。 我有一个游戏,我有一个队列匹配系统。 我想向玩家展示他
我现在正在为我的游戏创建一个 keystore (统一)但是当我按下添加键按钮时,会弹出一个错误 Java Development Kit (JDK) directory is not set or
我想将YouTube流视频放入Cardboard(适用于Android和iOS)应用中。我知道这些插件可以执行类似的操作,例如“Easy Movie Texture”,但它们不支持YouTube流媒体
我需要限制 ConfigurableJoint 的目标旋转以避免关节变形或破坏。 为了了解角度限制的工作原理,我做了一个实验。 在场景中放置一个人形模型。 为骨骼添加ConfigurableJoint
尝试实现一种有限形式的匹配统一。 尝试匹配两个公式匹配如果我们能找到替代出现在公式中的变量使得两者在句法上是等价。 我需要写一个函数来判断一个对应于基本项的常数,例如 Brother(George)
我正在使用 Unity 和 C#我想在运行时将输出日志文件发送到我的电子邮件,我使用了来自 this question 的 ByteSheep 答案和来自 this question 的 Arkane
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我希望能够将鼠标悬停在游戏对象(代理)上并在右键或左键单击时创建一个类似于 Windows 右键单击菜单的 float 菜单。我试过结合使用 OnGUI() 和 OnMouseOver() 但我要
我正在为 oculus Gear VR 开发游戏(考虑内存管理),我需要在特定时间(以秒为单位)后加载另一个屏幕 void Start () { StartCoroutine (loadSce
我设法生成了敌人,但它们一直在生成。如何设置限制,避免不断生成? 我已经尝试添加 spawnLimit 和 spawnCounter 但无法让它工作。 var playerHealth = 100;
我正在参加使用 Unity 进行游戏开发的在线类(class),讲师有时会含糊不清。我的印象是使用游戏对象与使用游戏对象名称(在本例中为 MusicPlayer)相同,但是当我尝试将 MusicPla
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this qu
为了好玩,我正在(用 Java)开发一个使用统一算法的应用程序。 我选择了我的统一算法返回所有可能的统一。例如,如果我尝试解决 添加(X,Y)=成功(成功(0)) 返回 {X = succ(succ(
如何让对象在一段时间后不可见(或只是删除)?使用 NGUI。 我的示例(更改): public class scriptFlashingPressStart : MonoBehaviour {
我有下一个错误: The type or namespace name 'NUnit' could not be found (are you missing a using directive or
这是可以做到的 但是属性 autoSizeTextType 只能用于 API LEVEL >= 26,并且 Android Studio 会显示有关该问题的烦人警告。 为了摆脱这个问题,我想以编程方
我是一名优秀的程序员,十分优秀!