git.plantuml/git.plantuml

106 lines
2.9 KiB
Plaintext

''''''''''''''''''''''''''''''''''''''''''
' THIS FILE IS GENERATED FROM README.ORG '
''''''''''''''''''''''''''''''''''''''''''
' Author: Bram Schoenmakers <me@bramschoenmakers.nl>
' Source: https://apps.bram85.nl/gitea/bram/git.plantuml
' License: Attribution 4.0 International (CC BY 4.0)
' https://creativecommons.org/licenses/by/4.0/
@startuml
hide stereotype
skinparam interface {
backgroundColor Gold
}
skinparam rectangle {
backgroundColor<<branchLabel>> Green
fontColor<<branchLabel>> white
backgroundColor<<tag>> Yellow
fontSize 11
}
!function $commitName($branch, $number)
!return %string($branch + $number)
!endfunction
!procedure $declareCommit($name, $label="")
!if ($label != "")
circle $label as $name
!else
circle $name
!endif
!endprocedure
!procedure $root($name, $label="")
$declareCommit($name, $label)
!endprocedure
' $parent1 and $parent2 are supposed to be declared
!procedure $commit($name, $parent1, $parent2="", $label="")
$declareCommit($name, $label)
!if ($parent1 != "")
($parent1) -up-> ($name)
!endif
!if ($parent2 != "")
($parent2) -up-> ($name)
!endif
!endprocedure
!procedure $branchLabel($commit, $name)
rectangle "$name" <<branchLabel>>
$commit . [$name] #grey
!endprocedure
!procedure $tag($commit, $name)
together {
rectangle "$name" <<tag>>
$commit . [$name] #grey
}
!endprocedure
!procedure $branch_start($name, $numCommits, $fromBranch1="", $fromCommit1="", $toBranch="", $toCommit="", $fromBranch2="", $fromCommit2="")
rectangle {
!$counter = $numCommits
!while $counter != 0
!$parentCommit = %string($name + ($counter - 1))
!$thisCommit = %string($name + $counter)
$declareCommit($thisCommit, $counter)
!if ($counter > 1)
$declareCommit($parentCommit, %string($counter - 1))
$commit($thisCommit, $parentCommit, $label=$counter)
!endif
!if ($counter == $numCommits)
!if ($toBranch != "")
$commit($commitName($toBranch, $toCommit), $thisCommit, $label=$toCommit)
!endif
$branchLabel($thisCommit, $name)
!endif
!if ($counter == 1 && $fromBranch1 != "")
$declareCommit($commitName($fromBranch1, $fromCommit1), $fromCommit1)
!if ($fromBranch2 != "")
$declareCommit($commitName($fromBranch2, $fromCommit2), $fromCommit2)
!endif
$commit($thisCommit, $commitName($fromBranch1, $fromCommit1), $commitName($fromBranch2, $fromCommit2), $counter)
!endif
!$counter = $counter - 1
!endwhile
!endprocedure
!procedure $branch_stop()
}
!endprocedure
!procedure $branch($name, $numCommits, $fromBranch1="", $fromCommit1="", $toBranch="", $toCommit="", $fromBranch2="", $fromCommit2="")
$branch_start($name, $numCommits, $fromBranch1, $fromCommit1, $toBranch, $toCommit, $fromBranch2, $fromCommit2)
$branch_stop()
!endprocedure
@enduml