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

Matt Mackall mpm at selenic.com
Thu Oct 8 23:16:40 CDT 2015


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.

> -                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.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list