Patchwork [5,of,6,foldmap-in-C,V2] encoding.upper: factor out fallback code

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2015, 10:51 p.m.
Message ID <e8023e64800c8a009eac.1428015114@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8461/
State Accepted
Headers show

Comments

Siddharth Agarwal - April 2, 2015, 10:51 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1427873441 25200
#      Wed Apr 01 00:30:41 2015 -0700
# Node ID e8023e64800c8a009eac62cfc37cc7d39484b282
# Parent  29fdd81a2553fb8e4a493ee2706bd7a22df890d0
encoding.upper: factor out fallback code

This will be used as the fallback function on Windows.

Patch

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -338,7 +338,9 @@  def upper(s):
     try:
         return asciiupper(s)
     except UnicodeDecodeError:
-        pass
+        return upperfallback(s)
+
+def upperfallback(s):
     try:
         if isinstance(s, localstr):
             u = s._utf8.decode("utf-8")