Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: tools/git/graph.sh

Issue 3017058: Check in a little toy that graphs history of words in the source. (Closed)
Patch Set: move dot Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/git/README ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 about="Given a grep expression, creates a graph of occurrences of that
7 expression in the recent history of the tree.
8
9 Prerequisites: git and GNU R (apt-get install r-base).
10 "
11
12 set -e
13
14 target="$1"
15
16 if [ -z $target ]; then
17 echo "usage: $0 <grep-compatible expression>"
18 echo
19 echo "$about"
20 exit 1
21 fi
22
23 datafile=$(mktemp)
24 echo 'ago count' > $datafile
25 for ago in $(seq 90 -1 0); do
Nico 2010/08/05 18:11:53 `for ago in {90..0}; do` instead?
26 commit=$(git rev-list -1 --until="$ago days ago" origin/trunk)
27 git checkout -q -f $commit
28 count=$(git grep -E "$target" -- '*.cc' '*.h' '*.m' '*.mm' | wc -l)
29 echo "-$ago $count" >> $datafile
30 echo -n '.'
31 done
32
33 R CMD BATCH <(cat <<EOF
Nico 2010/08/05 18:11:53 Neat, I wasn't actively aware that <() evaluates t
34 data = read.delim("$datafile", sep=' ')
35 png(width=600, height=300)
36 plot(count ~ ago, type="l", main="$target", xlab='days ago', data=data)
37 EOF
38 ) /dev/null
39
40 echo done.
41
42 rm -f $datafile
Nico 2010/08/05 18:11:53 do you want a trap for this? if not, maybe a comme
OLDNEW
« no previous file with comments | « tools/git/README ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698