/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/_groupcompress_py.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from __future__ import absolute_import
24
24
 
25
 
from breezy import osutils
 
25
from . import osutils
26
26
 
27
27
 
28
28
class _OutputHandler(object):
127
127
            try:
128
128
                matches[line].add(start_idx + idx)
129
129
            except KeyError:
130
 
                matches[line] = set([start_idx + idx])
 
130
                matches[line] = {start_idx + idx}
131
131
 
132
132
    def get_matches(self, line):
133
133
        """Return the lines which match the line in right."""
414
414
 
415
415
def make_delta(source_bytes, target_bytes):
416
416
    """Create a delta from source to target."""
417
 
    if type(source_bytes) is not str:
 
417
    if not isinstance(source_bytes, str):
418
418
        raise TypeError('source is not a str')
419
 
    if type(target_bytes) is not str:
 
419
    if not isinstance(target_bytes, str):
420
420
        raise TypeError('target is not a str')
421
421
    line_locations = LinesDeltaIndex(osutils.split_lines(source_bytes))
422
422
    delta, _ = line_locations.make_delta(osutils.split_lines(target_bytes),
426
426
 
427
427
def apply_delta(basis, delta):
428
428
    """Apply delta to this object to become new_version_id."""
429
 
    if type(basis) is not str:
 
429
    if not isinstance(basis, str):
430
430
        raise TypeError('basis is not a str')
431
 
    if type(delta) is not str:
 
431
    if not isinstance(delta, str):
432
432
        raise TypeError('delta is not a str')
433
433
    target_length, pos = decode_base128_int(delta)
434
434
    lines = []