Skip to content

Instantly share code, notes, and snippets.

@olekscode
Created June 20, 2021 00:34
Show Gist options
  • Save olekscode/2fecf20e52acb71505e4d5a648e89420 to your computer and use it in GitHub Desktop.
Save olekscode/2fecf20e52acb71505e4d5a648e89420 to your computer and use it in GitHub Desktop.
Extract diffs from the commit history between two versions
repositoryName := 'DataFrame'.
oldVersionTag := 'v1.0'.
newVersionTag := 'v2.0'.
repository := (IceRepository registry detect: [ :repo |
repo isValid and: [ repo name = repositoryName ] ]).
oldCommit := (repository tags detect: [ :tag | tag name = oldVersionTag ]) commit.
newCommit := (repository tags detect: [ :tag | tag name = newVersionTag ]) commit.
commitWalk := (IceLibgitCommitWalk forRepository: repository)
fromCommit: newCommit;
uptoCommit: oldCommit;
yourself.
commits := OrderedCollection new.
commitWalk commitsDo: [ :commit | commits add: commit ].
commits add: oldCommit.
commits := commits reversed.
diffs := OrderedCollection new.
(1 to: commits size - 1)
do: [ :i |
commit := commits at: i.
[ diffs add: (commit diffTo: commit parent) ]
on: Exception
do: [ "Nothing" ] ]
displayingProgress: [ :i | i asString, ' / ', commits size asString ].
commit := commits last.
diffs add: (commit diffTo: commit parent).
diffs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment