DiffTextView.st
changeset 8545 e8ab04e3722d
parent 8517 cc7558e6bda0
child 8647 136a25126878
equal deleted inserted replaced
8544:a8fc35df662b 8545:e8ab04e3722d
   309     "
   309     "
   310      save them texts in two temporary files ...
   310      save them texts in two temporary files ...
   311     "
   311     "
   312     self save:text1 as:(tmpFile1 := Filename newTemporary).
   312     self save:text1 as:(tmpFile1 := Filename newTemporary).
   313     self save:text2 as:(tmpFile2 := Filename newTemporary).
   313     self save:text2 as:(tmpFile2 := Filename newTemporary).
   314 
   314     [
   315     "
   315         "
   316      start diff on it ...
   316          start diff on it ...
   317     "
   317         "
   318     diffCmd := diffTemplate
   318         diffCmd := diffTemplate
   319                 bindWith:tmpFile1 asString
   319                     bindWith:tmpFile1 asString
   320                 with:tmpFile2 asString.
   320                     with:tmpFile2 asString.
   321 
   321 
   322     stream := PipeStream readingFrom:diffCmd.
   322         stream := PipeStream readingFrom:diffCmd.
   323     stream isNil ifTrue:[
   323         stream isNil ifTrue:[
   324         stream := PipeStream readingFrom:('support' , Filename separator , diffCmd).
   324             stream := PipeStream readingFrom:('support' , Filename separator , diffCmd).
   325     ].                                          
   325         ].                                          
   326     stream isNil ifTrue:[
   326         stream isNil ifTrue:[
       
   327             self error:'cannot execute diff' mayProceed:true.
       
   328             ^ nil.
       
   329         ].
       
   330 
       
   331         diffList := OrderedCollection new.
       
   332         (stream readWaitWithTimeout:2) ifTrue:[
       
   333             "/ timeout
       
   334             self error:'cannot execute diff (timeout)' mayProceed:true.
       
   335             ^ nil.
       
   336         ].
       
   337 
       
   338         [stream atEnd] whileFalse:[
       
   339             line := stream nextLine.
       
   340             line notNil ifTrue:[diffList add:line]
       
   341         ].
       
   342         stream close.
       
   343         ^ diffList
       
   344     ] ensure:[
   327         tmpFile1 delete.
   345         tmpFile1 delete.
   328         tmpFile2 delete.
   346         tmpFile2 delete.
   329         self error:'cannot execute diff' mayProceed:true.
   347     ].
   330         ^ nil.
       
   331     ].
       
   332 
       
   333     diffList := OrderedCollection new.
       
   334     [stream atEnd] whileFalse:[
       
   335         line := stream nextLine.
       
   336         line notNil ifTrue:[diffList add:line]
       
   337     ].
       
   338     stream close.
       
   339 
       
   340     tmpFile1 delete.
       
   341     tmpFile2 delete.
       
   342 
       
   343     ^ diffList
       
   344 !
   348 !
   345 
   349 
   346 save:text as:filename
   350 save:text as:filename
   347     |stream|
   351     |stream|
   348 
   352 
   675 ! !
   679 ! !
   676 
   680 
   677 !DiffTextView class methodsFor:'documentation'!
   681 !DiffTextView class methodsFor:'documentation'!
   678 
   682 
   679 version
   683 version
   680     ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.52 2009-01-21 14:35:21 cg Exp $'
   684     ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.53 2009-02-16 13:31:44 cg Exp $'
   681 ! !
   685 ! !