comparison hglib/context.py @ 151:b91356bf7186

hglib: use strtobytes() (issue4520)
author Brett Cannon <brett@python.org>
date Thu, 19 Mar 2015 17:42:46 -0400
parents 958307b30af3
children ef8eb78fc88d
comparison
equal deleted inserted replaced
150:b94e1263836c 151:b91356bf7186
1 import hglib.client # Circular dependency. 1 import hglib.client # Circular dependency.
2 from hglib import util, templates 2 from hglib import util, templates
3 from hglib.error import CommandError 3 from hglib.error import CommandError
4 from hglib.util import b 4 from hglib.util import b, strtobytes
5 5
6 _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''), 6 _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''),
7 b(''), b(''), b(''), b('')] 7 b(''), b(''), b(''), b('')]
8 8
9 class changectx(object): 9 class changectx(object):
18 cset = changeid 18 cset = changeid
19 elif changeid == -1: 19 elif changeid == -1:
20 cset = _nullcset 20 cset = _nullcset
21 else: 21 else:
22 if isinstance(changeid, (long, int)): 22 if isinstance(changeid, (long, int)):
23 changeid = b('rev(') + str(changeid).encode('latin-1') + b(')') 23 changeid = b('rev(') + strtobytes(changeid) + b(')')
24 24
25 notfound = False 25 notfound = False
26 try: 26 try:
27 cset = self._repo.log(changeid) 27 cset = self._repo.log(changeid)
28 # hg bbf4f3dfd700 gave a null result for tip+1 28 # hg bbf4f3dfd700 gave a null result for tip+1