Skip to content

Do not reinvent the wheel #11

@1dotd4

Description

@1dotd4

Just compile (X)HTML pages from queries and filters on repositories.
Cache the resulting pages, and update them when needed.
The old script global_log.sh.

#!/bin/sh

if [ -z $1 ]; then
  SINCE="2 weeks ago"
else
  if [ ! -z `echo -n $1 | sed 's/^[0-9]\+[hdwmy]$//g'` ]; then
    SINCE=`echo -n $1`
  else
    case `echo -n $1 | sed 's/^[0-9]\+\([hdwmy]\)$/\1/g' ` in
     h) SINCE=`echo -n $1 | sed 's/h$/ hours ago/g'` ;;
     d) SINCE=`echo -n $1 | sed 's/d$/ days ago/g'` ;;
     w) SINCE=`echo -n $1 | sed 's/w$/ weeks ago/g'` ;;
     m) SINCE=`echo -n $1 | sed 's/m$/ months ago/g'` ;;
     y) SINCE=`echo -n $1 | sed 's/y$/ years ago/g'` ;;
     *) echo "Please use /[0-9]+[hdwmy]/ format or enter a date" && exit 1
    esac
  fi
fi

O=`mktemp`

pretty() {
awk -F '|' '{ printf "%s %-35s %-9s %-20s %s\n", $1, $2, $3, $4, $5 }'
}

# date > $O
git log --pretty=format:"%ci|root-development|%h|%an|%s" --since="$SINCE" | pretty >> $O

for i in `cat repos`; do
  repo=`echo $i | awk -F '#' '{ print $1 }'`
  if [ ! -d ./$repo/.git ] ; then
    # echo "[i] Skipping $repo because it was not cloned"
    continue
  fi
  git --git-dir=`pwd`/$repo/.git --work-tree=`pwd`/$repo log --pretty=format:"%ci|$repo|%h|%an|%s" --since="$SINCE" | pretty >> $O
done

sort $O
rm $O

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions