churning pie charts (with non-canonical prerequisites!)
authorhaftmann
Sat Apr 05 10:03:04 2014 +0200 (2014-04-05)
changeset 5641704d0083cb9e5
parent 56416 b9baecff0684
child 56418 c267a0feb63a
churning pie charts (with non-canonical prerequisites!)
Admin/churn
Admin/lib/Tools/churn
Admin/lib/Tools/churn_pie
Admin/lib/scripts/churn_pie
     1.1 --- a/Admin/churn	Sat Apr 05 10:03:03 2014 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,5 +0,0 @@
     1.4 -#!/bin/bash
     1.5 -
     1.6 -ADMIN="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; pwd)"
     1.7 -cd "$ADMIN"
     1.8 -hg churn --aliases user-aliases
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Admin/lib/Tools/churn	Sat Apr 05 10:03:04 2014 +0200
     2.3 @@ -0,0 +1,12 @@
     2.4 +#!/usr/bin/env bash
     2.5 +#
     2.6 +# Author: Florian Haftmann, TU Muenchen
     2.7 +#
     2.8 +# DESCRIPTION: mercurial churn statistics for specified aliases file
     2.9 +
    2.10 +ALIAS="${1:-$ISABELLE_HOME/Admin/user-aliases}"
    2.11 +shift
    2.12 +
    2.13 +cd "$(dirname "$ALIAS")"
    2.14 +
    2.15 +hg churn --aliases "$ALIAS" "$@"
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Admin/lib/Tools/churn_pie	Sat Apr 05 10:03:04 2014 +0200
     3.3 @@ -0,0 +1,14 @@
     3.4 +#!/usr/bin/env bash
     3.5 +#
     3.6 +# Author: Florian Haftmann, TU Muenchen
     3.7 +#
     3.8 +# DESCRIPTION: pie chart with mercurial churn statistics for specified aliases file
     3.9 +
    3.10 +ALIAS="${1:-$ISABELLE_HOME/Admin/user-aliases}"
    3.11 +shift
    3.12 +
    3.13 +SCRIPT="$ISABELLE_HOME/Admin/lib/scripts/churn_pie"
    3.14 +
    3.15 +cd "$(dirname "$ALIAS")"
    3.16 +
    3.17 +hg churn --aliases "$ALIAS" | "$SCRIPT" "$@" 
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Admin/lib/scripts/churn_pie	Sat Apr 05 10:03:04 2014 +0200
     4.3 @@ -0,0 +1,23 @@
     4.4 +#!/usr/bin/python
     4.5 +
     4.6 +import re
     4.7 +from pychart import theme, pie_plot, area, fill_style, arrow, legend
     4.8 +import sys
     4.9 +
    4.10 +re_entry = re.compile(R'^(.*\S+)\s+(\d+)\s*\**\s*$')
    4.11 +
    4.12 +theme.get_options()
    4.13 +
    4.14 +data = []
    4.15 +
    4.16 +for line in sys.stdin.readlines():
    4.17 +    match = re_entry.match(line)
    4.18 +    data.append((match.group(1), int(match.group(2))))
    4.19 +
    4.20 +plot = pie_plot.T(data = data, arc_offsets = [],
    4.21 +  shadow = (2, -2, fill_style.gray50), label_offset = 10, arrow_style = arrow.a3)
    4.22 +
    4.23 +ar = area.T(size = (500, 500), legend = legend.T(), x_grid_style = None, y_grid_style = None)
    4.24 +ar.add_plot(plot)
    4.25 +
    4.26 +ar.draw()