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

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

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