/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 bzrlib/textmerge.py

  • Committer: John Ferlito
  • Date: 2009-09-02 04:31:45 UTC
  • mto: (4665.7.1 serve-init)
  • mto: This revision was merged to the branch mainline in revision 4913.
  • Revision ID: johnf@inodes.org-20090902043145-gxdsfw03ilcwbyn5
Add a debian init script for bzr --serve

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 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
17
17
# Author: Martin Pool <mbp@canonical.com>
18
18
#         Aaron Bentley <aaron.bentley@utoronto.ca>
19
19
 
20
 
from .lazy_import import lazy_import
21
 
lazy_import(globals(), """
22
 
import patiencediff
23
 
""")
 
20
 
 
21
import bzrlib.patiencediff
24
22
 
25
23
 
26
24
class TextMerge(object):
39
37
    """
40
38
    # TODO: Show some version information (e.g. author, date) on conflicted
41
39
    # regions.
42
 
    A_MARKER = b'<<<<<<< \n'
43
 
    B_MARKER = b'>>>>>>> \n'
44
 
    SPLIT_MARKER = b'=======\n'
45
 
 
 
40
    A_MARKER = '<<<<<<< \n'
 
41
    B_MARKER = '>>>>>>> \n'
 
42
    SPLIT_MARKER = '=======\n'
46
43
    def __init__(self, a_marker=A_MARKER, b_marker=B_MARKER,
47
44
                 split_marker=SPLIT_MARKER):
48
45
        self.a_marker = a_marker
134
131
        """Return structured merge info.
135
132
        See TextMerge docstring.
136
133
        """
137
 
        sm = patiencediff.PatienceSequenceMatcher(
138
 
            None, self.lines_a, self.lines_b)
 
134
        sm = bzrlib.patiencediff.PatienceSequenceMatcher(None, self.lines_a, self.lines_b)
139
135
        pos_a = 0
140
136
        pos_b = 0
141
137
        for ai, bi, l in sm.get_matching_blocks():
142
138
            # non-matching lines
143
139
            yield(self.lines_a[pos_a:ai], self.lines_b[pos_b:bi])
144
140
            # matching lines
145
 
            yield(self.lines_a[ai:ai + l],)
 
141
            yield(self.lines_a[ai:ai+l],)
146
142
            pos_a = ai + l
147
143
            pos_b = bi + l
148
144
        # final non-matching lines