问题描述
如果我已经花了一段时间的代码,却忘记了自己创建补丁系列,那么我该如何追溯地创建补丁系列呢?到目前为止,唯一想到的是:
If I've been churning away at the code for a while, and forgotten to create a patch series as I go, how do I create the patch series retrospectively? So far the only thing that comes to mind is:
# Prepare and test the first batch of changes.
$ hg qrecord -m 'first batch' 1.patch
$ hg qnew -m 'stash downstream changes' stash-1.patch
$ hg qdelete -k temp-1.patch
$ make hello
cc hello.c -o hello
hello.c: In function ‘main’:
hello.c:4: error: syntax error at end of input
make: *** [hello] Error 1
$ echo '}' >> hello.c
$ make hello
cc hello.c -o hello
$ hg qrefresh
# Recover the stashed changes.
$ patch -p1 < .hg/patches/last.patch
# And around we go again!
$ hg qrecord -m 'second batch' 2.patch
$ hg qnew -m 'stash downstream changes' stash-2.patch
$ hg qdelete -k stash-2.patch
$ make hello
...
这种非常麻烦的方法也是危险的.我可能会忘记qdelete
上的-k
,这时我要用额头在砖墙上猛击几分钟,或者在qrecord操作期间可能包括太多或太少.
This very cumbersome approach is also hazardous. I might forget the -k
on qdelete
, at which point I'll go bash my forehead against a brick wall for several minutes, or I might include too much or too little during the qrecord operation.
有更好的方法吗?
(我真正想要的是能够将hg qpop
移到要分割的补丁之前,并使用当前不存在的命令hg qunrecord
以交互方式将变更从补丁中吸取到我的工作目录.对更改感到满意后,hg qnew -f
可以在旧版本之前压缩一个新补丁.)
(What I'd really like is to be able to hg qpop
to just before a patch I want to split, and use a currently non-existent command, hg qunrecord
, to interactively suck changes out of the patch into my working directory. Once I'm happy with the changes, hg qnew -f
could squeeze a new patch in front of the old one.)
推荐答案
MQTutorial 解释了如何分割补丁.因此,您可以根据当前工作创建一个补丁,并将其拆分为几个补丁.
The MQTutorial explains how to split patches. So you could create a patch from you current work and split it into several patches.
这篇关于如何将工作分为多个队列和多个队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!