1 "{ Package: 'stx:libscm/mercurial' }" |
1 "{ Package: 'stx:libscm/mercurial' }" |
2 |
2 |
3 Object subclass:#HGCommand |
3 Object subclass:#HGCommand |
4 instanceVariableNames:'workingDirectory' |
4 instanceVariableNames:'workingDirectory' |
5 classVariableNames:'HGExecutable Debugging' |
5 classVariableNames:'HGExecutable HGVersion Debugging' |
6 poolDictionaries:'' |
6 poolDictionaries:'' |
7 category:'SCM-Mercurial-Internal' |
7 category:'SCM-Mercurial-Internal' |
8 ! |
8 ! |
9 |
9 |
10 HGCommand subclass:#add |
10 HGCommand subclass:#add |
119 |
126 |
120 "Modified: / 12-11-2012 / 22:42:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
127 "Modified: / 12-11-2012 / 22:42:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
121 ! ! |
128 ! ! |
122 |
129 |
123 !HGCommand class methodsFor:'accessing'! |
130 !HGCommand class methodsFor:'accessing'! |
|
131 |
|
132 hgCommand |
|
133 | h | |
|
134 |
|
135 HGExecutable notNil ifTrue:[ |
|
136 ^ HGExecutable |
|
137 ]. |
|
138 HGExecutable := UserPreferences current hgExecutable. |
|
139 HGExecutable isNil ifTrue:[ |
|
140 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
141 "/ h := Win32OperatingSystem registryEntry |
|
142 "/ key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\svn.exe'. |
|
143 "/ h notNil ifTrue:[HGExecutable := h valueNamed:'']. |
|
144 "/ HGExecutable notEmptyOrNil ifTrue:[^HGExecutable] |
|
145 HGExecutable := OperatingSystem pathOfCommand:'hg'. |
|
146 ] ifFalse:[ |
|
147 OperatingSystem isUNIXlike ifTrue:[ |
|
148 HGExecutable := OperatingSystem pathOfCommand:'hg'. |
|
149 ] |
|
150 ]. |
|
151 ]. |
|
152 HGExecutable isNil ifTrue:[ |
|
153 self error:'''hg'' executable not found!!'. |
|
154 ]. |
|
155 ^ HGExecutable |
|
156 |
|
157 " |
|
158 HGExecutable := nil. |
|
159 self basicNew executable" |
|
160 |
|
161 "Created: / 19-11-2012 / 21:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
162 ! |
|
163 |
|
164 hgCommand: command |
|
165 HGExecutable := command |
|
166 |
|
167 "Created: / 19-11-2012 / 21:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
168 ! |
|
169 |
|
170 hgVersion |
|
171 "Return mercurial version installed on this compiter" |
|
172 |
|
173 HGVersion isNil ifTrue:[ |
|
174 HGVersion := version new execute |
|
175 ]. |
|
176 ^ HGVersion |
|
177 |
|
178 " |
|
179 HGCommand mercurialVersion" |
|
180 "Created: / 19-11-2012 / 20:14:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
181 ! |
|
182 |
|
183 hgVersionIsSupported |
|
184 ^ self hgVersionIsSupported:self hgVersion |
|
185 |
|
186 " |
|
187 HGCommand mercurialVersionIsSupported" |
|
188 "Created: / 19-11-2012 / 20:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
189 ! |
|
190 |
|
191 hgVersionIsSupported:version |
|
192 ^ self hgVersionsSupported |
|
193 anySatisfy:[:vsn | |
|
194 ((vsn at:1) == #'*' or:[ (vsn at:1) == (version at:1) ]) |
|
195 and:[ |
|
196 ((vsn at:2) == #'*' or:[ (vsn at:2) == (version at:2) ]) |
|
197 and:[ ((vsn at:3) == #'*' or:[ (vsn at:1) == (version at:3) ]) ] |
|
198 ] |
|
199 ]. |
|
200 |
|
201 " |
|
202 HGCommand mercurialVersionIsSupported: #(2 3 2) |
|
203 HGCommand mercurialVersionIsSupported: #(2 0 1) |
|
204 HGCommand mercurialVersionIsSupported: #(1 9 1) |
|
205 HGCommand mercurialVersionIsSupported: #(1 0 0) |
|
206 HGCommand mercurialVersionIsSupported: #(2 4 nil)" |
|
207 "Created: / 19-11-2012 / 20:31:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
208 ! |
|
209 |
|
210 hgVersionsSupported |
|
211 "Return a list of mercurial version supported bu this |
|
212 implementation" |
|
213 |
|
214 ^ #( #(1 9 #'*') |
|
215 #(2 #'*' #'*') ) |
|
216 |
|
217 "Created: / 19-11-2012 / 20:26:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
218 ! |
124 |
219 |
125 verbose |
220 verbose |
126 |
221 |
127 ^ UserPreferences current hgVerbose |
222 ^ UserPreferences current hgVerbose |
128 |
223 |
349 "Modified: / 30-09-2012 / 23:37:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
444 "Modified: / 30-09-2012 / 23:37:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
350 "Modified (comment): / 17-10-2012 / 13:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
445 "Modified (comment): / 17-10-2012 / 13:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
351 ! |
446 ! |
352 |
447 |
353 executable |
448 executable |
354 | h | |
449 ^ self class hgCommand |
355 |
450 |
356 HGExecutable notNil ifTrue:[^ HGExecutable]. |
451 "Modified: / 19-11-2012 / 21:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
357 |
|
358 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
359 "/ h := Win32OperatingSystem registryEntry |
|
360 "/ key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\svn.exe'. |
|
361 "/ h notNil ifTrue:[HGExecutable := h valueNamed:'']. |
|
362 "/ HGExecutable notEmptyOrNil ifTrue:[^HGExecutable] |
|
363 HGExecutable := OperatingSystem pathOfCommand:'hg'. |
|
364 ] ifFalse:[ |
|
365 OperatingSystem isUNIXlike ifTrue:[ |
|
366 HGExecutable := OperatingSystem pathOfCommand:'hg'. |
|
367 ]]. |
|
368 |
|
369 HGExecutable isNil ifTrue:[ |
|
370 self error:'''hg'' executable not found!!'. |
|
371 ]. |
|
372 ^ HGExecutable |
|
373 |
|
374 |
|
375 " |
|
376 HGExecutable := nil. |
|
377 self basicNew executable |
|
378 " |
|
379 |
|
380 "Created: / 11-05-2011 / 07:59:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
381 "Modified: / 09-12-2011 / 22:48:33 / dundee" |
|
382 "Modified (format): / 27-12-2011 / 15:51:06 / dundee" |
|
383 "Modified: / 17-11-2012 / 11:37:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
384 ! |
452 ! |
385 |
453 |
386 parse: stream |
454 parse: stream |
387 "Parses output of 'hg' command, i.e. commit, log, update, checkout, |
455 "Parses output of 'hg' command, i.e. commit, log, update, checkout, |
388 etc." |
456 etc." |
861 ^(HGCommandParser on: stream) parseCommandStatus |
929 ^(HGCommandParser on: stream) parseCommandStatus |
862 |
930 |
863 "Modified: / 23-10-2012 / 11:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
931 "Modified: / 23-10-2012 / 11:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
864 ! ! |
932 ! ! |
865 |
933 |
|
934 !HGCommand::version methodsFor:'private'! |
|
935 |
|
936 arguments |
|
937 |
|
938 ^ Array with: HGExecutable with: '--version' |
|
939 |
|
940 "Created: / 19-11-2012 / 20:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
941 ! |
|
942 |
|
943 parse: stream |
|
944 "Parses output of 'hg' command, i.e. commit, log, update, checkout, |
|
945 etc." |
|
946 |
|
947 ^(HGCommandParser on: stream) parseCommandVersion |
|
948 |
|
949 "Created: / 19-11-2012 / 20:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
950 ! ! |
|
951 |
866 !HGCommand class methodsFor:'documentation'! |
952 !HGCommand class methodsFor:'documentation'! |
867 |
953 |
868 version_HG |
954 version_HG |
869 "Never, ever change this method. Ask JV or CG why" |
955 "Never, ever change this method. Ask JV or CG why" |
870 ^thisContext method mclass theNonMetaclass instVarNamed: #revision |
956 ^thisContext method mclass theNonMetaclass instVarNamed: #revision |