Hi devs,

after the TP 3.1.1 release was managed by Stephen, we had to clean up /
delete a lot of branches that were no longer needed. We used to delete
branches as soon as we were done with the work on it, but at some point
Apache disabled the functionality to delete branches and so we ended up
with a lot of dead branches.

For the cleanup I've used a simple shell script that checks the status of
the respective Jira ticket and if it's closed, the branch is assumed to be
no longer needed and will be deleted.

This is the script:

for branch in $(git branch -r | grep -Po 'TINKERPOP[3]?-.*')
do
  jira=`sed 's/TINKERPOP3/TINKERPOP/' <<< $branch | grep -Po
'TINKERPOP-[0-9]*'`
  status=`curl -s https://issues.apache.org/jira/browse/$jira | grep -A1
status-val | grep -Po '(?<=>)[^<]*(?=)' | head -n1`
  if [ "$status" == "Closed" ]; then
    git push origin --delete $branch
  fi
done


Do people like the idea of running this script as part of the release
process? In this case developers would no longer need to remember to delete
development branches; however naming conventions would become even more
important AND tickets should only be closed after the branch was merged.

Cheers,
Daniel

Reply via email to