# HG changeset patch # User Matt Mackall # Date 2012-04-10 17:07:18 # Node ID c481761033bd13cfdebb5e7136b53263d1d13726 # Parent ccc173d0914ea384da2fbe12180118855c5d3de3 encoding: add fast-path for ASCII lowercase diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -168,6 +168,10 @@ def getcols(s, start, c): def lower(s): "best-effort encoding-aware case-folding of local string s" try: + return s.encode('ascii').lower() + except UnicodeDecodeError: + pass + try: if isinstance(s, localstr): u = s._utf8.decode("utf-8") else: