mercurial - 使用 "hg unshelve"就像使用 Git 取消存储一样

标签 mercurial shelve unshelve

当调用 hg unshelve --keep 时出现冲突,我需要解决冲突,然后再次调用 hg unshelve --continue --keep。为什么需要最后一步?为什么我无法在不解析提交的情况下直接调用 hg unshelve --continue --keep - 以摆脱 unshelving 状态?

c:\temp\hg test>hg st
M new.txt

c:\temp\hg test>hg commit -m "fjdjkfs"

c:\temp\hg test>hg unshelve --keep
unshelving change 'shelve'
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
merging new.txt
warning: conflicts during merge.
merging new.txt incomplete! (edit conflicts, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')

c:\temp\hg test>hg st
M new.txt
? new.txt.orig

c:\temp\hg test>hg unshelve --keep --continue
abort: unresolved conflicts, can't continue
(see 'hg resolve', then 'hg unshelve --continue')

c:\temp\hg test>hg resolve --mark

c:\temp\hg test>hg unshelve --keep --continue
no changes needed to new.txt
unshelve of 'shelve' complete

c:\temp\hg test>hg st
warning: ignoring unknown working parent 11667b875a2d!
? new.txt.orig

最佳答案

Why is the last step necessary?

因为可能尚未应用所有更改。 merge 冲突可能在取消搁置操作的中途发生。在这种情况下,您需要将控制权传回 Mercurial 以应用剩余的更改。

And why I can't invoke hg unshelve --continue --keep directly without resolving the commit - to get out of the unshelving state?

如果您只想退出取消搁置状态,并且不关心将更改正确应用到工作目录,则应该执行hg unshelve --abort--continue 标志用于在修复 merge 冲突后恢复取消搁置。 Mercurial 不会让您在不解决冲突的情况下执行此操作,因为这会使您的工作目录处于损坏状态。

有关这些参数的更多信息,请参阅 hg help unshelve

关于mercurial - 使用 "hg unshelve"就像使用 Git 取消存储一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29497260/

相关文章:

version-control - 不能忽略 Mercurial Commit (TortoiseHG) 中的文件

Python 和使用 shelve.py 卡住应用程序

visual-studio-2010 - TF203015 项目 $/path/file 有不兼容的待处理更改。当试图解架时

python - 搁置(python)真的很奇怪

mercurial - 有没有办法在 hg unshelve -i 输出中手动应用差异?

unshelve - TFS : Can a shelveset be restored to another location?

mercurial - 是否有一个简单的 Mercurial 存储库下载器

mercurial - 仅限本地分行

mercurial - Mercurial 存储库中的变更集可以按时间顺序 merge 吗?

tfs - 在 TFS2010 中看到搁置的变化