Patchwork [1,of,8] py3: make util.datapath a bytes variable

login
register
mail settings
Submitter Pulkit Goyal
Date Nov. 5, 2016, 11:16 p.m.
Message ID <2d456de3a41ab961da8a.1478387778@pulkit-goyal>
Download mbox | patch
Permalink /patch/17353/
State Accepted
Headers show

Comments

Pulkit Goyal - Nov. 5, 2016, 11:16 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1478381383 -19800
#      Sun Nov 06 02:59:43 2016 +0530
# Node ID 2d456de3a41ab961da8ae71dfefccdc9d7febe78
# Parent  a19a17a662f669546e75d51ec3b381beb51e737c
py3: make util.datapath a bytes variable

In this patch we make util.datapath a bytes variables.

Patch

diff -r a19a17a662f6 -r 2d456de3a41a mercurial/util.py
--- a/mercurial/util.py	Fri Nov 04 20:22:37 2016 -0700
+++ b/mercurial/util.py	Sun Nov 06 02:59:43 2016 +0530
@@ -938,6 +938,9 @@ 
 else:
     datapath = os.path.dirname(__file__)
 
+if not isinstance(datapath, bytes):
+    datapath = pycompat.fsencode(datapath)
+
 i18n.setdatapath(datapath)
 
 _hgexecutable = None