[PATCH] context: don't hex encode all unknown 20 char revision specs (issue4890)

Mads Kiilerich mads at kiilerich.com
Fri Oct 9 05:57:10 CDT 2015


On 10/09/2015 06:16 AM, Matt Mackall wrote:
> On Fri, 2015-10-09 at 01:20 +0200, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski at unity3d.com>
>> # Date 1444346377 -7200
>> #      Fri Oct 09 01:19:37 2015 +0200
>> # Node ID dfa056583dbbec4e0a2cc31366a46599c989a979
>> # Parent  3f234db6fe8d7cc3d39083f7e7523444bc21e5a2
>> context: don't hex encode all unknown 20 char revision specs (issue4890)
>>
>> d3908c911d5e introduced nice hexified display of missing nodes. It did however
>> also make missing 20 character revision specifications be shown as hex - very
>> confusing.
>>
>> Users are often wrong and somehow specify revisions that don't exist. Nodes
>> will however rarely be missing ... and they will only look like a user provided
>> revision specification and be all ascii in 1 of 4*10**9.
> It's actually 4e8, not 9. Which means it has something like a 1% chance
> for mysteriously breaking one of the repos at my day job.

Yes, if you make lookup of all the nodes and none of them exists.

I don't know, what is the simplest way of triggering a lookup of a 
non-existing node?

>> -                if len(changeid) == 20:
>> +                if len(changeid) == 20 and nonascii(changeid):
>>                       changeid = hex(changeid)
> You cannot put a regex check in the context creation fast path. That
> code desperately needs to be faster, not slower.
>
> You are, however, welcome to make the error handler as slow as you want.

This _is_ in the error handler.

/Mads


More information about the Mercurial-devel mailing list