diff mercurial/util.py @ 30314:8321b083a83d

py3: make util.datapath a bytes variable In this patch we make util.datapath a bytes variable, but we have to pass a unicode to gettext.translation otherwise it will cry. Used pycompat.fsdecode() to decode it back to unicode as it was converted to bytes using pycompat.fsencode().
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 06 Nov 2016 12:18:23 +0900
parents 6a8aff737a17
children 4b1af1c867fa
line wrap: on
line diff
--- a/mercurial/util.py	Sun Nov 06 03:12:40 2016 +0530
+++ b/mercurial/util.py	Sun Nov 06 12:18:23 2016 +0900
@@ -938,6 +938,9 @@
 else:
     datapath = os.path.dirname(__file__)
 
+if not isinstance(datapath, bytes):
+    datapath = pycompat.fsencode(datapath)
+
 i18n.setdatapath(datapath)
 
 _hgexecutable = None