Skip to content

Commit

Permalink
Introduced PureGitExamples
Browse files Browse the repository at this point in the history
Added PureGit[Local|Remote]Branch
  • Loading branch information
svenvc committed Sep 2, 2024
1 parent 299aeef commit 571077b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 42 deletions.
16 changes: 16 additions & 0 deletions src/GToolkit4Git/PureGitBranch.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Extension { #name : #PureGitBranch }

{ #category : #'*GToolkit4Git' }
PureGitBranch >> gtDetailsFor: composite [
<gtView>
^ 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
]
47 changes: 47 additions & 0 deletions src/GToolkit4Git/PureGitExamples.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Extension { #name : #PureGitExamples }

{ #category : #'*GToolkit4Git' }
PureGitExamples >> exampleGToolkit [
<gtExample>
<noTest>

| repository |
repository := PureGitRepository on: (IceRepository repositoryNamed: 'gtoolkit') location.

self assert: repository exists.

^ repository
]

{ #category : #'*GToolkit4Git' }
PureGitExamples >> exampleGt4Git [
<gtExample>
<noTest>

| repository |
repository := PureGitRepository on: (IceRepository repositoryNamed: 'gt4git') location.

self assert: repository exists.

^ repository
]

{ #category : #'*GToolkit4Git' }
PureGitExamples >> exampleGt4GitRootCommit [
<gtExample>
<noTest>

| 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
]
60 changes: 18 additions & 42 deletions src/GToolkit4Git/PureGitRepository.extension.st
Original file line number Diff line number Diff line change
@@ -1,55 +1,31 @@
Extension { #name : #PureGitRepository }

{ #category : #'*GToolkit4Git' }
PureGitRepository >> exampleGToolkit [
<gtExample>
<noTest>

self location: (IceRepository repositoryNamed: 'gtoolkit') location.

self assert: self exists.

^ self
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> exampleGt4Git [
<gtExample>
<noTest>

self location: (IceRepository repositoryNamed: 'gt4git') location.

self assert: self exists.

^ self
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> exampleGt4GitRootCommit [
<gtExample>
<noTest>
PureGitRepository >> gtBranchesFor: composite [
<gtView>

| 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' }
Expand Down

0 comments on commit 571077b

Please sign in to comment.