CVSSourceCodeManager.st
changeset 3330 0c8235ef61c1
parent 3324 afd8cfea1bdd
child 3333 50af27c01dd0
--- a/CVSSourceCodeManager.st	Mon Jul 01 03:25:22 2013 +0000
+++ b/CVSSourceCodeManager.st	Mon Jul 01 16:48:07 2013 +0200
@@ -1270,7 +1270,7 @@
              ) pairWiseDo:[:word :key |
                 s := subEntry restAfter:word withoutSeparators:true.
                 s notNil ifTrue:[
-                    key == #'auther' ifTrue:[ s := self authorMappingFor:s ].
+                    key == #'author' ifTrue:[ s := self authorMappingFor:s ].
                     record at:key put:s.
                 ].                        
             ].
@@ -3665,15 +3665,38 @@
      list of lines, representing the diffs between two revisions.
      experimental (for ownershipGraph)"
 
-    |tempDir fullName modulePath inStream line   
-     list s msg|
+    ^  self
+        diffListFor:clsOrNil fileName:classFileName directory:packageDir module:moduleDir revision1:rev1 revision2:rev2 
+        cache:true
+!
+
+diffListFor:clsOrNil fileName:classFileNameArg directory:packageDir module:moduleDir revision1:rev1 revision2:rev2 cache:cacheIt
+    "return diff info. This is supposed to return a standard diff-like
+     list of lines, representing the diffs between two revisions.
+     experimental (for ownershipGraph)"
+
+    |tempDir fullName modulePath inStream list msg cacheDir cachedFile classFileName|
 
     clsOrNil notNil ifTrue:[
         modulePath :=  clsOrNil package copyReplaceAll:$: with:$/.
-        fullName :=  modulePath , '/' , clsOrNil getClassFilename.
+        fullName :=  modulePath , '/' , (classFileName := clsOrNil getClassFilename).
     ] ifFalse:[
         modulePath :=  moduleDir , '/' , packageDir. 
-        fullName :=  modulePath , '/' , classFileName.
+        fullName :=  modulePath , '/' , (classFileName := classFileNameArg).
+    ].
+
+   (cacheIt) ifTrue:[
+        (cacheDir := self sourceCacheDirectory) isNil ifTrue:[
+            ('CVSSourceCodeManager [warning]: no source cache directory') infoPrintCR.
+        ] ifFalse:[
+            (cacheDir / modulePath / '.diffs') exists ifFalse:[
+                (cacheDir / modulePath / '.diffs') makeDirectory.
+            ].
+            cachedFile := cacheDir / modulePath / '.diffs' / (classFileName,'_',rev1,'_',rev2).
+            cachedFile exists ifTrue:[
+                ^ cachedFile contents
+            ].
+        ].
     ].
 
     tempDir := self createTempDirectory:nil forModule:nil.
@@ -3723,6 +3746,10 @@
         tempDir recursiveRemove
     ].
     list := list reject:[:line | line startsWith:'\ '].
+
+    cachedFile notNil ifTrue:[
+        cachedFile contents:list.
+    ].
     ^ list
 
     "
@@ -5283,11 +5310,11 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.468 2013-06-29 11:26:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.469 2013-07-01 14:48:07 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.468 2013-06-29 11:26:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.469 2013-07-01 14:48:07 cg Exp $'
 ! !