Skip to content

Commit

Permalink
Start of Pure Git experiment with PureGitRepository, PureGitCommit an…
Browse files Browse the repository at this point in the history
…d PureGitTag
  • Loading branch information
svenvc committed Sep 1, 2024
1 parent 4dd1bfa commit 299aeef
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/GToolkit4Git/PureGitCommit.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Extension { #name : #PureGitCommit }

{ #category : #'*GToolkit4Git' }
PureGitCommit >> gtDetailsFor: composite [
<gtView>
^ composite columnedList
title: 'Details';
priority: 30;
items: [ {
{ 'Commit' . self id }.
{ 'Parents'
. self ancestorIds asCommaString
. self ancestorIds collect: [ :each | self repository resolveCommit: each ] }.
{ 'Author' . self author }.
{ 'Timestamp' . self timestamp }.
{ 'Comment' . self comment }
} ];
column: 'key' text: #first;
column: 'value' text: #second weight: 3;
send: #last
]
91 changes: 91 additions & 0 deletions src/GToolkit4Git/PureGitRepository.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
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>

| 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
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> gtDetails [
^ {
{ 'location' . self location ifNil: [ 'not set' ] . self location }.
{ 'exists' . self exists }
}
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> gtDetailsFor: composite [
<gtView>
^ composite columnedList
title: 'Details';
priority: 20;
items: [ self gtDetails ];
column: 'key' text: #first;
column: 'value' text: #second weight: 3;
send: #last
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> gtLogFor: composite [
<gtView>

^ composite columnedList
title: 'Log';
priority: 30;
items: [ self log ];
column: 'Commit' text: [ :commit | commit id ];
column: 'Timestamp' text: [ :commit | commit timestamp ];
column: 'Author' text: [ :commit | commit author ];
column: 'Comment' text: [ :commit | commit comment ]
]

{ #category : #'*GToolkit4Git' }
PureGitRepository >> gtTagsFor: composite [
<gtView>

^ composite columnedList
title: 'Tags';
priority: 40;
items: [ self tags ];
column: 'Name' text: [ :tag | tag name ];
column: 'Commit' text: [ :tag | tag commitId ]
]
16 changes: 16 additions & 0 deletions src/GToolkit4Git/PureGitTag.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Extension { #name : #PureGitTag }

{ #category : #'*GToolkit4Git' }
PureGitTag >> 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
]

0 comments on commit 299aeef

Please sign in to comment.