在darcs中,如果我想重新排序到顶部(或者只是丢弃)其他修补程序所依赖的修补程序(即更改同一个文件),该怎么办?
在git中,我只需做一个git rebase -i <UNTOUCHED-REVISION>并重新排序或丢弃一些更改;然后git将以一种愚蠢的方式尝试将旧的更改逐一应用于树的新变体,并要求我解决出现的冲突。
在darcs中,我没有办法强迫它忽略补丁之间的依赖关系。如果我obliterate或suspend (或unrecord)是其他补丁所依赖的补丁,那么darcs拒绝这样做。(因为它想以一种聪明的方式行事。)
发布于 2015-12-28 14:35:12
我有以下计划:
以下是关于这一切进展情况的一些说明。
1.挂起相关补丁
如果依赖于修补程序重新排序的修补程序中只有一个“最小”补丁(根据依赖关系图),那么只需给出挂起它的命令(在此之后,不存在依赖于重新排序补丁的“活动”修补程序):
darcs suspend -h <MINIMAL-DEPENDENT-HASH>(并确认暂停所有其他依赖补丁)。
当然,如果有几个最小的依赖补丁,您必须挂起每个补丁(每个子图都会被要求暂停)。
2.保存和恢复不必要的更改
准备工作
首先,我看一下我将要处理的更改:
darcs diff -h 61fbb4aeac9e69cf30d232eda274c18194d7a8d9 --diff-command='emacs -f ediff-directories-with-ancestor-command %1 %2'(这个更改在逻辑上很简单,但是diff以一种复杂的方式展示了它,因此,在这里,我通过我为此目的编写的一个特殊函数启动了Emacs的底座。)
我看到的变化包括一些清理和增加一个新的功能。因此,现在的计划是拆分它:取消补丁记录,然后记录两个补丁。
darcs unrec -h 61fbb4aeac9e69cf30d232eda274c18194d7a8d9现在,我也可以用狄夫来观察和(也许,工作)变化。
darcs diff --diff-command='emacs -f ediff-directories-with-ancestor-command %1 %2'首先,我记录了清理补丁(只选择和编辑相关的块)。然后,添加的操作:
darcs rec -m 'examples/Process.hs: code cleanup (present as a sequence of actions and error handling)'
darcs rec -m 'examples/Process.hs: print the C program (from the AST) after the check (as gcc -E does)'保存为修补程序(变体)
您可以使用darcs obliterate -o或-O保存已删除的更改,然后使用darcs apply (根据that advice)进行还原。
但我采取了不同的做法:
以分支形式保存(变体)
克隆对于带有挂起补丁的回购不起作用:
~/TOOLS/prog/language-c $ darcs clone . ../language-c_printAST
darcs failed: Can't clone a repository with a rebase in progress
~/TOOLS/prog/language-c $ 因此,让我们复制一个副本(并检查是否允许我们从中提取):
~/TOOLS/prog/language-c $ cp -a ../language-c ../language-c_printAST
~/TOOLS/prog/language-c $ darcs pull ../language-c_printAST
darcs failed: Incompatibility with repository /home/imz/TOOLS/prog/language-c_printAST:
Cannot transfer patches from a repository where a rebase is in progress
~/TOOLS/prog/language-c $ cd ../language-c_printAST/
~/TOOLS/prog/language-c_printAST $ darcs rebase obliterate
<...>
Really obliterate all undecided patches? y
Rebase finished!
~/TOOLS/prog/language-c_printAST $ cd ../language-c
~/TOOLS/prog/language-c $ darcs pull ../language-c_printAST
HINT: if you want to change the default remote repository to
/home/imz/TOOLS/prog/language-c_printAST,
quit now and issue the same command with the --set-default flag.
No remote patches to pull in!
~/TOOLS/prog/language-c $ 好的,很好,那我们以后再把那辆车停下来。
恢复更改
丢弃不需要的(或重新订购)修补程序:
darcs obliterate3.取消应提交给它的补丁程序
此时创建回购的备份副本是个好主意,因为在解除暂停和解决冲突期间,您可能会搞砸一些事情。
取消应该出现在它之前的补丁。(不幸的是,unsuspend不支持外部合并工具。)最好一个一个地取消它们,因为您将不得不解决每个冲突并修改修补程序:
darcs rebase unsuspend
# resolve conflicts
darcs amend
# repeat for the remaining patches you want to have4.应用已保存的修补程序
darcs pull ../../language-c_printAST
# resolve conflicts
darcs amend5.取消所有剩余的补丁。
(再说一遍,最好是一个接一个地做。)
darcs rebase unsuspend
# resolve conflicts
darcs amend
# repeat for the remaining patches you want to have(出于某种原因,在第一次尝试中,我在最后一个未挂起的补丁中失去了一个大块头。但是,我在备份副本的副本中重复了所有的事情,在那里我达到了希望的最终状态。)
https://stackoverflow.com/questions/34495458
复制相似问题