Mercurial - 检查健全补丁

时间:2012-03-17 17:41:07

标签: mercurial

我正在使用Mercurial,感谢这个命令:hg diff

这是我的差异(例子):

diff -r 17899716342e config.js
--- a/config.js Sat Mar 17 14:01:53 2012 +0100
+++ b/config.js Sat Mar 17 18:15:16 2012 +0100
@@ -8,6 +8,6 @@
 ];

 config.hostname = 'localhost';
-config.port = '3000';
+config.port = '8080';

-module.exports = canfig;
+module.exports = config;

在另一个存储库中,我想测试是否可以应用此差异。我知道hg import可以在我当前的存储库中导入diff。

来自男人:

-f --force                   skip check for outstanding uncommitted changes
    --no-commit              don't commit, just update the working directory
    --bypass                 apply patch without touching the working
                             directory

但是没有理由只检查补丁是否可以应用而不修改我的存储库(以及我的工作树)

我该怎么做?

2 个答案:

答案 0 :(得分:2)

如果您不想修改当前的工作目录或存储库,我建议制作一个本地一次性克隆并将补丁应用于它。我不认为有办法做到这一点。

使用扩展程序,您可以搁置当前更改,应用修补程序,将清理更新回原始父级,取消保留更改。克隆似乎更简单。

答案 1 :(得分:0)

我最喜欢@Mark Tolonen的答案 - 在Mercurial中,一个新的本地克隆几乎是即时的,并且由于使用了硬链接而几乎没有空间。

但是,如果您无法遵守,请使用--no-commit选项然后还原。

  1. hg import --no-commit the.diff#检查是否成功
  2. hg revert --all#撤消尝试导入
相关问题