/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-06-04 19:17:13 UTC
  • mfrom: (0.193.10 trunk)
  • mto: This revision was merged to the branch mainline in revision 6778.
  • Revision ID: jelmer@jelmer.uk-20170604191713-hau7dfsqsl035slm
Bundle the cvs plugin.

Show diffs side-by-side

added added

removed removed

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