Merge jv
authorMerge Script
Sat, 19 Nov 2016 06:53:11 +0100
branchjv
changeset 1182 38600a7a9203
parent 1179 a3c51fbc33cf (current diff)
parent 1181 61aa6c389562 (diff)
child 1185 a92f18c040fb
Merge
SVNSourceCodeManager.st
--- a/SVNSourceCodeManager.st	Tue Aug 09 06:39:39 2016 +0200
+++ b/SVNSourceCodeManager.st	Sat Nov 19 06:53:11 2016 +0100
@@ -34,6 +34,13 @@
 	category:'System-SourceCodeManagement'
 !
 
+VersionInfo subclass:#SVNVersionInfo
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:SVNSourceCodeManager
+!
+
 SourceCodeManagerUtilities subclass:#Utilities
 	instanceVariableNames:''
 	classVariableNames:''
@@ -329,11 +336,11 @@
 
      The returned information is a structure (IdentityDictionary)
      filled with:
-            #container          -> the RCS/CVS container file name 
+            #container          -> the file name again 
             #cvsRoot            -> the CVS root (repository) 
             #filename           -> the actual source file name
             #newestRevision     -> the revisionString of the newest revision
-            #numberOfRevisions  -> the number of revisions in the container (nil for all)
+            #numberOfRevisions  -> N/A
             #revisions          -> collection of per-revision info (see below)
 
             firstRevOrNil / lastRevOrNil specify from which revisions a logEntry is wanted:
@@ -351,7 +358,6 @@
               #author                -> who checked that revision into the repository
               #date                  -> when was it checked in
               #state                 -> the RCS state
-              #numberOfChangedLines  -> the number of changed line w.r.t the previous
               #logMessage            -> the checkIn log message
 
             revisions are ordered newest first 
@@ -394,19 +400,18 @@
     info at:#filename           put: classFileName.         "/ -> the actual source file name
     info at:#newestRevision     put: log first revision asString. "/-> the revisionString of the newest revision
     info at:#numberOfRevisions  put: log size.              "/-> the number of revisions in the container (nil for all)
-    info at:#revisions          put: (log collect:[:entry|
-
-        | info |
-        info := IdentityDictionary new.
-        info at:#revision              put: entry revision asString."/ -> the revision string
-        info at:#author                put: entry author."/ -> who checked that revision into the repository
-        info at:#date                  put: entry date printString."/ -> when was it checked in
-        info at:#state                 put: 'Exp'. "/ -> the RCS state
-        info at:#numberOfChangedLines  put: 'N/A'. "/ -> the number of changed line w.r.t the previous
-        info at:#logMessage            put: entry message."/ -> the checkIn log message.
-        info
-    ]).
-
+    info at:#revisions          
+         put: 
+        (log collect:[:entry|
+            | info |
+            info := IdentityDictionary new.
+            info at:#revision              put: entry revision asString."/ -> the revision string
+            info at:#author                put: entry author."/ -> who checked that revision into the repository
+            info at:#date                  put: entry date printString."/ -> when was it checked in
+            info at:#state                 put: 'Exp'. "/ -> the RCS state
+            info at:#logMessage            put: entry message."/ -> the checkIn log message.
+            info
+        ]).
     
     ^info
     
@@ -700,6 +705,147 @@
     ^ true
 ! !
 
+!SVNSourceCodeManager::SVNVersionInfo class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2011 by eXept Software AG
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    In ancient times, Class used to return a Dictionary when asked for versionInfo.
+    This has been replaced by instances of VersionInfo and subclasses.
+
+    SVNVersionInfo adds some SVN specific data.
+
+    [author:]
+        cg (cg@AQUA-DUO)
+"
+!
+
+version
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
+!
+
+version_SVN
+    ^ '$Id$'
+! !
+
+!SVNSourceCodeManager::SVNVersionInfo class methodsFor:'instance creation'!
+
+fromSVNString:aString
+    "{ Pragma: +optSpace }"
+
+    "I know how to parse SVN version id strings.
+     Return an instance filled with revision info which is
+     extracted from aString. This must be in SVN format.
+     Return nil for non-SVN strings"
+
+    |words firstWord info s fn revString user |
+
+    s := aString readStream.
+    s skipSeparators.
+    firstWord := s through:$:.
+
+    info := self new.
+
+    "/
+    "/ supported formats:
+    "/
+    "/ $ Id:       baseFileName rev-int date time user $
+    "/
+    ((firstWord = '$Id:') 
+        or:[ (firstWord = '$ Id:') 
+        or:[ (firstWord = '§Id:')
+        or:[ (firstWord = '§ Id:')]]]
+    ) ifTrue:[
+        "/Skip next : it might be SVN's fixed-width keyword"
+        s peek == $: ifTrue:[s next].
+
+        words := s upToEnd asCollectionOfWords readStream.
+        (words peek = '$') ifTrue:[
+            "/ empty fixed-width version method - '$Id$'
+            ^nil
+        ].
+        info fileName:(fn := words next).
+        (fn endsWith:',v') ifTrue:[
+            "/ not an SVN version
+            ^ nil
+        ].
+        info revision:(revString := words next).
+        "/ do not use matchesRegex: here (regex is an optional package)
+        (revString conform:[:c | c isDigit]) ifFalse:[
+            "/ not an SVN version
+            ^ nil
+        ].
+        info date:(words next).
+        info time:(words next).
+        user := words next.
+        (user includesAny:'$§') ifTrue:[
+            info user: (user copyTo: (user indexOfAny:'$§') - 1)
+        ] ifFalse:[
+            info user: user.
+            ( '$§' includes:words next first) ifFalse:[
+                "/ not an SVN version
+                ^ nil
+            ]
+        ].
+        words atEnd ifFalse:[
+            ^ nil
+        ].
+        ^ info
+    ].
+
+    ^ nil
+
+    "
+     SVNVersionInfo fromSVNString:('$' , 'Revision: 1.122 $')   
+     SVNVersionInfo fromSVNString:(SourceCodeManager version)   
+     SVNVersionInfo fromSVNString:(ApplicationDefinition version_SVN)
+     SVNVersionInfo fromSVNString:(ApplicationDefinition version_CVS)
+     CVSVersionInfo fromRCSString:(ApplicationDefinition version_SVN)   
+     CVSVersionInfo fromRCSString:(ApplicationDefinition version_CVS)   
+    "
+
+    "Created: / 29-09-2011 / 17:14:56 / cg"
+    "Modified: / 31-03-2012 / 01:12:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SVNSourceCodeManager::SVNVersionInfo methodsFor:'accessing'!
+
+keysAndValuesDo:aBlock
+
+    super keysAndValuesDo:aBlock.
+    "JV@2011-11-25: Fake repositoryPathName, as other tools
+     requires this. Returning nil should be fine, but then,
+     SourceCodeManagerUtilities constructs names as they are
+     in CVS, sigh"
+    aBlock value: #repositoryPathName value: self repositoryPathName
+
+    "Created: / 25-11-2011 / 18:58:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+repositoryPathName
+
+    ^fileName
+
+    "Created: / 25-11-2011 / 18:57:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SVNSourceCodeManager::Utilities methodsFor:'utilities-cvs'!
 
 checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:aManagerOrNil