SVN__CommitCommand.st
author fm
Wed, 23 Sep 2009 18:49:44 +0200
changeset 71 0c82db5d040e
child 175 efa0956a1016
permissions -rw-r--r--
initial checkin

"{ Package: 'cvut:stx/goodies/libsvn' }"

"{ NameSpace: SVN }"

WCPathCommand subclass:#CommitCommand
	instanceVariableNames:'message url username password noAuthCache'
	classVariableNames:''
	poolDictionaries:''
	category:'SVN-Private-Commands'
!

!CommitCommand class methodsFor:'documentation'!

version_SVN
    ^'$Id$'
! !

!CommitCommand methodsFor:'accessing'!

message
    ^ message

    "Created: / 19-03-2008 / 15:59:36 / janfrog"
!

message:aString
    message := aString.

    "Created: / 19-03-2008 / 15:59:36 / janfrog"
    "Modified: / 31-03-2008 / 14:20:11 / janfrog"
!

url
    ^ url

    "Created: / 03-10-2008 / 18:19:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

url:something
    url := something.

    "Created: / 03-10-2008 / 18:19:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CommitCommand methodsFor:'executing'!

execute
    ^ [ super execute ] on:SVN::AuthorizationError
        do:[:ex | 
    |credentials dialog|

    credentials := Credentials new username:OperatingSystem getLoginName.
    credentials := (dialog := CredentialsDialog new)
                model:credentials;
                subtitle:self url;
                open.
    credentials 
        ifNil:[ ex pass ]
        ifNotNil:[
            username := credentials username.
            password := credentials password.
            noAuthCache := dialog savePassword not.
            self execute
        ]
]

    "Created: / 03-10-2008 / 18:22:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 15-07-2009 / 12:09:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CommitCommand methodsFor:'executing - private'!

svnCmd
    "raise an error: must be redefined in concrete subclass(es)"

    ^'commit'

    "Created: / 16-03-2008 / 07:47:00 / janfrog"
!

svnCmdArgumentsOn:arg 

    arg nextPut:'--message'; nextPut: (message ? '').
    super svnCmdArgumentsOn:arg

    "Created: / 19-03-2008 / 15:59:13 / janfrog"
    "Modified: / 31-03-2008 / 14:13:03 / janfrog"
!

svnGlobalArgumentsOn: argStream

    super svnGlobalArgumentsOn: argStream.

    "/argStream nextPut:'--config-dir'; nextPut:'/tmp/.svn'; nextPut:'--no-auth-cache'.

    username ifNotNil:
        [argStream 
            nextPut: '--username';
            nextPut: username].
    password ifNotNil:
        [argStream 
            nextPut: '--password';
            nextPut: password].
    noAuthCache == true ifTrue:
        [argStream
            nextPutAll:'--no-auth-cache']

    "Created: / 31-10-2008 / 09:30:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

svnProcessCommandOutput:arg1 err:arg2 
    "Superclass says that I am responsible to implement this method"
    
    ^ arg1 contents

    "Created: / 03-10-2008 / 16:31:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!CommitCommand class methodsFor:'documentation'!

version
    ^ '$Header$'
! !