--- a/DiffListUtility.st Mon Jan 28 21:19:21 2013 +0000
+++ b/DiffListUtility.st Fri Feb 08 08:35:48 2013 +0100
@@ -51,23 +51,16 @@
"
! !
+
!DiffListUtility class methodsFor:'defaults'!
diffCommand
- "return the diff-command (with argument placeHolders)"
+ "return the diff-command (with argument placeHolders).
+ By default, diff is used with windows, diff -b with Unix.
+ You can change this via the diffCommandTemplate"
DiffCommandTemplate notNil ifTrue:[ ^ DiffCommandTemplate ].
-
- OperatingSystem isMSDOSlike ifTrue:[
- (OperatingSystem canExecuteCommand:'diff') ifFalse:[
- 'DiffTextView [warning]: no diff command found (please download and unzip "UnxUtils.zip" from "unxutils.sourceforge.net")' infoPrintCR.
- ^ nil
- ].
- ^ 'diff %1 %2'
- ].
- ^ 'diff -b %1 %2'
-
- "Modified: / 30.1.1998 / 12:12:49 / cg"
+ ^ UserPreferences current externalDiffCommandTemplate
!
diffCommandTemplate:aCommandTemplateString
@@ -76,6 +69,7 @@
DiffCommandTemplate := aCommandTemplateString
! !
+
!DiffListUtility class methodsFor:'private'!
saveForDiff:text as:filename
@@ -91,16 +85,20 @@
(line includes:Character return) ifTrue: [
(line endsWith:Character return) ifTrue:[
lOut := line copyWithoutLast:1.
- ] ifFalse:[
- i := line indexOf:Character return.
- (line at:i+1) == Character nl ifTrue:[
- "/ crnl endings
- lOut := line copyReplaceString:(String crlf) withString:(String lf).
- ] ifFalse:[
- "/ cr endings
- lOut := line copyReplaceAll:Character return with:Character nl.
- ].
+ ].
+ ] ifFalse:[
+ (line endsWith:(String crlf)) ifTrue: [
+ lOut := line copyWithoutLast:2.
]
+"/ i := line indexOf:Character return.
+"/ (line at:i+1) == Character nl ifTrue:[
+"/ "/ crnl endings
+"/ lOut := line copyReplaceString:(String crlf) withString:(String lf).
+"/ ] ifFalse:[
+"/ "/ cr endings
+"/ lOut := line copyReplaceAll:(Character return) with:Character nl.
+"/ ].
+"/ ]
].
lOut isWideString ifTrue:[
(lOut first = (Character value:16rFEFF)) ifTrue:[
@@ -118,6 +116,7 @@
"Modified: / 22-10-2008 / 17:52:52 / cg"
! !
+
!DiffListUtility class methodsFor:'utilities'!
diffListFor:text1 and:text2
@@ -165,7 +164,7 @@
stream := PipeStream readingFrom:diffCmd.
stream isNil ifTrue:[
- stream := PipeStream readingFrom:('support' , Filename separator , diffCmd).
+ stream := PipeStream readingFrom:('support' asFilename / diffCmd).
stream isNil ifTrue:[
self error:'cannot execute diff' mayProceed:true.
^ nil.
@@ -208,12 +207,18 @@
"
! !
+
!DiffListUtility class methodsFor:'documentation'!
+version
+ ^ '$Header: /cvs/stx/stx/libtool/DiffListUtility.st,v 1.6 2013-02-01 15:13:18 cg Exp $'
+!
+
version_CVS
- ^ '§Header: /cvs/stx/stx/libtool/DiffListUtility.st,v 1.4 2012/12/12 23:00:48 stefan Exp §'
+ ^ '$Header: /cvs/stx/stx/libtool/DiffListUtility.st,v 1.6 2013-02-01 15:13:18 cg Exp $'
!
version_SVN
^ '$Id: DiffListUtility.st 8083 2013-01-14 11:48:37Z vranyj1 $'
! !
+