eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FileBasedSourceCodeManager':



Class: FileBasedSourceCodeManager



rev: 1.16 date: 2018/08/20 08:11:25
user: cg
file: FileBasedSourceCodeManager.st directory: libbasic3
module: stx stc-classLibrary: libbasic3
Claus Gittinger


A simple file based sourceCodeManager, which saves versions in a local directory.
Versions will be stored as filename.st.vNr (i.e. Foo.st.1, Foo.st.2, etc.)

This is more an example of the protocol which needs to be implemented,
than a real manager (although it may be useful for tiny private projects or classroom examples)

Class protocol:

o  getRepositoryPathForModule: aModuleName
internal: used when accessing a source repository.
Return the path to the top directory for a particular module.
If no specific path was defined for that module, return the value of
the global (fallBack) repositoryPath.
Nil is returned if no repository is available.

o  knownModules
return the modules, we currently know

o  repositoryInfoPerModule
return the dictionary, which associates repository paths to module names.
If no entry is contained in this dictionary for some module,
the default path will be used.

o  repositoryInfoPerModule: aDictionary
set the dictionary, which associates repository paths to module names.
If no entry is contained in this dictionary for some module,
the default path will be used.

o  repositoryPath
return the path of the default repository

o  repositoryPath: aPath
set the path of the default repository

o  defaultRepositoryPath

o  enabled

o  isContainerBased
true, if the SCM uses some kind of source container (,v files).
False, if it is like a database or filesystem.

o  isResponsibleForPackage: aString
(comment from inherited method)
Returns true if the manager can handle source code for given package.

Answering true does not imply that receiver is configured default
manager for that package, it only means that it has a repository
configured for given package.

o  managerTypeName
(comment from inherited method)
Answers version manager name suitable for UI,
i,e., CVS, SubVersion, Perforce

o  nameOfVersionMethodForExtensions
(comment from inherited method)
that is the old name; now, we use extensionsVersion_<SCM>

o  nameOfVersionMethodInClasses
(comment from inherited method)
that is the old name; now, we use version_<SCM>

o  repositoryNameForPackage: packageId
superclass AbstractSourceCodeManager class says that I am responsible to implement this method

o  settingsApplicationClass
link to my settings application (needed for the settings dialog

o  supportsCheckinLogMessages
no, log-messages are not supported (I am too stupid)

o  savePreferencesOn: aStream

source code administration
o  checkForExistingContainer: fileName inModule: moduleName directory: packageDirName
check for a container to exist. Return a boolean result.

o  checkForExistingModule: moduleDir
check for a package directory to be present

o  checkForExistingModule: moduleDir directory: packageDir
check for a package directory to be present

o  checkinClass: aClass fileName: classFileName directory: packageDir module: moduleDir source: sourceFile logMessage: logMessage force: force
Return true if ok, false if not.

o  createModule: moduleDir
create a module directory

o  createModule: moduleDir directory: packageDir
create a package directory

o  initialRevisionStringFor: aClass inModule: moduleDir directory: packageDir container: fileName
return a string usable as initial revision string

o  moduleDirectoryFor: moduleDir
a modules directory as filename

o  packageDirectoryForModule: moduleDir package: package
a packages directory as filename

o  revisionInfoFromString: aString
return a VersionInfo object filled with revision info.
This extracts the relevant info from aString.

usage example(s):

     self revisionInfoFromString:'Path: stx/libbasic/Array.st, Version: 123, User: cg, Time: 2011-12-21T21:03:08.826' 

o  revisionLogOf: clsOrNil fromRevision: rev1OrNil toRevision: rev2OrNil numberOfRevisions: limitOrNil fileName: classFileName directory: packageDir module: moduleDir
(comment from inherited method)
Return info about the repository container and (part of) the revisionlog as a collection
of revision entries. Return nil on failure.

This must be implemented by a concrete source-code manager

If numRevisionsOrNil is notNil, it limits the number of revision records returned -
only numRevions of the newest revision infos will be collected.

The returned information is a structure (IdentityDictionary)
filled with:
#container -> the container file name (for container-based SCMs)
#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)
#revisions -> collection of per-revision info (see below)

firstRevOrNil / lastRevOrNil specify from which revisions a logEntry is wanted:
-If firstRevOrNil is nil, the first revision is the initial revision
otherwise, the log starts with that revision.
-If lastRevOrNil is nil, the last revision is the newest revision
otherwise, the log ends with that revision.

-If both are nil, all logEntries are extracted.
-If both are 0 (not nil), no logEntries are extracted (i.e. only the header).

per revision info consists of one record per revision:

#revision -> the revision string
#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
(i.e. the last entry is for the initial revision; the first for the most recent one)
Attention: if state = 'dead' that revision is no longer valid.

o  streamForClass: aClass fileName: classFileName revision: revision directory: packageDir module: moduleDir cache: doCache
(comment from inherited method)
extract a classes source code and return an open readStream on it.
A revision of nil selects the current (in image) revision.
The classes source code is extracted using the revision and the sourceCodeInfo,
which itself is extracted from the classes packageString.

ST/X; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 08 Dec 2023 03:41:04 GMT