class: CVSSourceCodeManager
authorClaus Gittinger <cg@exept.de>
Fri, 28 Jun 2013 10:35:06 +0200
changeset 3322 04127f10c007
parent 3321 5dd4bd30f2e2
child 3323 2fa2a06e361d
class: CVSSourceCodeManager added: #diffListFor:fileName:directory:module:revision1:revision2: changed: #statusOf:fileName:directory:module:
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Wed Jun 26 10:35:26 2013 +0200
+++ b/CVSSourceCodeManager.st	Fri Jun 28 10:35:06 2013 +0200
@@ -3642,6 +3642,78 @@
     "
 !
 
+diffListFor:clsOrNil fileName:classFileName directory:packageDir module:moduleDir revision1:rev1 revision2:rev2
+    "return diff info"
+
+    |tempDir fullName modulePath inStream line   
+     list s msg|
+
+    clsOrNil notNil ifTrue:[
+        modulePath :=  clsOrNil package copyReplaceAll:$: with:$/.
+        fullName :=  modulePath , '/' , clsOrNil getClassFilename.
+    ] ifFalse:[
+        modulePath :=  moduleDir , '/' , packageDir. 
+        fullName :=  modulePath , '/' , classFileName.
+    ].
+
+    tempDir := self createTempDirectory:nil forModule:nil.
+    tempDir isNil ifTrue:[
+        ('CVSSourceCodeManager [error]: no tempDir - cannot extract status') errorPrintCR.
+        ^ nil.
+    ].
+
+    [
+        self createEntryFor:fullName 
+             module:moduleDir
+             in:(tempDir construct:modulePath) 
+             revision:'1.1' 
+             date:'dummy' 
+             special:''
+             overwrite:false.
+
+        msg := 'fetching diff list of '.
+        clsOrNil isNil ifTrue:[
+            msg := msg , fullName.
+        ] ifFalse:[
+            msg := msg , clsOrNil name.
+        ].
+        msg := msg , ' ' , rev1 , ' vs. ' , rev2.
+        self activityNotification:msg.
+
+        inStream := self 
+                        executeCVSCommand:('diff -r%1 -r%2 %3' bindWith:rev1 with:rev2 with:fullName) 
+                        module:moduleDir 
+                        inDirectory:tempDir 
+                        log:true 
+                        pipe:true.
+
+        inStream isNil ifTrue:[
+            ('CVSSourceCodeManager [error]: cannot open pipe to cvs diff ', fullName) errorPrintCR.
+            ^ nil
+        ].
+
+        "/
+        "/ read the commands pipe output and extract the container info
+        "/
+        [ inStream nextLine startsWith:'diff -r'] whileFalse.
+
+        list := inStream contents.
+    ] ensure:[
+        inStream notNil ifTrue:[inStream close].
+        tempDir recursiveRemove
+    ].
+    ^ list
+
+    "
+     SourceCodeManager statusOf:Array 
+     SourceCodeManager statusOf:Array fileName:'Array.st' directory:'libbasic' module:'stx'  
+     SourceCodeManager statusOf:Filename fileName:'Filename.st' directory:'libbasic' module:'stx'  
+     SourceCodeManager statusOf:NewSystemBrowser fileName:'NewSystemBrowser.st' directory:'libtool' module:'stx'  
+    "
+
+    "Modified: / 29-08-2006 / 13:18:00 / cg"
+!
+
 getExistingContainersInModule:aModule directory:aPackage
     "return a list of existing containers."
 
@@ -5095,7 +5167,7 @@
     fullName :=  modulePath , '/' , classFileName.
     tempDir := self createTempDirectory:nil forModule:nil.
     tempDir isNil ifTrue:[
-        ('CVSSourceCodeManager [error]: no tempDir - cannot extract log') errorPrintCR.
+        ('CVSSourceCodeManager [error]: no tempDir - cannot extract status') errorPrintCR.
         ^ nil.
     ].
 
@@ -5124,7 +5196,7 @@
                         pipe:true.
 
         inStream isNil ifTrue:[
-            ('CVSSourceCodeManager [error]: cannot open pipe to cvs log ', fullName) errorPrintCR.
+            ('CVSSourceCodeManager [error]: cannot open pipe to cvs status ', fullName) errorPrintCR.
             ^ nil
         ].
 
@@ -5190,11 +5262,11 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.465 2013-06-26 08:35:26 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.466 2013-06-28 08:35:06 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.465 2013-06-26 08:35:26 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.466 2013-06-28 08:35:06 cg Exp $'
 ! !