SVN__CommitTask.st
changeset 675 cdbc7651a0a0
parent 492 74ff0960961c
child 887 712c4ef37cb7
--- a/SVN__CommitTask.st	Mon Aug 08 14:44:04 2011 +0200
+++ b/SVN__CommitTask.st	Mon Aug 08 14:44:29 2011 +0200
@@ -1,3 +1,28 @@
+"
+ Copyright (c) 2007-2010 Jan Vrany
+ Copyright (c) 2009-2010 eXept Software AG
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+"
 "{ Package: 'stx:libsvn' }"
 
 "{ NameSpace: SVN }"
@@ -9,26 +34,80 @@
 	category:'SVN-Tasks'
 !
 
+!CommitTask class methodsFor:'documentation'!
+
+copyright
+"
+ Copyright (c) 2007-2010 Jan Vrany
+ Copyright (c) 2009-2010 eXept Software AG
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the 'Software'), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+"
+! !
+
+!CommitTask class methodsFor:'others'!
+
+version_CVS
+    ^ '$ÂHeader: /cvs/stx/stx/libsvn/SVN__CommitTask.st,v 1.6 2009/10/19 12:52:48 fm Exp Â$'
+! !
 
 !CommitTask methodsFor:'accessing'!
 
-buildSupportFilesFor: pkgDef
-
-    | common |
-    common := #('abbrev.stc' 'Make.proto' 'Make.spec').
-    ^pkgDef isApplicationDefinition
-	ifTrue:[common]
-	ifFalse:[common copyWith: 'libInit.cc']
+message
 
-    "
-	SVN::CommitTask basicNew buildSupportFilesFor: stx_goodies_libsvn
-    "
+    message ifNil:[
+        | changedClasses changedMethods |
+        changedClasses := OrderedSet new.
+        changedMethods := OrderedSet new.
+        (ChangeSet current changesForPackage: package) do:
+            [:chg| | chgCls |        
+            chg isClassChange ifTrue:
+                [(chgCls := chg changeClass theNonMetaclass) package == package
+                    ifTrue:
+                        [(classes isNil or:[classes includes: chgCls]) ifTrue:
+                            [changedClasses add: chgCls]]
+                    ifFalse:
+                        [chg isMethodDefinitionChange ifTrue:
+                            [changedMethods add: chg changeMethod]]]].
+        message := String streamContents:
+            [:s|
+            s cr.
+            changedClasses isEmpty ifFalse:
+                [s nextPutLine:'## Changed classes:'.
+                changedClasses do:
+                    [:cls|s nextPutAll:'##   ';nextPutAll: cls name; cr]].
+            changedMethods isEmpty ifFalse:
+                [s nextPutLine:'## Changed methods:'.
+                changedMethods do:
+                    [:m|
+                    s   nextPutAll:'##   '; nextPutAll: m mclass name; 
+                        nextPutAll:' >> #'; nextPutAll: m selector;  cr]].     
+            s nextPutLine:'##'.
+            s nextPutLine:'## Lines starting with ## will be removed'.
+    ]].
+    ^message.
 
-    "Created: / 20-06-2009 / 12:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-message
-    ^ message
+    "Modified: / 01-08-2010 / 13:02:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 message:aString
@@ -38,53 +117,60 @@
 !CommitTask methodsFor:'executing'!
 
 do
-
     self
-	doUpdateWorkingCopy;
-	doCommit
+        doPrepareWorkingCopy;
+        doCommit
 
     "Created: / 23-03-2009 / 11:15:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 17-06-2009 / 10:16:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 doCommit
-    | containers  commitInfo |
+    |containers commitInfo msg|
+
+    msg := ((message ? '<no commit message>') asStringCollection
+                reject: [:line|line size >= 2 and:[line first == $# and:[line second == $#]]])
+                asString.
 
-    self do:
-	    [ SVN::ActivityNotification notify: 'Commiting ' , self package.
-	    containers := self isSelectiveFileoutTask
-			ifTrue: [ self containersToFileOut ]
-			ifFalse: [ #() ].
-	    self synchronized:
-		    [ commitInfo := (CommitCommand new)
-				workingCopy: self workingCopy;
-				message: message ? '<no message>';
-				paths: containers;
-				execute.
-		     "Update the working copy. We need svn info
-		     to report commited revision"
-		    (UpdateCommand new)
-			workingCopy: self workingCopy;
-			execute ].
-	    self doCompileSvnRevisionNrMethod: true.
-	    SVN::ActivityNotification notify: 'Shrinking changes'.
-	    (ChangeSet current)
-		condenseChangesForPackage2: self package;
-		condenseChangesForExtensionsInPackage: self package;
-		flushChangedClassesCache;
-		yourself. ].
+    self do:[
+        ActivityNotification notify:'Commiting ' , self package.
+        containers := self isSelectiveFileoutTask ifTrue:[
+                    self containersToFileOut
+                ] ifFalse:[ #() ].
+        self 
+            synchronized:[
+                commitInfo := (CommitCommand new)
+                            workingCopy:self workingCopy;
+                            message: msg;
+                            paths:containers;
+                            execute.
+                 "Update the working copy. We need svn info
+                 to report commited revision"
+                (UpdateCommand new)
+                    workingCopy:self workingCopy;
+                    execute
+            ].
+        self doCompileSvnRevisionNrMethod:true.
+        self doCompileSvnRepositoryUrlStringMethod.        
+        ActivityNotification notify:'Shrinking changes'.
+        (ChangeSet current)
+            condenseChangesForPackage2:self package;
+            condenseChangesForExtensionsInPackage:self package;
+            flushChangedClassesCache;
+            yourself.
+    ].
     self workingCopy commited.
     ^ commitInfo
 
     "Created: / 11-04-2008 / 09:20:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 19-08-2009 / 12:27:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 08-04-2011 / 15:58:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-doUpdateWorkingCopy
-
+doPrepareWorkingCopy
     self do:[
-	self workingCopy ensureIsValid.
-	self doFileOutAll
+        self workingCopy ensureIsValid.
+        self doFileOutAll
     ]
 
     "Created: / 11-04-2008 / 09:19:27 / Jan Vrany <vranyj1@fel.cvut.cz>"
@@ -94,13 +180,9 @@
 !CommitTask class methodsFor:'documentation'!
 
 version
-    ^ '$Header$'
-!
-
-version_CVS
-    ^ '$Header$'
+    ^ '$Id$'
 !
 
 version_SVN
-    ^'§Id: SVN__CommitTask.st 110 2009-08-19 13:21:10Z vranyj1 §'
+    ^ '§Id: SVN__CommitTask.st 350 2011-07-07 18:42:56Z vranyj1 §'
 ! !