git/GitObject.st
author vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Tue, 25 Sep 2012 15:35:04 +0000
changeset 16 83e178bfe891
parent 10 3d98ee6c5c64
child 20 24ae01b36807
permissions -rw-r--r--
- GitCommitterQuery added: #version_SVN - stx_libscm_git changed: #classNamesAndAttributes #extensionMethodNames #preRequisites - GitSignatureQuery added: #version_SVN - GitAuthorQuery added: #version_SVN - GitReference added: #version_SVN - extensions ...

"{ Package: 'stx:libscm/git' }"

GitLibraryObject subclass:#GitObject
	instanceVariableNames:'oid repository'
	classVariableNames:''
	poolDictionaries:'GitObjectType'
	category:'SCM-Git-Model'
!


!GitObject class methodsFor:'instance creation'!

newForType: type
    type == OBJ_ANY ifTrue:[
        ^self new
    ].
    type == OBJ_COMMIT ifTrue:[
        ^GitCommit new
    ].
    type == OBJ_TREE ifTrue:[
        ^GitTree new
    ].
    type == OBJ_TAG ifTrue:[
        ^GitTag new 
    ].
    type == OBJ_BLOB ifTrue:[
        ^GitBlob new
    ].
    self error:'Unsupported git object type: ', type printString.

    "Created: / 10-09-2012 / 18:52:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject class methodsFor:'accessing'!

structSize
    "Returns size of undelaying structure in bytes"

    ^0
! !

!GitObject methodsFor:'accessing'!

oid
    ^ oid
!

repository
    ^ repository
! !

!GitObject methodsFor:'initialization'!

setOid: aGitOid
    oid := aGitOid

    "Created: / 10-09-2012 / 18:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

setRepository: aGitRepository
    repository := aGitRepository

    "Created: / 10-09-2012 / 18:50:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject methodsFor:'initialization & release'!

free
    handle notNil ifTrue:[
        GitPrimitives prim_git_object_free: handle.
        handle := nil.
    ].

    "Created: / 17-09-2012 / 21:16:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject methodsFor:'testing'!

isGitObject
    ^true

    "Created: / 19-09-2012 / 13:55:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !