# HG changeset patch # User Brett Cannon # Date 1426883682 14400 # Node ID ef8eb78fc88df516d835d4ab532807aee4d0e82f # Parent 0808bb03add5fe4f264ac90926f64b3ca6b75730 hglib: don't try to use long under Python 3 (issue4520) diff -r 0808bb03add5 -r ef8eb78fc88d hglib/context.py --- a/hglib/context.py Fri Mar 20 16:32:53 2015 -0400 +++ b/hglib/context.py Fri Mar 20 16:34:42 2015 -0400 @@ -1,7 +1,7 @@ import hglib.client # Circular dependency. from hglib import util, templates from hglib.error import CommandError -from hglib.util import b, strtobytes +from hglib.util import b, strtobytes, integertypes _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''), b(''), b(''), b(''), b('')] @@ -19,7 +19,7 @@ elif changeid == -1: cset = _nullcset else: - if isinstance(changeid, (long, int)): + if isinstance(changeid, integertypes): changeid = b('rev(') + strtobytes(changeid) + b(')') notfound = False diff -r 0808bb03add5 -r ef8eb78fc88d hglib/util.py --- a/hglib/util.py Fri Mar 20 16:32:53 2015 -0400 +++ b/hglib/util.py Fri Mar 20 16:34:42 2015 -0400 @@ -7,12 +7,14 @@ if sys.version_info[0] > 2: izip = zip + integertypes = (int,) def b(s): """Encode the string as bytes.""" return s.encode('latin-1') else: from itertools import izip + integertypes = (long, int) def b(s): """Encode the string as bytes."""