如何使用 Eclipse 将 .diff 补丁应用到 HtmlUnit
我正在尝试使用 此页面。我可以看到如何从 Eclipse 应用补丁,但我不知道如何应用这些特定补丁。我最初有 JAR,但后来我意识到我需要采购,所以我获得了这些,但仍然没有运气。
在补丁中我看到:
--- a/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
等等,但是“a/htmlunit”怎么了?我有这些包,并且“src/main/java/com/gargoylesoftware/htmlunit/WebClient.java”(例如)很容易找到,但不是 a/htmlunit。我真的不知道如何应用这个。
有人可以帮忙吗?
I'm trying to patch HtmlUnit with the patches at the bottom of this page. I can see how to apply patches from Eclipse, but I can't figure out how to apply these particular patches. I had the JARs initially, but then I realised I'd need to source, so I obtained those, but still no luck.
In the patch I see:
--- a/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
and etc. but what is up with the 'a/htmlunit'? I have the packages and "src/main/java/com/gargoylesoftware/htmlunit/WebClient.java" (for example) is easily locatable, but not a/htmlunit. I can't really figure out how to apply this.
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,补丁带有前缀,有点像将以前的版本放在目录
a
中,将新版本放在目录b
中,然后对它们进行比较以生成补丁,只需使用版本控制系统,你真的不需要再这样做了。我想大多数仍然是这样(至少 git 默认情况下是这样)。无论如何,补丁工具可以选择跳过多个目录级别作为前缀,在您的情况下,您必须跳过两个目录级别(a 和 htmlunit)。不幸的是,我不知道这是如何在 Eclipse 中完成的,使用 vanilla unix patch 你需要添加一个
-p2
参数。浏览一下 UI,它应该在某个地方。Usually, patches come with prefixes, kind of like putting the previous version in directory
a
, and the new version in directoryb
and just diffing them to produce the patch, only with version control systems, you don't really need to do that anymore. Most still do I suppose (at least git does by default).Anyway, patch-tools have an option to skip a number of directory levels as prefix, in your case you'd have to skip two (a and htmlunit). Unfortunately, I don't know how this is done in eclipse, with vanilla unix patch you would need to add a
-p2
parameter. Poke around the UI, it ought to be there somewhere.