--- a/git/GitCommit.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitCommit.st Mon Sep 10 13:37:31 2012 +0000
@@ -25,6 +25,15 @@
^0
! !
+!GitCommit methodsFor:'accessing'!
+
+message
+
+ ^GitPrimitives prim_git_commit_message: self.
+
+ "Created: / 10-09-2012 / 14:34:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!GitCommit class methodsFor:'documentation'!
version_SVN
--- a/git/GitError.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitError.st Mon Sep 10 13:37:31 2012 +0000
@@ -1,52 +1,71 @@
"{ Package: 'stx:libscm/git' }"
-ExternalStructure subclass:#GitError
- instanceVariableNames:''
+Error subclass:#GitError
+ instanceVariableNames:'code klass'
classVariableNames:''
poolDictionaries:''
- category:'Git-Support-libgit2'
+ category:'Git-Exceptions'
!
-!GitError class methodsFor:'accessing'!
-
-libraryName
+!GitError class methodsFor:'raising'!
- OperatingSystem isUNIXlike ifTrue:[^'libgit2.so'].
+raise: code
+ "Raises a GitError with given code. Class and message is
+ take from last giterr_last, which is then cleared."
- OperatingSystem isMSWINDOWSlike ifTrue:[^'git2.dll'].
+ ^self new raise: code
- self error:'Library name for host OS is not known'
+ "Created: / 10-09-2012 / 14:17:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-structSize
- "Returns size of undelaying structure in bytes"
+raiseIfError: code
+ "Raises a GitError with given code if its an error.
+ Class and message is take from last giterr_last, which is then cleared."
- ^8
+ code ~~ 0"OK" ifTrue:[
+ self new raise: code
+ ].
+
+ "Created: / 10-09-2012 / 14:25:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitError methodsFor:'accessing'!
+code
+ ^ code
+!
+
+code:anInteger
+ code := anInteger.
+!
+
klass
- "Returns int32"
-
- ^self longAt:1 + 4
+ ^ klass
!
-klass: value
+klass:anInteger
+ klass := anInteger.
+! !
- self longAt:1 + 4 put:value
-!
+!GitError methodsFor:'raising'!
+
+raise: gitErrorCode
+ "Raises a GitError with given code. Class and message is
+ take from last giterr_last, which is then cleared."
-message
- "Returns (pointer-to char)"
+ | git_error |
- ^self pointerAt:1 + 0
-!
+ code := gitErrorCode.
+ git_error := GitPrimitives prim_giterr_last.
+ git_error setSize: 8.
+ messageText := (git_error pointerAt: 1) copyCStringFromHeap.
+ klass := git_error longAt:1+4.
+ GitPrimitives prim_giterr_clear.
-message: value
+ ^self raise
- self pointerAt:1 + 0 put:value
+ "Created: / 10-09-2012 / 14:23:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitError class methodsFor:'documentation'!
--- a/git/GitErrorCode.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitErrorCode.st Mon Sep 10 13:37:31 2012 +0000
@@ -7,7 +7,7 @@
GITERR_ODB GITERR_INDEX GITERR_OBJECT GITERR_NET GITERR_TAG
GITERR_TREE GITERR_INDEXER GITERR_SSL GITERR_SUBMODULE'
poolDictionaries:''
- category:'Git-Support-libgit2'
+ category:'Git-Model'
!
--- a/git/GitObjectType.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitObjectType.st Mon Sep 10 13:37:31 2012 +0000
@@ -5,7 +5,7 @@
classVariableNames:'OBJ_ANY OBJ_BAD OBJ__EXT1 OBJ_COMMIT OBJ_TREE OBJ_BLOB OBJ_TAG
OBJ__EXT2 OBJ_OFS_DELTA OBJ_REF_DELTA'
poolDictionaries:''
- category:'Git-Support-libgit2'
+ category:'Git-Model'
!
--- a/git/GitOid.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitOid.st Mon Sep 10 13:37:31 2012 +0000
@@ -11,21 +11,29 @@
!GitOid class methodsFor:'instance creation'!
fromString: aString
- | sz oid s hi lo |
+ | oid |
- sz := aString size.
- sz ~~ 40 ifTrue:[
- self error:'Not a SHA-1 hex string (must have 40 chars)'.
- ^nil
- ].
oid := self new.
- s := aString readStream.
- 1 to: 20 do: [ :idx |
- hi := s next digitValue.
- lo := s next digitValue.
- oid at:idx put: ((hi bitShift:4) bitOr: lo)
- ].
- ^ oid
+ GitPrimitives prim_git_oid_fromstr: oid str: aString.
+ ^oid.
+
+
+
+"/ | sz oid s hi lo |
+"/
+"/ sz := aString size.
+"/ sz ~~ 40 ifTrue:[
+"/ self error:'Not a SHA-1 hex string (must have 40 chars)'.
+"/ ^nil
+"/ ].
+"/ oid := self new.
+"/ s := aString readStream.
+"/ 1 to: 20 do: [ :idx |
+"/ hi := s next digitValue.
+"/ lo := s next digitValue.
+"/ oid at:idx put: ((hi bitShift:4) bitOr: lo)
+"/ ].
+"/ ^ oid
"
GitOid fromString: '7164acf359f5da8a4bc9cd3e03e2e461013c3811'
--- a/git/GitPrimitives.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitPrimitives.st Mon Sep 10 13:37:31 2012 +0000
@@ -2209,6 +2209,22 @@
<cdecl: int32 "git_treebuilder_write" ( charPointer GitRepository GitTreebuilder ) >
self primitiveFailed
+!
+
+prim_giterr_clear
+
+ <cdecl: void "giterr_clear" ( ) >
+ self primitiveFailed
+
+ "Created: / 10-09-2012 / 14:19:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prim_giterr_last
+
+ <cdecl: pointer "giterr_last" ( ) >
+ self primitiveFailed
+
+ "Created: / 10-09-2012 / 14:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitPrimitives class methodsFor:'documentation'!
--- a/git/GitRepository.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/GitRepository.st Mon Sep 10 13:37:31 2012 +0000
@@ -59,12 +59,13 @@
].
ref := ByteArray new: ExternalBytes sizeofPointer.
err := GitPrimitives prim_git_object_lookup: ref repo: self id: oid type: typeId.
- err ~~ 0 ifTrue:[
- self error:'gitlib2 error'
- ].
+ GitError raiseIfError: err.
+
typeId == OBJ_ANY ifTrue:[
obj := ExternalAddress new setAddressFromBytes:ref.
type := GitPrimitives prim_git_object_type: obj.
+ ] ifFalse:[
+ type := typeId.
].
^GitObject type: type addressBytes: ref.
--- a/git/Make.proto Mon Sep 10 10:32:46 2012 +0000
+++ b/git/Make.proto Mon Sep 10 13:37:31 2012 +0000
@@ -131,7 +131,7 @@
$(OUTDIR)GitDiffList.$(O) GitDiffList.$(H): GitDiffList.st $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)GitDiffOptions.$(O) GitDiffOptions.$(H): GitDiffOptions.st $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)GitDiffRange.$(O) GitDiffRange.$(H): GitDiffRange.st $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)GitError.$(O) GitError.$(H): GitError.st $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)GitError.$(O) GitError.$(H): GitError.st $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)GitErrorCode.$(O) GitErrorCode.$(H): GitErrorCode.st $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)GitHandle.$(O) GitHandle.$(H): GitHandle.st $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)GitIndex.$(O) GitIndex.$(H): GitIndex.st $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/git/abbrev.stc Mon Sep 10 10:32:46 2012 +0000
+++ b/git/abbrev.stc Mon Sep 10 13:37:31 2012 +0000
@@ -12,7 +12,7 @@
GitDiffList GitDiffList stx:libscm/git 'Git-Support-libgit2' 1
GitDiffOptions GitDiffOptions stx:libscm/git 'Git-Support-libgit2' 1
GitDiffRange GitDiffRange stx:libscm/git 'Git-Support-libgit2' 1
-GitError GitError stx:libscm/git 'Git-Support-libgit2' 1
+GitError GitError stx:libscm/git 'Git-Exceptions' 1
GitIndex GitIndex stx:libscm/git 'Git-Support-libgit2' 1
GitIndexEntry GitIndexEntry stx:libscm/git 'Git-Support-libgit2' 1
GitIndexEntryUnmerged GitIndexEntryUnmerged stx:libscm/git 'Git-Support-libgit2' 1
@@ -52,5 +52,5 @@
stx_libscm_git stx_libscm_git stx:libscm/git '* Projects & Packages *' 3
GitHandle GitHandle stx:libscm/git 'Git-Model' 0
GitStructure GitStructure stx:libscm/git 'Git-Model' 1
-GitErrorCode GitErrorCode stx:libscm/git 'Git-Support-libgit2' 0
-GitObjectType GitObjectType stx:libscm/git 'Git-Support-libgit2' 0
+GitErrorCode GitErrorCode stx:libscm/git 'Git-Model' 0
+GitObjectType GitObjectType stx:libscm/git 'Git-Model' 0
--- a/git/bc.mak Mon Sep 10 10:32:46 2012 +0000
+++ b/git/bc.mak Mon Sep 10 13:37:31 2012 +0000
@@ -67,7 +67,7 @@
$(OUTDIR)GitDiffList.$(O) GitDiffList.$(H): GitDiffList.st $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)GitDiffOptions.$(O) GitDiffOptions.$(H): GitDiffOptions.st $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)GitDiffRange.$(O) GitDiffRange.$(H): GitDiffRange.st $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)GitError.$(O) GitError.$(H): GitError.st $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GitError.$(O) GitError.$(H): GitError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)GitErrorCode.$(O) GitErrorCode.$(H): GitErrorCode.st $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)GitHandle.$(O) GitHandle.$(H): GitHandle.st $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)GitIndex.$(O) GitIndex.$(H): GitIndex.st $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/git/git.rc Mon Sep 10 10:32:46 2012 +0000
+++ b/git/git.rc Mon Sep 10 13:37:31 2012 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2012\nCopyright eXept Software AG 1998-2012\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.1\0"
- VALUE "ProductDate", "Mon, 10 Sep 2012 10:33:00 GMT\0"
+ VALUE "ProductDate", "Mon, 10 Sep 2012 13:37:24 GMT\0"
END
END
--- a/git/stx_libscm_git.st Mon Sep 10 10:32:46 2012 +0000
+++ b/git/stx_libscm_git.st Mon Sep 10 13:37:31 2012 +0000
@@ -160,7 +160,7 @@
"Return a SVN revision number of myself.
This number is updated after a commit"
- ^ "$SVN-Revision:"'nil '"$"
+ ^ "$SVN-Revision:"'4 '"$"
! !
!stx_libscm_git class methodsFor:'documentation'!