Patchwork hg: add support for HGUNICODEPEDANTRY environment variable

login
register
mail settings
Submitter Augie Fackler
Date June 26, 2014, 9 p.m.
Message ID <481442b80000b940994f.1403816401@augie-macbookair>
Download mbox | patch
Permalink /patch/5071/
State Accepted
Headers show

Comments

Augie Fackler - June 26, 2014, 9 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1403530387 14400
#      Mon Jun 23 09:33:07 2014 -0400
# Node ID 481442b80000b940994fd0270aead26f9b5978ce
# Parent  becb61de90a1a0384af535a393fb32e7da7a9059
hg: add support for HGUNICODEPEDANTRY environment variable

This lets us easily verify that there are no implicit conversions
between unicodes and bytes in Mercurial's codebase. Based on something
mpm did by hand periodically, but it kept regressing, so just open the
door to running it in a buildbot.
Matt Mackall - June 26, 2014, 11:31 p.m.
On Thu, 2014-06-26 at 17:00 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1403530387 14400
> #      Mon Jun 23 09:33:07 2014 -0400
> # Node ID 481442b80000b940994fd0270aead26f9b5978ce
> # Parent  becb61de90a1a0384af535a393fb32e7da7a9059
> hg: add support for HGUNICODEPEDANTRY environment variable

Queued for default, thanks.

Patch

diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -10,6 +10,11 @@ 
 import os
 import sys
 
+if os.environ.get('HGUNICODEPEDANTRY', False):
+    reload(sys)
+    sys.setdefaultencoding("undefined")
+
+
 libdir = '@LIBDIR@'
 
 if libdir != '@' 'LIBDIR' '@':