[PATCH 3 of 4 V6 STABLE] revert: suggest update on revert to non-parent

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Jun 21 13:19:17 CDT 2011


On Jun 21, 2011, at 2:31 AM, Adrian Buehlmann wrote:

> On 2011-06-21 06:11, Kevin Bullock wrote:
>> [...]
>> 
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -4180,16 +4180,27 @@
>> 
>>     parent, p2 = repo.dirstate.parents()
>> 
>> +    ctx = scmutil.revsingle(repo, opts.get('rev'))
>> +    node = ctx.node()
>> +
>> +    dirty = util.any(repo.status())
> 
> There's no need to pay for an extra status call here, we only need dirty
> if no patterns are specified and --all was not set
> 
> Move it to under the if (like I did)

Hmm, good point. This way let me structure the cases to only have one util.Abort() call at the end, but would have us pay for the dirty check even if we aren't going to abort (and thus won't need it).

Please don't queue this one yet—I'll wait to see if 1 and/or 2 get queued before sending an update.

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock



More information about the Mercurial-devel mailing list