SourceCodeManagerUtilities.st
changeset 4007 ffa3939cd5af
parent 3993 209a7d800ea0
child 4009 2289742cbd69
child 4037 fd687625bcad
--- a/SourceCodeManagerUtilities.st	Sat Apr 30 03:43:46 2016 +0000
+++ b/SourceCodeManagerUtilities.st	Sat Apr 30 14:40:49 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2000 eXept Software AG
               All Rights Reserved
@@ -2629,6 +2631,7 @@
 "/            ].
 "/        ].
         fileName := mgr containerFromSourceInfo:info.
+        fileName isNil ifTrue:[ fileName := aClass classFilename ].
         (nameSpace := aClass nameSpace) ~~ Smalltalk ifTrue:[
             nameSpacePrefix := nameSpace name , '::'.
             fileName := fileName withoutPrefix:nameSpacePrefix.
@@ -2884,6 +2887,7 @@
     ^ true
 
     "Created: / 21-12-2011 / 18:34:02 / cg"
+    "Modified: / 30-04-2016 / 11:58:11 / cg"
 !
 
 diffSetOfProject:aProject againstRepositoryVersionFrom:aDateOrNilForNewest
@@ -4043,20 +4047,67 @@
             tagList notEmpty ifTrue:[tagList addFirst:'-'].
             tagList addFirst:'stable'.
         ].
-            
-        items := revisions collect:[:each | |rev date who flag|
-                                        rev := each at:#revision.
-                                        date := (each at:#date ifAbsent:nil) ? '?'.
-                                        who := (each at:#author ifAbsent:nil) ? '?'.
-                                        rev = stableRevision ifTrue:[
-                                            flag := ' Stable' allBold.
-                                        ] ifFalse:[rev = releasedRevision ifTrue:[
-                                            flag := ' Released' allBold.
-                                        ] ifFalse:[
-                                            flag := ' '
-                                        ]].
-                                        rev allBold , flag, ' [' , date , ' by ' , who , ']'
-                                   ].
+
+        "/ fill in timestamps
+        revisions do:[:each |
+            |timestampString timestamp|
+
+            timestampString := each at:#date ifAbsent:nil.
+            timestampString notNil ifTrue:[
+                timestamp := Timestamp readFrom:timestampString onError:nil.
+                timestamp notNil ifTrue:[
+                    each at:#timestamp put:timestamp.
+                    each at:#day put:timestamp asDate.
+                ].
+            ].
+        ].
+
+        items := revisions 
+                    collectWithIndex:[:each :idx| 
+                        |rev timestamp date time dateAndTimeString who flag 
+                         prevInfo prevDate nextInfo nextDate dateDifferentToPrev dateDifferentToNext|
+
+                        rev := each at:#revision.
+
+                        timestamp := each at:#timestamp.
+                        timestamp notNil ifTrue:[
+                            date := each at:#day.
+                            date = Date today ifTrue:[
+                                dateAndTimeString := timestamp asTime printString.
+                            ] ifFalse:[
+                                "/ if date is different to both previous AND next,
+                                "/ only show the date
+                                dateDifferentToPrev := dateDifferentToNext := false.
+                                (idx > 1) ifTrue:[
+                                    prevInfo := revisions at:idx-1.
+                                    prevDate := prevInfo at:#day ifAbsent:nil.
+                                    dateDifferentToPrev := (prevDate notNil and:[prevDate ~= date]).
+                                ].
+                                (idx < revisions size) ifTrue:[
+                                    nextInfo := revisions at:idx+1.
+                                    nextDate := nextInfo at:#day ifAbsent:nil.
+                                    dateDifferentToNext := (nextDate notNil and:[nextDate ~= date]).
+                                ].
+                                (dateDifferentToPrev and:[dateDifferentToPrev]) ifTrue:[
+                                    dateAndTimeString := date printString.
+                                ] ifFalse:[
+                                    dateAndTimeString := date printString,' ',(timestamp asTime printString).
+                                ]
+                            ].
+                        ] ifFalse:[
+                            dateAndTimeString := (each at:#date ifAbsent:nil) ? '(unknown time)'.
+                        ].
+                        who := (each at:#author ifAbsent:nil) ? '?'.
+                        rev = stableRevision ifTrue:[
+                            flag := ' Stable' allBold.
+                        ] ifFalse:[rev = releasedRevision ifTrue:[
+                            flag := ' Released' allBold.
+                        ] ifFalse:[
+                            flag := ''
+                        ]].
+                        '%1%2 [%3 by %4]' bindWith:rev allBold with:flag with:dateAndTimeString with:who 
+                   ].
+
         revisions := revisions collect:[:each | each at:#revision].
     ] ifFalse:[
         newestRev := aSourceCodeManager newestRevisionInFile:fileName directory:directory module:module.
@@ -4180,7 +4231,7 @@
         fileName:'Array.st'
     "
 
-    "Modified: / 21-12-2011 / 23:09:26 / cg"
+    "Modified: / 30-04-2016 / 14:32:17 / cg"
 !
 
 checkAndWarnAboutBadMessagesInClass:aClass checkAgainHolder:checkAgainHolder