640
|
1 |
"
|
|
2 |
Copyright (c) 2007-2010 Jan Vrany
|
|
3 |
Copyright (c) 2009-2010 eXept Software AG
|
|
4 |
|
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
25 |
"
|
|
26 |
"{ Package: 'stx:libsvn' }"
|
|
27 |
|
|
28 |
"{ NameSpace: SVN }"
|
|
29 |
|
|
30 |
Object subclass:#ExternalMergeTool
|
|
31 |
instanceVariableNames:'tempDir textA labelA textB labelB textC labelC textMerged'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'SVN-Diff-External'
|
|
35 |
!
|
|
36 |
|
|
37 |
!ExternalMergeTool class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
|
41 |
Copyright (c) 2007-2010 Jan Vrany
|
|
42 |
Copyright (c) 2009-2010 eXept Software AG
|
|
43 |
|
|
44 |
Permission is hereby granted, free of charge, to any person
|
|
45 |
obtaining a copy of this software and associated documentation
|
|
46 |
files (the 'Software'), to deal in the Software without
|
|
47 |
restriction, including without limitation the rights to use,
|
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the
|
|
50 |
Software is furnished to do so, subject to the following
|
|
51 |
conditions:
|
|
52 |
|
|
53 |
The above copyright notice and this permission notice shall be
|
|
54 |
included in all copies or substantial portions of the Software.
|
|
55 |
|
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
63 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
64 |
|
|
65 |
"
|
|
66 |
! !
|
|
67 |
|
|
68 |
!ExternalMergeTool class methodsFor:'testing'!
|
|
69 |
|
|
70 |
isAvailable
|
|
71 |
"raise an error: must be redefined in concrete subclass(es)"
|
|
72 |
|
|
73 |
^ self subclassResponsibility
|
|
74 |
! !
|
|
75 |
|
|
76 |
!ExternalMergeTool methodsFor:'accessing'!
|
|
77 |
|
|
78 |
labelA
|
|
79 |
^ labelA ? 'A'
|
|
80 |
!
|
|
81 |
|
|
82 |
labelA:aString
|
|
83 |
labelA := aString.
|
|
84 |
!
|
|
85 |
|
|
86 |
labelB
|
|
87 |
^ labelB ? 'B'
|
|
88 |
!
|
|
89 |
|
|
90 |
labelB:aString
|
|
91 |
labelB := aString.
|
|
92 |
!
|
|
93 |
|
|
94 |
labelC
|
|
95 |
^ labelC ? 'C'
|
|
96 |
!
|
|
97 |
|
|
98 |
labelC:aString
|
|
99 |
labelC := aString.
|
|
100 |
!
|
|
101 |
|
|
102 |
textA
|
|
103 |
^ textA
|
|
104 |
!
|
|
105 |
|
|
106 |
textA:aString
|
|
107 |
textA := aString.
|
|
108 |
!
|
|
109 |
|
|
110 |
textB
|
|
111 |
^ textB
|
|
112 |
!
|
|
113 |
|
|
114 |
textB:aString
|
|
115 |
textB := aString.
|
|
116 |
!
|
|
117 |
|
|
118 |
textC
|
|
119 |
^ textC
|
|
120 |
!
|
|
121 |
|
|
122 |
textC:aString
|
|
123 |
textC := aString.
|
|
124 |
!
|
|
125 |
|
|
126 |
textMerged
|
|
127 |
^ textMerged
|
|
128 |
! !
|
|
129 |
|
|
130 |
!ExternalMergeTool methodsFor:'merging'!
|
|
131 |
|
|
132 |
merge
|
|
133 |
|
|
134 |
tempDir := Filename newTemporaryDirectory.
|
|
135 |
[self
|
|
136 |
save: textA as: tempDir / 'a.txt';
|
|
137 |
save: textB as: tempDir / 'b.txt';
|
|
138 |
save: textC as: tempDir / 'c.txt'.
|
|
139 |
|
|
140 |
self runExternalProgram.
|
|
141 |
(tempDir / 'merged.txt') exists ifTrue:
|
|
142 |
[textMerged := (tempDir / 'merged.txt') readStream contents asString].
|
|
143 |
] ensure:
|
|
144 |
[tempDir recursiveRemove.
|
|
145 |
tempDir := nil]
|
|
146 |
! !
|
|
147 |
|
|
148 |
!ExternalMergeTool methodsFor:'private'!
|
|
149 |
|
|
150 |
runExternalProgram
|
|
151 |
|
|
152 |
self subclassResponsibility
|
|
153 |
!
|
|
154 |
|
|
155 |
save: aString as: aFilename
|
|
156 |
|
|
157 |
| s |
|
|
158 |
s := aFilename asFilename writeStream.
|
|
159 |
[s nextPutAll: aString]
|
|
160 |
ensure:[s close]
|
|
161 |
! !
|
|
162 |
|
|
163 |
!ExternalMergeTool class methodsFor:'documentation'!
|
|
164 |
|
|
165 |
version
|
|
166 |
^ '$Header$'
|
|
167 |
!
|
|
168 |
|
|
169 |
version_CVS
|
|
170 |
^ '$Header$'
|
|
171 |
!
|
|
172 |
|
|
173 |
version_SVN
|
|
174 |
^ '§Id: SVN__ExternalMergeTool.st 350 2011-07-07 18:42:56Z vranyj1 §'
|
|
175 |
! !
|