Mercurial > hg
changeset 16567:aef3d0d4631c
patch: clarify binary hunk parsing loop
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 29 Apr 2012 11:19:51 +0200 |
parents | ae6dddffe4f1 |
children | d7c9976b930e |
files | mercurial/patch.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Tue May 01 10:14:35 2012 +0200 +++ b/mercurial/patch.py Sun Apr 29 11:19:51 2012 +0200 @@ -1040,12 +1040,13 @@ hunk.append(l) return l.rstrip('\r\n') - line = getline(lr, self.hunk) - while line and not line.startswith('literal '): + while True: line = getline(lr, self.hunk) - if not line: - raise PatchError(_('could not extract "%s" binary data') - % self._fname) + if not line: + raise PatchError(_('could not extract "%s" binary data') + % self._fname) + if line.startswith('literal '): + break size = int(line[8:].rstrip()) dec = [] line = getline(lr, self.hunk)