[PATCH 0 of 8 RFC] Add guard option to update, which aborts if the update is unsafe

Laurens Holst laurens.nospam at grauw.nl
Thu Jan 5 09:59:29 CST 2012


Op 05-01-12 16:41, Martin Geisler schreef:
> Laurens Holst <laurens.nospam at grauw.nl> writes:
>
>> Hi Dennis,
>>
>> Op 27-12-2011 12:05, Dennis Brakhane schreef:
>>> On Thu, Dec 22, 2011 at 1:24 AM, Laurens Holst<laurens.nospam at grauw.nl>  wrote:
>>>> The driving factor here is really that because you have unversioned changes
>>>> in your local working copy, Mercurial should tread extra carefully. The
>>>> default behaviour of update is I think too destructive in some situations,
>>>> and I would like to have access to a safer version.
>>> Just to be sure: are you aware that hg stores a copy of the original
>>> files before
>>> merging, and you can always get them back and re-merge using "hg
>>> resolve -u" followed
>>> by "hg resolve"?
>> I had seen the code, but to be honest I didn’t realise this :) so
>> thanks for pointing it out.
>>
>> However it does not really help much, there is still no way to easily
>> go back to the working copy state before the update, especially not
>> when files were moved or deleted.
> I would think that 'hg resolve --tool internal:local' will handle those.

Not deletes or conflicting moves or permission changes, these are
prompted for outside the resolve mechanism. And I wouldn’t call it
‘easy’ either.

>> There are also some .orig files created containing old file contents,
> True, but I'm fine with the .orig files being around. I think people
> should just ignore them.

Yeah, I just meant that the original changes are usually there in .orig
files as well, so not lost entirely.

>> but reconstructing all of this back to a pre-update working copy
>> involves a lot of nontrivial interaction.
> Did we not discuss this recently -- as in here:
>
>   http://markmail.org/message/izeibc7ixlwehwuf

I don’t read that list, sorry...

> I suffer from a bad cold right now, so I'm probably not thinking too
> clearly, but what's missing from the 'hg resolve' recipe I give in that
> mail?

How is that trivial interaction? :)

You say yourself, “So it's definitely not something to play around with
on your first try with Mercurial”. There is still lots of prompting and
stuff going on, especially when conflicting files are moved or
permissions are changed.

Also the example is not exactly easily found, and the average user will
probably consider his original changes lost and start to work on
resolving the conflict because that’s the easiest way to get back to
working code, or try to recover his changes from the .orig-files.

The point is to make it low-effort, so that you don’t get disrupted from
your coding flow by being forced to deal with merge conflicts. I think
for many users, hg update is kind of Russian roulette :). They update
praying no conflicts occur.

~Laurens



More information about the Mercurial-devel mailing list