~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge3.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-06 12:06:20 UTC
  • mfrom: (1740 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060606120620-50066b0951e4ef7c
merge bzr.dev 1740

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# s: "i hate that."
20
20
 
21
21
 
22
 
from difflib import SequenceMatcher
23
 
 
24
22
from bzrlib.errors import CantReprocessAndShowBase
 
23
import bzrlib.patiencediff
25
24
from bzrlib.textfile import check_text_lines
26
25
 
 
26
 
27
27
def intersect(ra, rb):
28
28
    """Given two ranges return the range where they intersect or None.
29
29
 
294
294
            type, iz, zmatch, ia, amatch, ib, bmatch = region
295
295
            a_region = self.a[ia:amatch]
296
296
            b_region = self.b[ib:bmatch]
297
 
            matches = SequenceMatcher(None, a_region, 
298
 
                                      b_region).get_matching_blocks()
 
297
            matches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
298
                    None, a_region, b_region).get_matching_blocks()
299
299
            next_a = ia
300
300
            next_b = ib
301
301
            for region_ia, region_ib, region_len in matches[:-1]:
327
327
        """
328
328
 
329
329
        ia = ib = 0
330
 
        amatches = SequenceMatcher(None, self.base, self.a).get_matching_blocks()
331
 
        bmatches = SequenceMatcher(None, self.base, self.b).get_matching_blocks()
 
330
        amatches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
331
                None, self.base, self.a).get_matching_blocks()
 
332
        bmatches = bzrlib.patiencediff.PatienceSequenceMatcher(
 
333
                None, self.base, self.b).get_matching_blocks()
332
334
        len_a = len(amatches)
333
335
        len_b = len(bmatches)
334
336
 
384
386
 
385
387
    def find_unconflicted(self):
386
388
        """Return a list of ranges in base that are not conflicted."""
387
 
 
388
 
        import re
389
 
 
390
 
        # don't sync-up on lines containing only blanks or pounds
391
 
        junk_re = re.compile(r'^[ \t#]*$')
392
 
        
393
 
        am = SequenceMatcher(junk_re.match, self.base, self.a).get_matching_blocks()
394
 
        bm = SequenceMatcher(junk_re.match, self.base, self.b).get_matching_blocks()
 
389
        am = bzrlib.patiencediff.PatienceSequenceMatcher(
 
390
                None, self.base, self.a).get_matching_blocks()
 
391
        bm = bzrlib.patiencediff.PatienceSequenceMatcher(
 
392
                None, self.base, self.b).get_matching_blocks()
395
393
 
396
394
        unc = []
397
395