diff --git a/src/GToolkit4Git/PureGitBranch.extension.st b/src/GToolkit4Git/PureGitBranch.extension.st new file mode 100644 index 00000000..c28cee88 --- /dev/null +++ b/src/GToolkit4Git/PureGitBranch.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #PureGitBranch } + +{ #category : #'*GToolkit4Git' } +PureGitBranch >> gtDetailsFor: composite [ + + ^ composite columnedList + title: 'Details'; + priority: 30; + items: [ { + { 'Name' . self name ifNil: [ '' ] . self name }. + { 'Commit' . self commitId . self commit } + } ]; + column: 'key' text: #first; + column: 'value' text: #second weight: 3; + send: #last +] diff --git a/src/GToolkit4Git/PureGitExamples.extension.st b/src/GToolkit4Git/PureGitExamples.extension.st new file mode 100644 index 00000000..5e7cdfc0 --- /dev/null +++ b/src/GToolkit4Git/PureGitExamples.extension.st @@ -0,0 +1,47 @@ +Extension { #name : #PureGitExamples } + +{ #category : #'*GToolkit4Git' } +PureGitExamples >> exampleGToolkit [ + + + + | repository | + repository := PureGitRepository on: (IceRepository repositoryNamed: 'gtoolkit') location. + + self assert: repository exists. + + ^ repository +] + +{ #category : #'*GToolkit4Git' } +PureGitExamples >> exampleGt4Git [ + + + + | repository | + repository := PureGitRepository on: (IceRepository repositoryNamed: 'gt4git') location. + + self assert: repository exists. + + ^ repository +] + +{ #category : #'*GToolkit4Git' } +PureGitExamples >> exampleGt4GitRootCommit [ + + + + | repository rootCommit | + + repository := self exampleGt4Git. + + rootCommit := repository resolveCommit: '9cfbcd6a921f237abc14446d565cc440a60793e8'. + + self assert: rootCommit isRoot. + self assert: rootCommit id = '9cfbcd6a921f237abc14446d565cc440a60793e8'. + self assert: rootCommit commitId = '9cfbcd6a921f237abc14446d565cc440a60793e8'. + self assert: rootCommit author = 'George Ganea'. + self assert: (rootCommit comment includesSubstring: 'created a new repo'). + + ^ rootCommit +] diff --git a/src/GToolkit4Git/PureGitRepository.extension.st b/src/GToolkit4Git/PureGitRepository.extension.st index 705b27c8..9cb85271 100644 --- a/src/GToolkit4Git/PureGitRepository.extension.st +++ b/src/GToolkit4Git/PureGitRepository.extension.st @@ -1,55 +1,31 @@ Extension { #name : #PureGitRepository } { #category : #'*GToolkit4Git' } -PureGitRepository >> exampleGToolkit [ - - - - self location: (IceRepository repositoryNamed: 'gtoolkit') location. - - self assert: self exists. - - ^ self -] - -{ #category : #'*GToolkit4Git' } -PureGitRepository >> exampleGt4Git [ - - - - self location: (IceRepository repositoryNamed: 'gt4git') location. - - self assert: self exists. - - ^ self -] - -{ #category : #'*GToolkit4Git' } -PureGitRepository >> exampleGt4GitRootCommit [ - - +PureGitRepository >> gtBranchesFor: composite [ + - | rootCommit | - - self exampleGt4Git. - - rootCommit := self resolveCommit: '9cfbcd6a921f237abc14446d565cc440a60793e8'. - - self assert: rootCommit isRoot. - self assert: rootCommit id = '9cfbcd6a921f237abc14446d565cc440a60793e8'. - self assert: rootCommit commitId = '9cfbcd6a921f237abc14446d565cc440a60793e8'. - self assert: rootCommit author = 'George Ganea'. - self assert: (rootCommit comment includesSubstring: 'created a new repo'). - - ^ rootCommit + ^ composite columnedList + title: 'Branches'; + priority: 35; + items: [ self allBranches ]; + column: 'Name' text: [ :branch | branch name ]; + column: 'Type' text: [ :branch | branch branchType ]; + column: 'Commit' text: [ :branch | branch commitId ] ] { #category : #'*GToolkit4Git' } PureGitRepository >> gtDetails [ - ^ { + | details | + details := { { 'location' . self location ifNil: [ 'not set' ] . self location }. { 'exists' . self exists } - } + }. + self exists + ifTrue: [ + details := details , { + { 'HEAD' . self head commitId . self head } + } ]. + ^ details ] { #category : #'*GToolkit4Git' }