SVN__ListCommand.st
author fm
Wed, 23 Sep 2009 18:51:35 +0200
changeset 91 422d7b237477
child 139 04fc02f6bb12
permissions -rw-r--r--
initial checkin

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

"{ NameSpace: SVN }"

BranchCommand subclass:#ListCommand
	instanceVariableNames:'url recursive'
	classVariableNames:''
	poolDictionaries:''
	category:'SVN-Private-Commands'
!

!ListCommand class methodsFor:'documentation'!

version_SVN
    ^'$Id$'
! !

!ListCommand class methodsFor:'executing'!

list: url 
    ^ (self new)
        url: url;
        execute

    "Created: / 19-03-2008 / 08:27:10 / janfrog"
    "Modified: / 19-08-2009 / 13:28:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!ListCommand methodsFor:'accessing'!

recursive
    ^ recursive ? false

    "Created: / 15-03-2008 / 20:56:05 / janfrog"
!

recursive:aBoolean
    recursive := aBoolean.

    "Created: / 15-03-2008 / 20:56:05 / janfrog"
!

url
    ^ url ifNil:[ branch url]

    "Modified: / 19-08-2009 / 13:28:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

url:aString
    url := aString.
! !

!ListCommand methodsFor:'executing - private'!

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

    ^'list'

    "Created: / 15-03-2008 / 21:03:32 / janfrog"
!

svnCmdArgumentsOn: argStream 
    self recursive ifTrue: [ argStream nextPut: '--recursive' ].
    argStream
        nextPut: '-r';
        nextPut: self revision printString;
        nextPut: '--xml';
        nextPut: self url asString

    "Created: / 15-03-2008 / 21:21:11 / janfrog"
    "Modified: / 16-03-2008 / 07:38:11 / janfrog"
    "Modified: / 19-04-2008 / 13:57:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

svnParseXML: doc 
    ^ (doc root / 'list' / 'entry') asCollection 
        collect: [:entryNode | RepositoryEntry readFromXml: entryNode ]

    "Created: / 19-04-2008 / 13:56:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 19-08-2009 / 09:05:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

svnProcessCommandOutput:out err:err 
    ^ self svnParseXML:((XML::XMLParser on:out)
                validate:false;
                scanDocument)

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

!ListCommand class methodsFor:'documentation'!

version
    ^ '$Header$'
! !