/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/_groupcompress_py.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

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 bzrlib 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 = []