46 Its main use is for the SourceCodeManager, to show merged sources after |
46 Its main use is for the SourceCodeManager, to show merged sources after |
47 a failed checkin. |
47 a failed checkin. |
48 " |
48 " |
49 ! ! |
49 ! ! |
50 |
50 |
51 !Diff3TextView class methodsFor:'instance creation'! |
51 !Diff3TextView class methodsFor:'instance creation'! |
52 |
52 |
53 openOnMergedText:text label:firstLabel label:secondLabel label:thirdLabel |
53 openOnMergedText:text label:firstLabel label:secondLabel label:thirdLabel |
54 "open up a view showing firstText, secondText and thirdText side-by-side, |
54 "open up a view showing firstText, secondText and thirdText side-by-side, |
55 and labels for all views." |
55 and labels for all views." |
56 |
56 |
82 and:('private.rc' asFilename contentsOfEntireFile) |
82 and:('private.rc' asFilename contentsOfEntireFile) |
83 label:'private.rc' |
83 label:'private.rc' |
84 " |
84 " |
85 |
85 |
86 "Modified: 12.12.1995 / 13:09:13 / cg" |
86 "Modified: 12.12.1995 / 13:09:13 / cg" |
|
87 ! ! |
|
88 |
|
89 !Diff3TextView class methodsFor:'public helpers'! |
|
90 |
|
91 emphasizeMergedDiff3Text:mergedText emphasize1:e1 emphasize2:e2 emphasizeSep:e3 |
|
92 "given the merge()/rcsmerge() merged output (as created by 'cvs update'), |
|
93 create & return a text object which contains the conflicts |
|
94 highlighted. |
|
95 CAVEAT: this is a highly specialized method - probably not the right place |
|
96 for it here ..." |
|
97 |
|
98 |dIdx dEnd state s entry c list skip sep| |
|
99 |
|
100 list := OrderedCollection new. |
|
101 |
|
102 dIdx := 1. |
|
103 dEnd := mergedText size + 1. |
|
104 state := #initial. |
|
105 [dIdx < dEnd] whileTrue:[ |
|
106 dIdx == dEnd ifTrue:[ |
|
107 "dummy cleanup entry" |
|
108 entry := nil. |
|
109 state := #initial. |
|
110 ] ifFalse:[ |
|
111 entry := mergedText at:dIdx. |
|
112 dIdx := dIdx + 1. |
|
113 ]. |
|
114 |
|
115 skip := false. |
|
116 |
|
117 entry notNil ifTrue:[ |
|
118 sep := nil. |
|
119 |
|
120 (entry startsWith:'<<<<<<<') ifTrue:[ |
|
121 state := 1. skip := true. sep := '----- your version ----'. |
|
122 ] ifFalse:[ |
|
123 (entry startsWith:'|||||||') ifTrue:[ |
|
124 state := 2. skip := true. |
|
125 ] ifFalse:[ |
|
126 (entry startsWith:'=======') ifTrue:[ |
|
127 state == 2 ifFalse:[ |
|
128 state := 23 "/ on both 2 and 3 |
|
129 ] ifTrue:[ |
|
130 state := 3 "/ only in 3 |
|
131 ]. |
|
132 skip := true. |
|
133 sep := '----- other version ----'. |
|
134 ] ifFalse:[ |
|
135 (entry startsWith:'>>>>>>>') ifTrue:[ |
|
136 state := #initial. |
|
137 skip := true. |
|
138 sep := '------------------------'. |
|
139 ] |
|
140 ] |
|
141 ] |
|
142 ]. |
|
143 |
|
144 sep notNil ifTrue:[ |
|
145 list add:(Text |
|
146 string:sep |
|
147 emphasis:e3). |
|
148 ]. |
|
149 |
|
150 skip ifFalse:[ |
|
151 state == #initial ifTrue:[ |
|
152 list add:entry |
|
153 ]. |
|
154 state == 1 ifTrue:[ |
|
155 e1 notNil ifTrue:[ |
|
156 list add:(Text string:entry emphasis:e1) |
|
157 ] ifFalse:[ |
|
158 list add:entry |
|
159 ] |
|
160 ]. |
|
161 (state == 3 or:[state == 23]) ifTrue:[ |
|
162 e2 notNil ifTrue:[ |
|
163 list add:(Text string:entry emphasis:e2) |
|
164 ] ifFalse:[ |
|
165 list add:entry |
|
166 ] |
|
167 ]. |
|
168 ]. |
|
169 ]. |
|
170 ]. |
|
171 |
|
172 ^ list |
|
173 |
|
174 "Created: 9.9.1996 / 19:54:00 / cg" |
|
175 "Modified: 9.9.1996 / 20:41:40 / cg" |
87 ! ! |
176 ! ! |
88 |
177 |
89 !Diff3TextView methodsFor:'initialization'! |
178 !Diff3TextView methodsFor:'initialization'! |
90 |
179 |
91 initStyle |
180 initStyle |