AbstractSourceCodeManager.st
changeset 148 dd40327e00b7
parent 147 f6cfa2afc00a
child 158 27f76f9d8a25
--- a/AbstractSourceCodeManager.st	Wed Dec 13 11:26:02 1995 +0100
+++ b/AbstractSourceCodeManager.st	Wed Dec 13 13:42:34 1995 +0100
@@ -73,15 +73,17 @@
 !
 
 directoryFromContainerPath:containerPath
+    "given a full path as in an RCS header, extract the directory (i.e. package)."
+
     |path idx|
 
     path := self pathInRepositoryFrom:containerPath.
     path notNil ifTrue:[
-	idx := path indexOf:(Filename separator).
-	idx ~~ 0 ifTrue:[
-	    path := path copyFrom:(idx + 1)
-	].
-	^ path asFilename directoryName
+        idx := path indexOf:(Filename separator).
+        idx ~~ 0 ifTrue:[
+            path := path copyFrom:(idx + 1)
+        ].
+        ^ path asFilename directoryName
     ].
     ^ nil
 
@@ -90,33 +92,40 @@
     "
 
     "Created: 25.11.1995 / 18:42:20 / cg"
-    "Modified: 25.11.1995 / 18:48:46 / cg"
+    "Modified: 13.12.1995 / 13:06:15 / cg"
 !
 
 filenameFromContainerPath:containerPath
+    "given some path as present in an RCS Header string, extract the containers
+     name.
+     OBSOLETE - this is no longer used."
+
     |top rest|
 
     containerPath notNil ifTrue:[
-	top := self repositoryTopDirectory.
-	top notNil ifTrue:[
-	    (containerPath startsWith:(top , '/')) ifTrue:[
-		rest := containerPath copyFrom:(top size + 2).
-		^ rest asFilename baseName
-	    ]
-	]
+        top := self repositoryTopDirectory.
+        top notNil ifTrue:[
+            (containerPath startsWith:(top , '/')) ifTrue:[
+                rest := containerPath copyFrom:(top size + 2).
+                ^ rest asFilename baseName
+            ]
+        ]
     ].
 
     "Created: 25.11.1995 / 18:42:34 / cg"
+    "Modified: 13.12.1995 / 13:05:14 / cg"
 !
 
 moduleFromContainerPath:containerPath
+    "given a full path as in an RCS header, extract the module."
+
     |path idx|
 
     path := self pathInRepositoryFrom:containerPath.
     path notNil ifTrue:[
-	idx := path indexOf:(Filename separator).
-	idx == 0 ifTrue:[^ path].
-	^ path copyTo:(idx - 1)
+        idx := path indexOf:(Filename separator).
+        idx == 0 ifTrue:[^ path].
+        ^ path copyTo:(idx - 1)
     ].
     ^ nil
 
@@ -125,29 +134,40 @@
     "
 
     "Created: 25.11.1995 / 18:42:20 / cg"
-    "Modified: 25.11.1995 / 18:47:27 / cg"
+    "Modified: 13.12.1995 / 13:06:03 / cg"
 !
 
 pathInRepositoryFrom:containerPath
+    "this tries to extract the path within a repository, given some path
+     as present in an RCS Header string.
+     Typically, this ought to be that string directly; 
+     however, if the repository directory is accessed via a symbolic link during
+     ci/co, some systems extract different strings with co.
+     One such system here had a symbolic link from /phys/ibm/CVS... to /file/CVS,
+     and extracted sources had /phys/ibm/CVS in their header.
+     Do not depend on the code below to work correctly all the time."
+
     |top rest lastTop idx|
 
     containerPath notNil ifTrue:[
-	top := self repositoryTopDirectory.
-	top notNil ifTrue:[
-	    (containerPath startsWith:(top , '/')) ifTrue:[
-		^ containerPath copyFrom:(top size + 2).
-	    ].
-	    "/ hardcase - the repository-filename in the versionInfo
-	    "/ does no match my repository top.
-	    "/ check for mangled prefix (happens with symbolic links)
-	    lastTop := '/' , top asFilename baseName, '/'.
-	    idx := containerPath indexOfSubCollection:lastTop.
-	    idx ~~ 0 ifTrue:[
-		('SOURCEMGR: warning: repository path mismatch: ' , (containerPath copyTo:idx-1) , lastTop , ' vs. ' , top , '/') infoPrintNL.
-		'SOURCEMGR: warning: assuming that mismatch is ok.' infoPrintNL.
-		^ containerPath copyFrom:(idx + lastTop size).
-	    ]
-	]
+        top := self repositoryTopDirectory.
+        top notNil ifTrue:[
+            (containerPath startsWith:(top , '/')) ifTrue:[
+                ^ containerPath copyFrom:(top size + 2).
+            ].
+
+            "/ hardcase - the repository-filename in the versionInfo
+            "/ does no match my repository top.
+            "/ check for mangled prefix (happens with symbolic links)
+
+            lastTop := '/' , top asFilename baseName, '/'.
+            idx := containerPath indexOfSubCollection:lastTop.
+            idx ~~ 0 ifTrue:[
+                ('SOURCEMGR: warning: repository path mismatch: ' , (containerPath copyTo:idx-1) , lastTop , ' vs. ' , top , '/') infoPrintNL.
+                'SOURCEMGR: warning: assuming that mismatch is ok.' infoPrintNL.
+                ^ containerPath copyFrom:(idx + lastTop size).
+            ]
+        ]
     ].
     ^ rest
 
@@ -157,7 +177,7 @@
     "
 
     "Created: 25.11.1995 / 18:42:20 / cg"
-    "Modified: 25.11.1995 / 18:59:26 / cg"
+    "Modified: 13.12.1995 / 13:03:53 / cg"
 !
 
 repositoryTopDirectory
@@ -743,5 +763,5 @@
 !AbstractSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.36 1995-12-13 10:26:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.37 1995-12-13 12:42:34 cg Exp $'
 ! !