From 907ea4d676e095b67293f238820d4904fb51d4c4 Mon Sep 17 00:00:00 2001 From: Rhys Smith Date: Wed, 17 Aug 2016 22:00:41 +0100 Subject: [PATCH] Make links clickable in gitlog output of publication diff script --- build.xml | 6 ++-- utilities/diff-between-publications.sh | 40 ++++++++++++++------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/build.xml b/build.xml index 30f24d26..6fd44470 100644 --- a/build.xml +++ b/build.xml @@ -1545,8 +1545,10 @@ - - + + + + diff --git a/utilities/diff-between-publications.sh b/utilities/diff-between-publications.sh index 3fe94ea6..2032d452 100755 --- a/utilities/diff-between-publications.sh +++ b/utilities/diff-between-publications.sh @@ -4,21 +4,25 @@ # the differences since the last. # # Expects the following to be provided as arguments: -# * Absolute path to data repository -# * Absolute path to products repository +# * Absolute path to shared workspace directory +# * Git project's group name +# * Git data repository's name +# * Git products repository's name # # Assumes the data repository's master branch is currently checked out. # -# Fail if $1 and $2 aren't provided. -if [[ -z $1 && -z $2 ]]; then - echo "usage: diff-between-publications.sh " +# Fail if $1, $2, $3, and $4 aren't provided. +if [[ -z $1 && -z $2 && -z $3 && -z $4 ]]; then + echo "usage: diff-between-publications.sh " exit 1 fi # Get the input -repodata=$1 -repoproducts=$2 +sharedwsdir=$1 +repogroup=$2 +repodata=$3 +repoproducts=$4 # ===== # = First of all, we need to calculate some stuff. @@ -26,24 +30,24 @@ repoproducts=$2 # Figure out name of the latest tag and the previous tag. # These point to the latest, and previous, publication. -currenttag=$(git --work-tree=$repoproducts --git-dir=$repoproducts/.git tag | tail -n 1) -previoustag=$(git --work-tree=$repoproducts --git-dir=$repoproducts/.git tag | tail -n 2 | head -n 1) +currenttag=$(git --work-tree=$sharedwsdir/$repoproducts --git-dir=$sharedwsdir/$repoproducts/.git tag | tail -n 1) +previoustag=$(git --work-tree=$sharedwsdir/$repoproducts --git-dir=$sharedwsdir/$repoproducts/.git tag | tail -n 2 | head -n 1) # Calculate current member count (the final awk is for Mac compatibility, since wc on Mac outputs leading spaces) -membercount=$(grep 'Member ID' $repodata/members/members.xml | wc -l | awk '{print $1}') +membercount=$(grep 'Member ID' $sharedwsdir/$repodata/members/members.xml | wc -l | awk '{print $1}') # Calculate current entities count (UK only) -entitycountuk=$(grep 'registrationAuthority="http://ukfederation.org.uk"' $repoproducts/aggregates/ukfederation-metadata.xml | wc -l | awk '{print $1}') +entitycountuk=$(grep 'registrationAuthority="http://ukfederation.org.uk"' $sharedwsdir/$repoproducts/aggregates/ukfederation-metadata.xml | wc -l | awk '{print $1}') # Calculate current entities count (total, including all imported entities) -entitycounttotal=$(grep ' First, calculate date/time of latest publication (epoch) in products repo # -> Next, calculate date/time of previous publication (epoch) in products repo # -> Finally, get a git log between those two dates (epoch) in data repo -currenttagdate=$(git --work-tree=$repoproducts --git-dir=$repoproducts/.git log -1 $currenttag --format=%ct) -previoustagdate=$(git --work-tree=$repoproducts --git-dir=$repoproducts/.git log -1 $previoustag --format=%ct) -gitlog=$(git --work-tree=$repodata --git-dir=$repodata/.git log --format="%h %an %s" --after=$previoustagdate --before=$currenttagdate) -gitlognumentries=$(git --work-tree=$repodata --git-dir=$repodata/.git log --format="%h %an %s" --after=$previoustagdate --before=$currenttagdate | wc -l | awk '{print $1}') +currenttagdate=$(git --work-tree=$sharedwsdir/$repoproducts --git-dir=$sharedwsdir/$repoproducts/.git log -1 $currenttag --format=%ct) +previoustagdate=$(git --work-tree=$sharedwsdir/$repoproducts --git-dir=$sharedwsdir/$repoproducts/.git log -1 $previoustag --format=%ct) +gitlog=$(git --work-tree=$sharedwsdir/$repodata --git-dir=$sharedwsdir/$repodata/.git log --format="" --after=$previoustagdate --before=$currenttagdate) +gitlognumentries=$(git --work-tree=$sharedwsdir/$repodata --git-dir=$sharedwsdir/$repodata/.git log --format="%h" --after=$previoustagdate --before=$currenttagdate | wc -l | awk '{print $1}') # ===== # = Now we're ready to output the message