When invoking hg unshelve --keep
and I get a conflict, I need to resolve the conflict and then invoke hg unshelve --continue --keep
again. Why is the last step necessary? And why I can't invoke hg unshelve --continue --keep
directly without resolving the commit - to get out of the unshelving state?
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
Description. The "hg shelve" command saves changes made to the working directory and reverts those changes, resetting the working directory to a clean state.
Why is the last step necessary?
Because it's possible that not all changes have been applied yet. The merge conflict may happen halfway through the unshelving operation. In this case, you need to pass control back to Mercurial to apply the remaining changes.
And why I can't invoke
hg unshelve --continue --keep
directly without resolving the commit - to get out of the unshelving state?
If you just want to get out of the unshelving state, and don't care about applying the changes correctly to your working directory, you should just do hg unshelve --abort
. The --continue
flag is for resuming the unshelve after fixing merge conflicts. Mercurial won't let you do that without resolving the conflicts because this would leave your working directory in a broken state.
See hg help unshelve
for more information about these arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With