comparison hglib/client.py @ 154:11202c85737e

hglib: make sure hgclient.diff() works with bytes (issue4520)
author Brett Cannon <brett@python.org>
date Wed, 25 Mar 2015 20:15:54 -0400
parents c1b966866ed7
children f22f3ff3cfae
comparison
equal deleted inserted replaced
153:ef8eb78fc88d 154:11202c85737e
1 import subprocess, os, struct, re, datetime 1 import subprocess, os, struct, re, datetime
2 import hglib 2 import hglib
3 from hglib import error, util, templates, merge, context 3 from hglib import error, util, templates, merge, context
4 4
5 from hglib.util import b, cmdbuilder, BytesIO 5 from hglib.util import b, cmdbuilder, BytesIO, strtobytes
6 6
7 class revision(tuple): 7 class revision(tuple):
8 def __new__(cls, rev, node, tags, branch, author, desc, date): 8 def __new__(cls, rev, node, tags, branch, author, desc, date):
9 return tuple.__new__(cls, (rev, node, tags, branch, author, desc, date)) 9 return tuple.__new__(cls, (rev, node, tags, branch, author, desc, date))
10 10
666 exclude - exclude names matching the given patterns 666 exclude - exclude names matching the given patterns
667 """ 667 """
668 if change and revs: 668 if change and revs:
669 raise ValueError('cannot specify both change and rev') 669 raise ValueError('cannot specify both change and rev')
670 670
671 args = cmdbuilder(b('diff'), r=revs, c=change, 671 args = cmdbuilder(b('diff'), r=list(map(strtobytes, revs)), c=change,
672 a=text, g=git, nodates=nodates, 672 a=text, g=git, nodates=nodates,
673 p=showfunction, reverse=reverse, 673 p=showfunction, reverse=reverse,
674 w=ignoreallspace, b=ignorespacechange, 674 w=ignoreallspace, b=ignorespacechange,
675 B=ignoreblanklines, U=unified, stat=stat, 675 B=ignoreblanklines, U=unified, stat=stat,
676 S=subrepos, I=include, X=exclude, hidden=self.hidden, 676 S=subrepos, I=include, X=exclude, hidden=self.hidden,