Patchwork [6,of,8,py3] store: give name to lowerencode function

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 16, 2017, 2:31 p.m.
Message ID <1221362d1dbcff390d74.1505572290@mimosa>
Download mbox | patch
Permalink /patch/23941/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 16, 2017, 2:31 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504427170 -32400
#      Sun Sep 03 17:26:10 2017 +0900
# Node ID 1221362d1dbcff390d74307d4339d904e56fa665
# Parent  19726b35322ecc59a3879746ee24a08231d8bf0d
store: give name to lowerencode function

lambda function isn't easy to track in traceback.

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -162,7 +162,9 @@  def _buildlowerencodefun():
         cmap[chr(x)] = "~%02x" % x
     for x in range(ord("A"), ord("Z") + 1):
         cmap[chr(x)] = chr(x).lower()
-    return lambda s: "".join([cmap[c] for c in s])
+    def lowerencode(s):
+        return "".join([cmap[c] for c in s])
+    return lowerencode
 
 lowerencode = getattr(parsers, 'lowerencode', None) or _buildlowerencodefun()