$ hg merge
(branch merge, don't forget to commit. abort with hg rollback)
and then one tries to:
$ hg revert --all
abort: uncommitted merge - please provide a specific revision
$ hg rollback
(rolls back the last checked in revision and merges something into the
merge as well ...)
rupert.
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial
That is however not correct.
rollback will roll back a commit, but merge will not do a commit.
rollback will thus roll something else back - so don't do that.
A right way to undo a merge is "hg update -C". That is however the
answer to the general "how do I drop the uncommitted changes I have in
my working directory" question, so it would be a bit strange to say that
explicitly here. It would perhaps be just as relevant in all "hg status"
output.
I think that Mercurial generally seems to be less verbose than for
example git. We have at most one line of suggestions in the output. We
try to make Mercurial so simple that you don't need more than that ;-)
/Mads
'hg undo' would be nice here to just do the right thing...
Cheers,
Jas
Yes, we really need a "hg dwim" command.
On 06/25/2010 04:07 PM, Jason Harris wrote:Yes, we really need a "hg dwim" command.
Yep.
'hg undo' would be nice here to just do the right thing...
Because "clobber all my local changes" is rarely equivalent to "do what
I mean".
Generally speaking, we don't know how to "undo" a merge. We only know
how to clobber it.
--
Mathematics is the supreme nostalgia of our time.
i needed aborting a merge 3 times in four years. every single time i
tried to look up the command and did not find it again. but hg merge
tells me that i should not forget a commit, which i need once a day. i
created a patch to include this as well in the output.
> the general "how do I drop the uncommitted changes I have in my working
> directory" question, so it would be a bit strange to say that explicitly
> here. It would perhaps be just as relevant in all "hg status" output.
oh? i thought that is "hg revert"? the comment for revert says:
"
(Use update -r to check out earlier revisions, revert does not change the
working directory parents.)
"
and is what should happen: i do not want to change the working
directory parents, it should be the same as before the merge. just
like "hg add" and all other actions can be undone with a revert.
from a technical standpoint, the "update -C" is ok, but unfortunately
it is difficult to understand and remember.
rupert.
But the merge itself changed the parents: it added the other revision as the second
parent! Try "hg parents" before and after a merge.
As suggested, to "undo" a merge, meaning "go back to the state just before the
merge", you typically run "hg update --clean .", meaning "give me back the original
revision I had before (update .), throwing away all this stuff (--clean)".
Regards,
Wagner
Yes, merge might be the place where it is most likely that users will
need "up -C" most often - and for the first time.
For this reason it might make sense to mention it.
> from a technical standpoint, the "update -C" is ok, but unfortunately
> it is difficult to understand and remember.
I tend to agree. Perhaps a more convenient alias could be added, but
right now "hg update --clean ." is the right way to do it.
/Mads
IMHO there should not be a convenient alias for "update -C .". The
whole purpose of "update -C ." is to destroy information. It throws
away any uncommitted changes in your working directory. It's
*dangerous*! It's also essential, of course, which is why it exists.
And yes, it should definitely be mentioned in the help for merge,
using words like "discard uncommitted changes with no way to recover
them". I'm neutral on mentioning it in an advisory message: that
seems like inviting some poor unsuspecting soul to destroy their
uncommitted changes when that's not really what they meant to do.
Greg
the first try was "revert" which has the same effect - it is what the
user wants to do.
rupert.
On Fri, Jun 25, 2010 at 15:55, Mads Kiilerich <mads@kiile....com> wrote:
> On 06/25/2010 03:24 PM, rupert.thurner wrote:
>>
>> it would be very nice if mercurial would give a hint on how to abort a
>> merge. maybe it could write:
>>
>> $ hg merge
>> (branch merge, don't forget to commit. abort with hg rollback)
>
> That is however not correct.
>
> rollback will roll back a commit, but merge will not do a commit. rollback
> will thus roll something else back - so don't do that.
>
> A right way to undo a merge is "hg update -C". That is however the answer toi needed aborting a merge 3 times in four years. every single time i
tried to look up the command and did not find it again.
from a technical standpoint, the "update -C" is ok, but unfortunately
it is difficult to understand and remember.
Imo it would be much more intuitive if revert --all would have additional intelligence and revert the dirstate as well. If this is not possible one might question why a merge without commit already changes something in .hg. Undo a merge or merge commit are rare examples where mercurial exposes its implementation to the user interface.
Merge is such a central concept in mercurial, that it might be worth considering to give reverting it a little more love.
Rupert.