01 Overview
The HSE Open Branches Tool creates an HTML table which displays information about all open branches of multiple repositories. It may be called regularly by a scheduled job and the result might be included in your dokuwiki, confluence etc. With the help of the HSE Open Branches Tool, you gain an overview about which feature branches are open in your project and, more important, which branches have been opened for too long and need to be closed as soon as possible.
For a list of given repositories, it retrieves all branches and collects the following information for each branch:
-
name (and generates a link)
-
name of the last committer
-
days since the last action
-
date of the last action
-
commit hash of last commit
-
merge base
After reading this information with our HSE GIT API, it creates an HTML which uses a customizable Cascading Style Sheet.
If the filter Hide master/main/develop branches
on the HTML Table is set, only feature branches are shown. The table also contains filter for the fields
-
repository
-
branch
-
last committer
Example Output
In this example, the red columns have a merge base greater than 28 days, so they received the HTML class attribute timeExceededLimit, which is defines in the css file with:
#branchlist tr.timeExceededLimit { background-color: #fff1f1; }
Configuration
To configure the tool adjust the config.json
file:
-
base http url: the http prefix for all your repositories
-
base ssh url: the ssh prefix for all your repositories
-
path to repo.txt: defines the path to the list of repositories, which should be inspected
-
format string link: the name of the repository in the table will be a link; first format string is the namespace, second the name
-
outputpath html: defines where the html file should be created
-
path to include-css: defines the path to the css file, which should be included
-
log path: defines where the HSE Logger log file is stored
-
log level: defines the log level for the HSE Logger
-
timeNearingLimit: if Merge Base is greater than this value, this row will get the class
timeNearingLimit
which can be used for formatting -
timeExceededLimit: if Merge Base is even greater than this value, this row will get the class
timeExceededLimit
which can be used for formatting
Here is one example:
{ "base http url":"https://code.hampel-soft.com/", "base ssh url":"git@code.hampel-soft.com:", "path to repo.txt":"C:\\Labview\\hse-open-branches\\data\\repositories.txt", "format string link":"https://code.hampel-soft.com/%s/%s/-/network/develop", "outputpath html":"C:\\Labview\\hse-open-branches\\data\\branches.html", "path to include-css":"C:\\Labview\\hse-open-branches\\data\\include.css", "log path":"C:\\Labview\\hse-open-branches\\data", "log level":3, "timeNearingLimit":21, "timeExceededLimit":28 }
example content of repositories.txt
https://code.hampel-soft.com/open-source/git-api-for-labview.git https://code.hampel-soft.com/open-source/toggl-api-for-labview.git https://code.hampel-soft.com/open-source/hse-db.git https://code.hampel-soft.com/open-source/gitlab-api-for-labview.git https://code.hampel-soft.com/open-source/s7netcom.git https://code.hampel-soft.com/open-source/hse-libraries.git https://code.hampel-soft.com/open-source/dqmh/hse-application-template.git