~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge3.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-26 13:51:08 UTC
  • mto: (5184.2.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5185.
  • Revision ID: v.ladeuil+lp@free.fr-20100426135108-vwmfphc2xg1w058c
Random cleanups to catch up with copyright updates in trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
# mbp: "you know that thing where cvs gives you conflict markers?"
19
19
# s: "i hate that."
20
20
 
21
 
 
22
 
from bzrlib.errors import CantReprocessAndShowBase
23
 
import bzrlib.patiencediff
24
 
from bzrlib.textfile import check_text_lines
 
21
from bzrlib import (
 
22
    errors,
 
23
    patiencediff,
 
24
    textfile,
 
25
    )
25
26
 
26
27
 
27
28
def intersect(ra, rb):
81
82
            objects.
82
83
        """
83
84
        if not allow_objects:
84
 
            check_text_lines(base)
85
 
            check_text_lines(a)
86
 
            check_text_lines(b)
 
85
            textfile.check_text_lines(base)
 
86
            textfile.check_text_lines(a)
 
87
            textfile.check_text_lines(b)
87
88
        self.base = base
88
89
        self.a = a
89
90
        self.b = b
107
108
            elif self.a[0].endswith('\r'):
108
109
                newline = '\r'
109
110
        if base_marker and reprocess:
110
 
            raise CantReprocessAndShowBase()
 
111
            raise errors.CantReprocessAndShowBase()
111
112
        if name_a:
112
113
            start_marker = start_marker + ' ' + name_a
113
114
        if name_b:
298
299
    def _refine_cherrypick_conflict(self, zstart, zend, astart, aend, bstart, bend):
299
300
        """When cherrypicking b => a, ignore matches with b and base."""
300
301
        # Do not emit regions which match, only regions which do not match
301
 
        matches = bzrlib.patiencediff.PatienceSequenceMatcher(None,
 
302
        matches = patiencediff.PatienceSequenceMatcher(None,
302
303
            self.base[zstart:zend], self.b[bstart:bend]).get_matching_blocks()
303
304
        last_base_idx = 0
304
305
        last_b_idx = 0
348
349
            type, iz, zmatch, ia, amatch, ib, bmatch = region
349
350
            a_region = self.a[ia:amatch]
350
351
            b_region = self.b[ib:bmatch]
351
 
            matches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
352
            matches = patiencediff.PatienceSequenceMatcher(
352
353
                    None, a_region, b_region).get_matching_blocks()
353
354
            next_a = ia
354
355
            next_b = ib
379
380
        """
380
381
 
381
382
        ia = ib = 0
382
 
        amatches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
383
        amatches = patiencediff.PatienceSequenceMatcher(
383
384
                None, self.base, self.a).get_matching_blocks()
384
 
        bmatches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
385
        bmatches = patiencediff.PatienceSequenceMatcher(
385
386
                None, self.base, self.b).get_matching_blocks()
386
387
        len_a = len(amatches)
387
388
        len_b = len(bmatches)
434
435
 
435
436
    def find_unconflicted(self):
436
437
        """Return a list of ranges in base that are not conflicted."""
437
 
        am = bzrlib.patiencediff.PatienceSequenceMatcher(
 
438
        am = patiencediff.PatienceSequenceMatcher(
438
439
                None, self.base, self.a).get_matching_blocks()
439
 
        bm = bzrlib.patiencediff.PatienceSequenceMatcher(
 
440
        bm = patiencediff.PatienceSequenceMatcher(
440
441
                None, self.base, self.b).get_matching_blocks()
441
442
 
442
443
        unc = []