Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 37087:f0b6fbea00cf
stringutil: bulk-replace call sites to point to new module
This might conflict with other patches floating around, sorry.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 22 Mar 2018 21:56:20 +0900 |
parents | c268ba15deb3 |
children | a8a902d7176e |
comparison
equal
deleted
inserted
replaced
37086:f99d64e8a4e4 | 37087:f0b6fbea00cf |
---|---|
38 scmutil, | 38 scmutil, |
39 similar, | 39 similar, |
40 util, | 40 util, |
41 vfs as vfsmod, | 41 vfs as vfsmod, |
42 ) | 42 ) |
43 from .utils import dateutil | 43 from .utils import ( |
44 dateutil, | |
45 stringutil, | |
46 ) | |
44 | 47 |
45 diffhelpers = policy.importmod(r'diffhelpers') | 48 diffhelpers = policy.importmod(r'diffhelpers') |
46 stringio = util.stringio | 49 stringio = util.stringio |
47 | 50 |
48 gitre = re.compile(br'diff --git a/(.*) b/(.*)') | 51 gitre = re.compile(br'diff --git a/(.*) b/(.*)') |
1459 l = ord(l) - ord('a') + 27 | 1462 l = ord(l) - ord('a') + 27 |
1460 try: | 1463 try: |
1461 dec.append(util.b85decode(line[1:])[:l]) | 1464 dec.append(util.b85decode(line[1:])[:l]) |
1462 except ValueError as e: | 1465 except ValueError as e: |
1463 raise PatchError(_('could not decode "%s" binary patch: %s') | 1466 raise PatchError(_('could not decode "%s" binary patch: %s') |
1464 % (self._fname, util.forcebytestr(e))) | 1467 % (self._fname, stringutil.forcebytestr(e))) |
1465 line = getline(lr, self.hunk) | 1468 line = getline(lr, self.hunk) |
1466 text = zlib.decompress(''.join(dec)) | 1469 text = zlib.decompress(''.join(dec)) |
1467 if len(text) != size: | 1470 if len(text) != size: |
1468 raise PatchError(_('"%s" length is %d bytes, should be %d') | 1471 raise PatchError(_('"%s" length is %d bytes, should be %d') |
1469 % (self._fname, len(text), size)) | 1472 % (self._fname, len(text), size)) |