CVSSourceCodeManager.st
changeset 1858 a3038cf8dd3c
parent 1839 68163810aa15
child 1859 e4542e66b708
--- a/CVSSourceCodeManager.st	Wed Oct 11 18:55:52 2006 +0200
+++ b/CVSSourceCodeManager.st	Thu Oct 12 10:14:55 2006 +0200
@@ -3532,6 +3532,84 @@
     "Modified: / 04-07-2006 / 18:19:41 / cg"
 !
 
+newestRevisionsInModule:module directory:packageDir
+    "return a list of filename-module associations for the containers in
+     a package directory.
+     Return nil on failure."
+
+    |tempDir modulePath inStream line s info fileName revision|
+
+    self use_rlog ifFalse:[
+         "/ Uses 'cvs status' - rlog seems not to work
+
+        ^ nil.
+    ].
+
+    modulePath :=  module , '/' , packageDir. 
+
+    [
+        self activityNotification:'Fetching revision infos for ', modulePath.
+
+        inStream := self 
+                        executeCVSCommand:('rlog -h -N -l ' , modulePath) 
+                        module:module 
+                        inDirectory:tempDir 
+                        log:true 
+                        pipe:true.
+
+        inStream isNil ifTrue:[
+            ('CVSSourceCodeManager [error]: cannot open pipe to cvs rlog ', modulePath) errorPrintCR.
+            ^ nil
+        ].
+
+        "/
+        "/ read the commands pipe output and extract the container infos
+        "/
+        info := OrderedCollection new.
+        [inStream atEnd] whileFalse:[
+            line:= inStream nextLine.
+            line notNil ifTrue:[
+                line := line withoutSeparators.
+                line notEmpty ifTrue:[
+                    s := line restAfter:'RCS file:' withoutSeparators:true. 
+                    s notNil ifTrue:[ 
+                        (UnixFilename named:s) directory baseName = 'Attic' ifTrue:[
+                            "/ file has been removed in the repository
+                            revision := #deleted
+                        ].
+                        fileName := (UnixFilename named:s) baseName.
+                        (fileName endsWith:',v') ifTrue:[
+                            fileName := fileName copyWithoutLast:2.
+                        ] ifFalse:[
+                            self halt:'oops - should not happen'.
+                        ].
+                    ].
+                    s := line restAfter:'head:' withoutSeparators:true.
+                    s notNil ifTrue:[ |i|
+                        i := s indexOfSeparator.
+                        i ~~ 0 ifTrue:[
+                            s := s copyTo:i-1
+                        ].
+                        revision := s.
+                        info add:(fileName -> revision).
+                        fileName := revision := nil.
+                    ].                        
+                ].                        
+            ]
+        ].
+    ] ensure:[
+        inStream notNil ifTrue:[inStream close].
+    ].
+    ^ info
+
+    "
+     SourceCodeManager 
+        newestRevisionsInModule:'bosch' directory:'dapasx'
+    "
+
+    "Created: / 12-10-2006 / 10:12:59 / cg"
+!
+
 removeContainer:fileName inModule:moduleDir directory:packageDir
     "remove a container"
 
@@ -4377,7 +4455,7 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.333 2006-10-06 15:08:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.334 2006-10-12 08:14:55 cg Exp $'
 ! !
 
 CVSSourceCodeManager initialize!