Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 1308:2073e5a71008
Cleanup of tabs and trailing spaces.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 21 Sep 2005 07:56:19 +0200 |
parents | 1546c2aa6b30 |
children | c9cf171f30dd |
comparison
equal
deleted
inserted
replaced
1285:1546c2aa6b30 | 1308:2073e5a71008 |
---|---|
43 files.setdefault(pf, 1) | 43 files.setdefault(pf, 1) |
44 code = fp.close() | 44 code = fp.close() |
45 if code: | 45 if code: |
46 raise Abort("patch command failed: exit status %s " % code) | 46 raise Abort("patch command failed: exit status %s " % code) |
47 return files.keys() | 47 return files.keys() |
48 | 48 |
49 def binary(s): | 49 def binary(s): |
50 """return true if a string is binary data using diff's heuristic""" | 50 """return true if a string is binary data using diff's heuristic""" |
51 if s and '\0' in s[:4096]: | 51 if s and '\0' in s[:4096]: |
52 return True | 52 return True |
53 return False | 53 return False |
468 self.buf = collector.getvalue() | 468 self.buf = collector.getvalue() |
469 self.iterempty = True | 469 self.iterempty = True |
470 | 470 |
471 def read(self, l): | 471 def read(self, l): |
472 """Read L bytes of data from the iterator of chunks of data. | 472 """Read L bytes of data from the iterator of chunks of data. |
473 Returns less than L bytes if the iterator runs dry.""" | 473 Returns less than L bytes if the iterator runs dry.""" |
474 if l > len(self.buf) and not self.iterempty: | 474 if l > len(self.buf) and not self.iterempty: |
475 # Clamp to a multiple of self.targetsize | 475 # Clamp to a multiple of self.targetsize |
476 targetsize = self.targetsize * ((l // self.targetsize) + 1) | 476 targetsize = self.targetsize * ((l // self.targetsize) + 1) |
477 collector = cStringIO.StringIO() | 477 collector = cStringIO.StringIO() |
478 collector.write(self.buf) | 478 collector.write(self.buf) |