AbstractSourceCodeManager.st
changeset 4275 12187d056ae6
parent 4274 2b8ac98e311e
child 4279 c1c328421f15
--- a/AbstractSourceCodeManager.st	Tue Dec 05 15:49:48 2017 +0100
+++ b/AbstractSourceCodeManager.st	Tue Dec 05 19:29:28 2017 +0100
@@ -143,6 +143,12 @@
     "
 !
 
+branchTagPrefix
+    ^ 'branch_'
+
+    "Created: / 05-12-2017 / 19:19:39 / cg"
+!
+
 cacheDirectoryName
     "return the name of the cache directory, where checked out class
      sources are kept for faster access. The default is '/tmp/stx_sourceCache'.
@@ -354,13 +360,13 @@
 !
 
 repositoryNameForPackage:packageId 
-    "Return the repository ULR for the given package. 
+    "Return the repository URL for the given package. 
      Used for testing/debugging source code management configuration"
     
     ^ self subclassResponsibility
 
     "Created: / 10-10-2011 / 19:44:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 21-12-2011 / 23:03:00 / cg"
+    "Modified (comment): / 05-12-2017 / 17:41:57 / cg"
 !
 
 shownInBrowserMenus
@@ -2748,6 +2754,38 @@
     "Created: / 20.5.1998 / 19:38:23 / cg"
 !
 
+knownBranchTagsAndRevisionsFor:aClass
+    "retrieve a list of branch (symbolic tags -> versionNr) associations known for that class.
+     I.e. which tags/symbolic versions exist, and which revision-nr is attached to it"
+
+    |allTagsAndVersions|
+
+    allTagsAndVersions := self knownTagsAndRevisionsFor:aClass.
+    ^ self onlyBranchTagsFrom:allTagsAndVersions
+
+    "
+     CVSSourceCodeManager knownBranchTagsAndRevisionsFor:Array
+    "
+
+    "Created: / 05-12-2017 / 19:27:50 / cg"
+!
+
+knownBranchTagsAndRevisionsForContainer:classFileName directory:packageDir module:moduleDir
+    "retrieve all branch tages."
+
+    |allTagsAndVersions|
+
+    allTagsAndVersions := self knownTagsAndRevisionsForContainer:classFileName directory:packageDir module:moduleDir.
+    ^ self onlyBranchTagsFrom:allTagsAndVersions
+    
+    "
+     CVSSourceCodeManager knownBranchTagsAndRevisionsFor:cg_test2
+     CVSSourceCodeManager knownBranchTagsAndRevisionsForContainer:'cg_test2.st' directory:'test2' module:'cg'
+    "
+
+    "Created: / 05-12-2017 / 19:19:29 / cg"
+!
+
 knownTagsAndRevisionsFor:aClass
     "retrieve a list of (symbolic tags -> versionNr) associations known for that class.
      I.e. which tags/symbolic versions exist, and which revision-nr is attached to it"
@@ -2777,7 +2815,7 @@
 
     |log|
 
-    log := self revisionLogOf:nil numberOfRevisions:20 fileName:fileName directory:packageDir module:moduleDir.
+    log := self revisionLogOf:nil numberOfRevisions:2 fileName:fileName directory:packageDir module:moduleDir.
     log isNil ifTrue:[
         SourceCodeManagerError 
             raiseRequestWith:fileName
@@ -2791,7 +2829,7 @@
     "
 
     "Created: / 05-12-2017 / 01:16:09 / cg"
-    "Modified (comment): / 05-12-2017 / 12:45:47 / cg"
+    "Modified: / 05-12-2017 / 19:22:10 / cg"
 !
 
 knownTagsFor:aClass
@@ -2892,6 +2930,25 @@
     "
 !
 
+onlyBranchTagsFrom:tagsAndVersions
+    "retrieve a list of branch (symbolic tags -> versionNr) associations known for that class.
+     I.e. which tags/symbolic versions exist, and which revision-nr is attached to it"
+
+    tagsAndVersions isEmptyOrNil ifTrue:[ ^ #() ].
+    tagsAndVersions keys copy do:[:k |
+        (k startsWith:(self branchTagPrefix)) ifFalse:[
+            tagsAndVersions removeKey:k.    
+        ].
+    ].
+    ^ tagsAndVersions
+
+    "
+     CVSSourceCodeManager knownBranchTagsAndRevisionsFor:Array
+    "
+
+    "Created: / 05-12-2017 / 19:28:19 / cg"
+!
+
 printClassRepositorySummaryForClass:aClass on:aStream
     "returns summary info from the repository:
         current version,
@@ -2950,6 +3007,25 @@
     "Created: / 08-02-2011 / 10:18:00 / cg"
 !
 
+revisionForTag:tagName inContainer:classFileName directory:packageDir module:moduleDir
+    "retrieve the revision number associated to a particular tag/symbolic version.
+     Nil if unknown"
+
+    |tagsAndVersions|
+
+    tagsAndVersions := self knownTagsAndRevisionsForContainer:classFileName directory:packageDir module:moduleDir.
+    tagsAndVersions isEmptyOrNil ifTrue:[ ^ nil ].
+    ^ tagsAndVersions at:tagName ifAbsent:nil.
+
+    "
+     SourceCodeManager revisionForTag:'stable' inClass:Array
+     SourceCodeManager revisionForTag:'stable' inContainer:'Make.proto' directory:'libbasic' module:'stx'
+    "
+
+    "Created: / 05-12-2017 / 01:15:01 / cg"
+    "Modified (comment): / 05-12-2017 / 19:15:51 / cg"
+!
+
 revisionInfoFromRCSString:aString
     "{ Pragma: +optSpace }"