# HG changeset patch # User mawalch # Date 1501794021 -7200 # Node ID cbd2986e43deda60765f3face0774eef79426c78 # Parent 6f2f15e5248d6d4206ece5882dc2263ef31fb56f #OTHER by mawalch Some delintification. diff -r 6f2f15e5248d -r cbd2986e43de GitSourceCodeManager.st --- a/GitSourceCodeManager.st Mon Jul 17 17:59:54 2017 +0200 +++ b/GitSourceCodeManager.st Thu Aug 03 23:00:21 2017 +0200 @@ -4,7 +4,7 @@ This software is furnished under a license and may be used only in accordance with the terms of that license and with the - inclusion of the above copyright notice. This software may not + inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred. @@ -32,7 +32,7 @@ This software is furnished under a license and may be used only in accordance with the terms of that license and with the - inclusion of the above copyright notice. This software may not + inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred. @@ -214,14 +214,15 @@ gitExecutable:aString "set the name of the git executable." - aString isEmptyOrNil ifTrue:[ - GitExecutable := nil - ] ifFalse:[ - GitExecutable := aString. + GitExecutable := aString isEmptyOrNil ifTrue:[ + nil + ] ifFalse:[ + aString ]. "Modified: / 21-09-2006 / 16:41:33 / cg" "Created: / 02-03-2012 / 15:24:07 / cg" + "Modified: / 03-08-2017 / 22:44:40 / mawalch" ! gitTmpDirectory @@ -371,6 +372,44 @@ "Created: / 03-03-2012 / 11:08:37 / cg" ! ! +!GitSourceCodeManager class methodsFor:'basic access'! + +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." + + |path relPath logArg out err| + + relPath := (moduleDir asFilename construct:packageDir) construct:classFileName. + path := self repositoryName asFilename construct:relPath. + sourceFileOrNil notNil ifTrue:[ + sourceFileOrNil asFilename moveTo: path. + ]. + + (self executeGitCommand:'add ',relPath name inDirectory:self repositoryName) ifFalse:[ + self halt:'git command failed' + ]. + + out := WriteStream on:(String new:100). + err := WriteStream on:(String new:100). + (self executeGitCommand:'status --porcelain' outputTo:out errorTo:err inDirectory:self repositoryName) ifFalse:[ + self halt:'git command failed' + ]. + (out contents withoutSeparators isEmptyOrNil) ifTrue:[ + (err contents withoutSeparators isEmptyOrNil) ifTrue:[ + "/ nothing to commit + ^ true + ]. + ]. + logArg := logMessage copyReplaceAll:$" withAll:''''''. + (self executeGitCommand:'commit -m "',logArg,'"' inDirectory:self repositoryName) ifFalse:[ + self halt:'git command failed' + ]. + ^ true + + "Created: / 23-07-2012 / 20:05:14 / cg" +! ! + !GitSourceCodeManager class methodsFor:'basic administration'! addFile:fileName inDirectory:dirPath @@ -444,42 +483,6 @@ "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." - - |path relPath logArg out err| - - relPath := (moduleDir asFilename construct:packageDir) construct:classFileName. - path := self repositoryName asFilename construct:relPath. - sourceFileOrNil notNil ifTrue:[ - sourceFileOrNil asFilename moveTo: path. - ]. - - (self executeGitCommand:'add ',relPath name inDirectory:self repositoryName) ifFalse:[ - self halt:'git command failed' - ]. - - out := WriteStream on:(String new:100). - err := WriteStream on:(String new:100). - (self executeGitCommand:'status --porcelain' outputTo:out errorTo:err inDirectory:self repositoryName) ifFalse:[ - self halt:'git command failed' - ]. - (out contents withoutSeparators isEmptyOrNil) ifTrue:[ - (err contents withoutSeparators isEmptyOrNil) ifTrue:[ - "/ nothing to commit - ^ true - ]. - ]. - logArg := logMessage copyReplaceAll:$" withAll:''''''. - (self executeGitCommand:'commit -m "',logArg,'"' inDirectory:self repositoryName) ifFalse:[ - self halt:'git command failed' - ]. - ^ true - - "Created: / 23-07-2012 / 20:05:14 / cg" -! - commitRepository:repositoryDirectory logMessage:logMessage |logArg| @@ -544,21 +547,6 @@ "Created: / 23-07-2012 / 18:40:25 / cg" ! -revisionInfoFromString:aString - "{ Pragma: +optSpace }" - - "return a VersionInfo object filled with revision info. - This extracts the relevant info from aString." - - ^ self revisionInfoFromStandardVersionString:aString - - " - self revisionInfoFromString:'Path: stx/libbasic/Array.st, Version: 123, User: cg, Time: 2011-12-21T21:03:08.826' - " - - "Created: / 23-07-2012 / 19:02:56 / cg" -! - updateRepository:repositoryDirectory self executeGitCommand:'update' inDirectory:repositoryDirectory @@ -645,6 +633,23 @@ "Modified: / 02-03-2012 / 15:17:42 / cg" ! ! +!GitSourceCodeManager class methodsFor:'source code administration'! + +revisionInfoFromString:aString + "{ Pragma: +optSpace }" + + "return a VersionInfo object filled with revision info. + This extracts the relevant info from aString." + + ^ self revisionInfoFromStandardVersionString:aString + + " + self revisionInfoFromString:'Path: stx/libbasic/Array.st, Version: 123, User: cg, Time: 2011-12-21T21:03:08.826' + " + + "Created: / 23-07-2012 / 19:02:56 / cg" +! ! + !GitSourceCodeManager class methodsFor:'testing'! isGit