[PATCH 2 of 7 hglib] hglib: make str(hglib.context.changectx) work with Python 3 (issue4520)
Brett Cannon
brett at python.org
Wed Mar 25 19:39:56 CDT 2015
# HG changeset patch
# User Brett Cannon <brett at python.org>
# Date 1427329041 14400
# Wed Mar 25 20:17:21 2015 -0400
# Node ID 6ec4075191ce919dcebdbf6b9f4e11948462030c
# Parent 11202c85737eef4677aa68f950ec985a5491c2ee
hglib: make str(hglib.context.changectx) work with Python 3 (issue4520)
diff -r 11202c85737e -r 6ec4075191ce hglib/context.py
--- a/hglib/context.py Wed Mar 25 20:15:54 2015 -0400
+++ b/hglib/context.py Wed Mar 25 20:17:21 2015 -0400
@@ -53,7 +53,7 @@
self._clean = None
def __str__(self):
- return self._node[:12]
+ return self._node[:12].decode('latin-1')
def __int__(self):
return self._rev
@@ -91,7 +91,7 @@
@util.propertycache
def _status(self):
- return self._parsestatus(self._repo.status(change=self))[:4]
+ return self._parsestatus(self._repo.status(change=strtobytes(self)))[:4]
def _parsestatus(self, stat):
d = dict((c, [])
@@ -107,7 +107,8 @@
Unless this method is used to query the working copy status, the
_status property will implicitly read the status using its default
arguments."""
- stat = self._parsestatus(self._repo.status(change=self, ignored=ignored,
+ stat = self._parsestatus(self._repo.status(change=strtobytes(self),
+ ignored=ignored,
clean=clean))
self._unknown = self._ignored = self._clean = None
if ignored:
@@ -166,7 +167,7 @@
@util.propertycache
def _manifest(self):
d = {}
- for node, p, e, s, path in self._repo.manifest(rev=self):
+ for node, p, e, s, path in self._repo.manifest(rev=strtobytes(self)):
d[path] = node
return d
@@ -179,7 +180,7 @@
@util.propertycache
def _parents(self):
"""return contexts for each parent changeset"""
- par = self._repo.parents(rev=self)
+ par = self._repo.parents(rev=strtobytes(self))
if not par:
return [changectx(self._repo, -1)]
return [changectx(self._repo, int(cset.rev)) for cset in par]
More information about the Mercurial-devel
mailing list