SVN__WCCommand.st
changeset 95 135571c6804f
child 160 1e872a62c0f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SVN__WCCommand.st	Wed Sep 23 18:51:58 2009 +0200
@@ -0,0 +1,100 @@
+"{ Package: 'cvut:stx/goodies/libsvn' }"
+
+"{ NameSpace: SVN }"
+
+Command subclass:#WCCommand
+	instanceVariableNames:'alreadyCleaned workingCopy'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SVN-Private-Commands'
+!
+
+!WCCommand class methodsFor:'documentation'!
+
+version_SVN
+    ^'$Id$'
+! !
+
+!WCCommand methodsFor:'accessing'!
+
+workingCopy
+    ^ workingCopy
+
+    "Created: / 16-03-2008 / 10:10:38 / janfrog"
+!
+
+workingCopy:aSVNWorkingCopy
+
+    self assert: (aSVNWorkingCopy isKindOf: SVN::WorkingCopy).
+
+    workingCopy := aSVNWorkingCopy.
+
+    "Created: / 16-03-2008 / 10:10:38 / janfrog"
+    "Modified: / 19-08-2009 / 11:28:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!WCCommand methodsFor:'executing'!
+
+execute
+    ^[super execute] on:SVN::WorkingCopyLockedError do:
+        [:ex | 
+        alreadyCleaned 
+            ifTrue:
+                [ex pass]
+            ifFalse:
+                [self svnCleanup.
+                alreadyCleaned := true.
+                self execute]]
+
+    "Created: / 08-11-2008 / 08:30:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!WCCommand methodsFor:'executing - private'!
+
+svnCleanup
+
+    ^CleanupCommand new
+        workingCopy: workingCopy;
+        execute.
+
+    "Created: / 08-11-2008 / 08:14:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+svnCmdArgumentsOn:arg 
+
+    "arg nextPut:'-m'; nextPut: (message ? '')"
+
+    "Created: / 16-03-2008 / 10:18:46 / janfrog"
+    "Modified: / 19-03-2008 / 15:58:57 / janfrog"
+!
+
+svnCmdWorkdir
+    "raise an error: must be redefined in concrete subclass(es)"
+
+    ^workingCopy path pathName
+
+    "Created: / 16-03-2008 / 10:10:34 / janfrog"
+    "Modified: / 19-08-2009 / 11:29:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+svnProcessCommandOutput:out err:err 
+    ^ out contents
+
+    "Created: / 03-10-2008 / 16:31:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!WCCommand methodsFor:'initialization'!
+
+initialize
+
+    super initialize.
+    alreadyCleaned := false
+
+    "Created: / 08-11-2008 / 08:15:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!WCCommand class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+! !