--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/git/GitPackageManager.st Sat Oct 06 22:35:46 2012 +0000
@@ -0,0 +1,94 @@
+"{ Package: 'stx:libscm/git' }"
+
+Object subclass:#GitPackageManager
+ instanceVariableNames:'repositories wcs packages'
+ classVariableNames:'Current'
+ poolDictionaries:''
+ category:'SCM-Git-StX'
+!
+
+
+!GitPackageManager class methodsFor:'instance creation'!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!GitPackageManager class methodsFor:'accessing'!
+
+current
+ Current isNil ifTrue:[
+ Current := self new
+ ].
+ ^Current
+
+ "Created: / 06-10-2012 / 19:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+flush
+ self current flush
+
+ "Created: / 06-10-2012 / 21:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+packageNamed:package
+ ^self current packageNamed:package.
+
+ "Created: / 06-10-2012 / 22:55:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GitPackageManager methodsFor:'accessing'!
+
+packageNamed:package
+ "Returns a GitPackageWorkingCopy for given package."
+
+ | dir repo wc |
+
+ packages at: package ifPresent: [ :pkg | ^ pkg ].
+ wcs at: package ifPresent:[ :wc | ^ wc ].
+ dir := Smalltalk getPackageDirectoryForPackage: package.
+ dir := GitRepository discover: dir.
+ dir isNil ifTrue:[
+ GitError raiseErrorString: 'No repository found for package ',package.
+ ^nil.
+ ].
+ repo := repositories at: dir ifAbsentPut: [ GitRepository open: dir ].
+ wc := wcs at: repo ifAbsentPut: [ repo workingCopy ].
+ ^packages at: package ifAbsentPut: [ GitPackage named: package in: wc ].
+
+ "Created: / 06-10-2012 / 22:40:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GitPackageManager methodsFor:'initialization'!
+
+flush
+ self initialize
+
+ "Created: / 06-10-2012 / 21:51:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initialize
+ "Invoked when a new instance is created."
+
+ "/ please change as required (and remove this comment)
+ repositories := Dictionary new.
+ wcs := Dictionary new.
+ packages := Dictionary new.
+
+ "/ super initialize. -- commented since inherited method does nothing
+
+ "Modified: / 06-10-2012 / 22:26:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GitPackageManager class methodsFor:'documentation'!
+
+version_GIT
+ "Never, ever change this method. Ask JV or CG why"
+ ^thisContext method mclass theNonMetaclass instVarNamed: #revision
+!
+
+version_SVN
+ ^ '$Id:: $'
+! !