GitSourceCodeManager.st
changeset 2850 4b3dec16d86b
parent 2839 8e8c0d2bb8ee
child 2920 23a63370b272
--- a/GitSourceCodeManager.st	Thu Jul 26 01:30:21 2012 +0200
+++ b/GitSourceCodeManager.st	Thu Jul 26 01:31:16 2012 +0200
@@ -347,13 +347,11 @@
     "Created: / 19-09-1997 / 06:13:06 / cg"
 !
 
-repositoryNameForPackage:packageId 
-    "superclass AbstractSourceCodeManager class says that I am responsible to implement this method"
-    
-    ^ self getGitRepositoryForModule:(packageId upTo:$: )
+repositoryNameForPackage:packageId     
+    ^ self repositoryNameForModule:(packageId upTo:$:)
 
     "Created: / 10-10-2011 / 19:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-03-2012 / 15:25:35 / cg"
+    "Modified (format): / 25-07-2012 / 18:23:06 / cg"
 !
 
 workDirectory
@@ -370,6 +368,12 @@
 
 !GitSourceCodeManager class methodsFor:'basic administration'!
 
+addFile:fileName inDirectory:dirPath
+    self executeGitCommand:('add "',fileName,'"') inDirectory:dirPath
+
+    "Created: / 25-07-2012 / 23:07:57 / cg"
+!
+
 checkForExistingContainer:fileName inModule:moduleName directory:dirName
     "check for a container to be present"
 
@@ -416,7 +420,25 @@
     "Created: / 23-07-2012 / 19:07:34 / cg"
 !
 
-checkinClass:aClass fileName:classFileName directory:packageDir module:moduleDir source:sourceFile logMessage:logMessage force:force
+checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force
+    |path relPath|
+
+    relPath := (moduleDir asFilename construct:packageDir) construct:containerFilename.
+    path := self repositoryName asFilename construct:relPath.
+    path contents: someText.
+
+    ^ self checkinClass:nil 
+        fileName:containerFilename 
+        directory:packageDir 
+        module:moduleDir
+        source:nil
+        logMessage:logMessage 
+        force:force
+
+    "Created: / 25-07-2012 / 14:29:10 / cg"
+!
+
+checkinClass:aClassOrNil fileName:classFileName directory:packageDir module:moduleDir source:sourceFileOrNil logMessage:logMessage force:force
     "checkin of a class into the source repository.
      Return true if ok, false if not."
 
@@ -424,7 +446,9 @@
 
     relPath := (moduleDir asFilename construct:packageDir) construct:classFileName.
     path := self repositoryName asFilename construct:relPath.
-    sourceFile asFilename moveTo: path.
+    sourceFileOrNil notNil ifTrue:[
+        sourceFileOrNil asFilename moveTo: path.
+    ].
 
     (self executeGitCommand:'add ',relPath name inDirectory:self repositoryName) ifFalse:[
         self halt
@@ -450,6 +474,25 @@
     "Created: / 23-07-2012 / 20:05:14 / cg"
 !
 
+commitRepository:repositoryDirectory logMessage:logMessage
+    |logArg|
+
+    self 
+        executeGitCommand:('status') 
+        outputTo:Transcript 
+        errorTo:Transcript     
+        inDirectory:repositoryDirectory.
+
+    logArg := logMessage copyReplaceAll:$" withAll:''''''.
+    self 
+        executeGitCommand:('commit -m "',logArg,'"') 
+        outputTo:Transcript 
+        errorTo:Transcript     
+        inDirectory:repositoryDirectory.
+
+    "Created: / 25-07-2012 / 22:47:57 / cg"
+!
+
 createContainerFor:aClass inModule:moduleName directory:dirName container:fileName
     "create a new container & check into it an initial version of aClass"
 
@@ -516,6 +559,12 @@
     ^ self standardRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName revision:revisionString
 
     "Created: / 23-07-2012 / 19:01:17 / cg"
+!
+
+updateRepository:repositoryDirectory
+    self executeGitCommand:'update' inDirectory:repositoryDirectory
+
+    "Created: / 25-07-2012 / 18:55:56 / cg"
 ! !
 
 !GitSourceCodeManager class methodsFor:'debugging'!
@@ -530,6 +579,12 @@
 
 !GitSourceCodeManager class methodsFor:'queries'!
 
+isContainerBased
+    ^ false
+
+    "Created: / 24-07-2012 / 18:21:32 / cg"
+!
+
 isResponsibleForPackage:aString
     ^true.
 
@@ -597,11 +652,11 @@
 !GitSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/GitSourceCodeManager.st,v 1.5 2012-07-24 07:38:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/GitSourceCodeManager.st,v 1.6 2012-07-25 23:31:16 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/GitSourceCodeManager.st,v 1.5 2012-07-24 07:38:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/GitSourceCodeManager.st,v 1.6 2012-07-25 23:31:16 cg Exp $'
 ! !
 
 GitSourceCodeManager initialize!