合并Mercurial中的两个补丁

kan*_*kan 2 mercurial patch

我想合并两个补丁。可悲的是,我删除了导出这些补丁的分支。你们能建议一种合并两个补丁的方法吗?

我在Ubuntu 12.04机器上使用Mercurial 2.0.2。

Pau*_*l S 5

如果启用了MQ,并假设您以空的修补程序队列开始:

> hg qimport patch1        # Import & apply the first patch into a patch queue
> hg qimport patch2        # Import & apply the second patch into a patch queue
> hg qpop;                 # Pop the second patch (unapply)
> hg qfold patch2          # Fold the second patch into the first (result is called 'patch1')
> hg qexport > new_merged_patch
Run Code Online (Sandbox Code Playgroud)

然后,您可以:

> hg qfinish -a            # Convert the currently applied patches (e.g. patch1) to changesets)
Run Code Online (Sandbox Code Playgroud)

要么:

> hg qpop                  # Pop the merged patch
> hg qdel patch1           # Delete it from the queue
Run Code Online (Sandbox Code Playgroud)

老实说,为此使用MQ实在是太过分了,但这是一个有用的扩展。