~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge3.py

  • Committer: Aaron Bentley
  • Date: 2007-03-12 19:56:41 UTC
  • mto: (1551.19.24 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 2353.
  • Revision ID: abentley@panoramicfeedback.com-20070312195641-ezjnseqwgjtkh0iu
merge3 auto-detects line endings for conflict markers

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
                    reprocess=False):
89
89
        """Return merge in cvs-like form.
90
90
        """
 
91
        newline = '\n'
 
92
        if len(self.a) > 0:
 
93
            if self.a[0].endswith('\r\n'):
 
94
                newline = '\r\n'
 
95
            elif self.a[0].endswith('\r'):
 
96
                newline = '\r'
91
97
        if base_marker and reprocess:
92
98
            raise CantReprocessAndShowBase()
93
99
        if name_a:
111
117
                for i in range(t[1], t[2]):
112
118
                    yield self.b[i]
113
119
            elif what == 'conflict':
114
 
                yield start_marker + '\n'
 
120
                yield start_marker + newline
115
121
                for i in range(t[3], t[4]):
116
122
                    yield self.a[i]
117
123
                if base_marker is not None:
118
 
                    yield base_marker + '\n'
 
124
                    yield base_marker + newline
119
125
                    for i in range(t[1], t[2]):
120
126
                        yield self.base[i]
121
 
                yield mid_marker + '\n'
 
127
                yield mid_marker + newline
122
128
                for i in range(t[5], t[6]):
123
129
                    yield self.b[i]
124
 
                yield end_marker + '\n'
 
130
                yield end_marker + newline
125
131
            else:
126
132
                raise ValueError(what)
127
133