[PATCH RFC] revert: add --force option

Adrian Buehlmann adrian at cadifra.com
Mon Jun 6 15:04:07 CDT 2011


On 2011-06-06 21:53, Matt Mackall wrote:
> On Mon, 2011-06-06 at 21:22 +0200, Adrian Buehlmann wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1307360197 -7200
>> # Node ID b05c07a481984fd50e5e29fd6cea614dbecc5434
>> # Parent  e597ef52a7c21ffe862339225bd915438f2dddcc
>> revert: add --force option
>>
>> With this change, 'revert --all -r REV' aborts if REV is not a parent and
>> '--force' was not set.
>>
>> Catches newbies trying to use this pattern where they should use update.
>>
>> 'hg revert --all -r REV' is rarely needed,
> 
> 'hg revert -a -r .' is actually fairly common for doing dummy merges.

Did you see that 'hg revert -a -r .' doesn't require -f?

> And -a is already our 'force' switch for this command.

Ok. I see. Then all bets are off.

> But this is not the problem. The problem is that people who don't
> understand that there is a thing called a 'working directory' with a
> thing called 'parents' will be unable to understand that the result they
> get (the files versions they wanted!) when forcing a revert is not what
> they wanted.

I don't think we can improve anything here anymore, given all the
requirements.

> Let me lay out the scenario again:
> 
> "I want to check out an old version.. what's the opposite of update?"
> 
> "Let's look at help.."
> 
> "Huh, 'restore individual files or directories to an earlier state'..
> that sounds promising!" <- FAILURE STARTS HERE
> 
> "hg revert 1.0 gives me a weird error, let's look at the syntax"
> 
> "Ahh, I see, I need a -r 1.0.." <- No one actually reads the docs
> 
> "Still a weird error, apparently I need a --all for some reason
> (annoying!)"
> 
> "Ok, that looks like it worked"
> 
> (hours pass)
> 
> "Why is my status so screwed up?"
> 
> Adding a -f step in here won't help.
> 
> So the real problem is at the summary line. It's basically impossible to
> summarize revert in a way that will make sense to new users without
> either confusing it with update or (even worse!) a generalized undo
> command.



More information about the Mercurial-devel mailing list