12198
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
"{ NameSpace: Tools }"
|
|
15 |
|
|
16 |
Object subclass:#TextMergeInfo
|
|
17 |
instanceVariableNames:'list listInfos'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-Diff'
|
|
21 |
!
|
|
22 |
|
|
23 |
Object subclass:#LineInfo
|
|
24 |
instanceVariableNames:'line resolution conflict'
|
|
25 |
classVariableNames:''
|
|
26 |
poolDictionaries:''
|
|
27 |
privateIn:TextMergeInfo
|
|
28 |
!
|
|
29 |
|
|
30 |
!TextMergeInfo class methodsFor:'documentation'!
|
|
31 |
|
|
32 |
copyright
|
|
33 |
"
|
|
34 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
35 |
All Rights Reserved
|
|
36 |
|
|
37 |
This software is furnished under a license and may be used
|
|
38 |
only in accordance with the terms of that license and with the
|
|
39 |
inclusion of the above copyright notice. This software may not
|
|
40 |
be provided or otherwise made available to, or used by, any
|
|
41 |
other person. No title to or ownership of the software is
|
|
42 |
hereby transferred.
|
|
43 |
"
|
|
44 |
! !
|
|
45 |
|
|
46 |
!TextMergeInfo methodsFor:'accessing'!
|
|
47 |
|
|
48 |
list
|
|
49 |
^ list
|
|
50 |
!
|
|
51 |
|
|
52 |
listInfos
|
|
53 |
^ listInfos
|
|
54 |
!
|
|
55 |
|
|
56 |
text
|
|
57 |
^list asString
|
|
58 |
|
|
59 |
"Created: / 19-03-2012 / 14:58:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
60 |
! !
|
|
61 |
|
|
62 |
!TextMergeInfo methodsFor:'initialization'!
|
|
63 |
|
|
64 |
text1: text1 text2: text2 text3: text3
|
|
65 |
|
|
66 |
| t1c t2c t3c merges lnr |
|
|
67 |
|
|
68 |
list := StringCollection new.
|
|
69 |
listInfos := OrderedCollection new.
|
|
70 |
|
|
71 |
text1 isNil ifTrue:[ ^self ].
|
|
72 |
text2 isNil ifTrue:[ ^self ].
|
|
73 |
text2 isNil ifTrue:[ ^self ].
|
|
74 |
|
|
75 |
|
|
76 |
t1c := text1 asStringCollection.
|
|
77 |
t2c := text2 asStringCollection.
|
|
78 |
t3c := text3 asStringCollection.
|
|
79 |
|
|
80 |
|
|
81 |
merges := Diff3 new
|
|
82 |
file0: t1c; "/Base version
|
|
83 |
file1: t2c; "/A
|
|
84 |
file2: t3c; "/B
|
|
85 |
merge.
|
|
86 |
lnr := 1.
|
|
87 |
merges do:[:merge|
|
|
88 |
merge key == #ok ifTrue:[
|
|
89 |
merge value do:[:line|
|
|
90 |
list add: line.
|
|
91 |
listInfos add: (LineInfo line: lnr resolution: #Merged ).
|
|
92 |
lnr := lnr + 1.
|
|
93 |
].
|
|
94 |
].
|
|
95 |
merge key == #conflict ifTrue:[
|
|
96 |
merge value length timesRepeat:[
|
|
97 |
list add:nil. "/no resolution now"
|
|
98 |
listInfos add: (LineInfo line: lnr resolution: #Conflict conflict: merge value).
|
|
99 |
lnr := lnr + 1.
|
|
100 |
].
|
|
101 |
].
|
|
102 |
].
|
|
103 |
|
|
104 |
self changed: #value
|
|
105 |
|
|
106 |
"Created: / 19-03-2012 / 12:10:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
107 |
! !
|
|
108 |
|
|
109 |
!TextMergeInfo methodsFor:'testing'!
|
|
110 |
|
|
111 |
isMerged
|
|
112 |
|
|
113 |
^listInfos allSatisfy:[:info|info isMerged].
|
|
114 |
|
|
115 |
"Created: / 19-03-2012 / 15:09:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
116 |
! !
|
|
117 |
|
|
118 |
!TextMergeInfo::LineInfo class methodsFor:'accessing'!
|
|
119 |
|
|
120 |
line:lineArg resolution:resolutionArg
|
|
121 |
^self new line:lineArg resolution:resolutionArg conflict:nil
|
|
122 |
|
|
123 |
"Created: / 19-03-2012 / 15:04:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
124 |
!
|
|
125 |
|
|
126 |
line:lineArg resolution:resolutionArg conflict:conflictArg
|
|
127 |
|
|
128 |
^self new line:lineArg resolution:resolutionArg conflict:conflictArg
|
|
129 |
|
|
130 |
"Modified: / 19-03-2012 / 15:07:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
131 |
! !
|
|
132 |
|
|
133 |
!TextMergeInfo::LineInfo methodsFor:'accessing'!
|
|
134 |
|
|
135 |
color
|
|
136 |
|
|
137 |
self isMerged ifTrue:[ ^ Tools::TextDiff3Tool colorMerged ].
|
|
138 |
self isConflict ifTrue:[ ^ Tools::TextDiff3Tool colorConflict ].
|
|
139 |
|
|
140 |
"Created: / 19-03-2012 / 15:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
141 |
!
|
|
142 |
|
|
143 |
conflict
|
|
144 |
^ conflict
|
|
145 |
!
|
|
146 |
|
|
147 |
line
|
|
148 |
^ line
|
|
149 |
!
|
|
150 |
|
|
151 |
line:lineArg resolution:resolutionArg
|
|
152 |
self line:lineArg resolution:resolutionArg conflict:nil
|
|
153 |
|
|
154 |
"Created: / 19-03-2012 / 15:04:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
155 |
!
|
|
156 |
|
|
157 |
line:lineArg resolution:resolutionArg conflict:conflictArg
|
|
158 |
line := lineArg.
|
|
159 |
resolution := resolutionArg.
|
|
160 |
conflict := conflictArg.
|
|
161 |
!
|
|
162 |
|
|
163 |
resolution
|
|
164 |
^ resolution
|
|
165 |
! !
|
|
166 |
|
|
167 |
!TextMergeInfo::LineInfo methodsFor:'printing & storing'!
|
|
168 |
|
|
169 |
printOn:aStream
|
|
170 |
"append a printed representation if the receiver to the argument, aStream"
|
|
171 |
|
|
172 |
self class nameWithoutPrefix printOn:aStream.
|
|
173 |
aStream space.
|
|
174 |
aStream nextPutAll:'line: '.
|
|
175 |
line printOn:aStream.
|
|
176 |
aStream space.
|
|
177 |
aStream nextPutAll:'resolution: '.
|
|
178 |
resolution printOn:aStream.
|
|
179 |
|
|
180 |
"Modified: / 19-03-2012 / 12:30:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
181 |
"Created: / 19-03-2012 / 15:05:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
182 |
! !
|
|
183 |
|
|
184 |
!TextMergeInfo::LineInfo methodsFor:'testing'!
|
|
185 |
|
|
186 |
isConflict
|
|
187 |
|
|
188 |
^resolution == #Conflict
|
|
189 |
|
|
190 |
"Created: / 19-03-2012 / 15:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
191 |
!
|
|
192 |
|
|
193 |
isMerged
|
|
194 |
|
|
195 |
^resolution == #Merged
|
|
196 |
|
|
197 |
"Created: / 19-03-2012 / 15:06:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
198 |
! !
|
|
199 |
|
|
200 |
!TextMergeInfo class methodsFor:'documentation'!
|
|
201 |
|
|
202 |
version_SVN
|
|
203 |
^ '$Id: Tools__TextMergeInfo.st 7944 2012-03-19 15:32:45Z vranyj1 $'
|
|
204 |
! !
|