~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge3.py

  • Committer: John Arbash Meinel
  • Date: 2005-11-30 15:43:57 UTC
  • mto: (1185.50.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1518.
  • Revision ID: john@arbash-meinel.com-20051130154357-614206b3a7b83cd0
Refactored bzrlib/ui.py into a module with the possibility for multiple ui forms.

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
22
23
from bzrlib.errors import CantReprocessAndShowBase
23
 
import bzrlib.patiencediff
24
 
from bzrlib.textfile import check_text_lines
25
 
 
26
24
 
27
25
def intersect(ra, rb):
28
26
    """Given two ranges return the range where they intersect or None.
68
66
    incorporating the changes from both BASE->OTHER and BASE->THIS.
69
67
    All three will typically be sequences of lines."""
70
68
    def __init__(self, base, a, b):
71
 
        check_text_lines(base)
72
 
        check_text_lines(a)
73
 
        check_text_lines(b)
74
69
        self.base = base
75
70
        self.a = a
76
71
        self.b = b
294
289
            type, iz, zmatch, ia, amatch, ib, bmatch = region
295
290
            a_region = self.a[ia:amatch]
296
291
            b_region = self.b[ib:bmatch]
297
 
            matches = bzrlib.patiencediff.PatienceSequenceMatcher(
298
 
                    None, a_region, b_region).get_matching_blocks()
 
292
            matches = SequenceMatcher(None, a_region, 
 
293
                                      b_region).get_matching_blocks()
299
294
            next_a = ia
300
295
            next_b = ib
301
296
            for region_ia, region_ib, region_len in matches[:-1]:
327
322
        """
328
323
 
329
324
        ia = ib = 0
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()
 
325
        amatches = SequenceMatcher(None, self.base, self.a).get_matching_blocks()
 
326
        bmatches = SequenceMatcher(None, self.base, self.b).get_matching_blocks()
334
327
        len_a = len(amatches)
335
328
        len_b = len(bmatches)
336
329
 
386
379
 
387
380
    def find_unconflicted(self):
388
381
        """Return a list of ranges in base that are not conflicted."""
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()
 
382
 
 
383
        import re
 
384
 
 
385
        # don't sync-up on lines containing only blanks or pounds
 
386
        junk_re = re.compile(r'^[ \t#]*$')
 
387
        
 
388
        am = SequenceMatcher(junk_re.match, self.base, self.a).get_matching_blocks()
 
389
        bm = SequenceMatcher(junk_re.match, self.base, self.b).get_matching_blocks()
393
390
 
394
391
        unc = []
395
392