-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsvn-list-committers
executable file
·58 lines (49 loc) · 1.47 KB
/
svn-list-committers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Display all the usernames of SVN committers of a path, sorted by number of
# commits.
revision=
limit=
use_merge_history=true
while getopts :r:l:G OPT; do
case $OPT in
r)
revision="$OPTARG"
;;
l)
limit="$OPTARG"
;;
G)
use_merge_history=false
;;
*)
echo "usage: ${0##*/} [<options>] [--] [<path to check>]"
echo
echo "Options:"
echo " -G don't use merge history"
echo " -l ARG max number of commits to display"
echo " -r ARG1:ARG2 revision range (from ARG1 to ARG2)"
exit 2
esac
done
shift $(( OPTIND - 1 ))
OPTIND=1
set -eu
set -o pipefail
path_to_check=${1:-.}
opts=(-q)
$use_merge_history && opts+=(--use-merge-history)
[[ -n $revision ]] && opts+=(--revision $revision)
[[ -n $limit ]] && opts+=(--limit $limit)
# svn log -q gives us output like:
# ------------------------------------------------------------------------
# r22629 | matyas | 2016-03-09 11:12:40 -0600 (Wed, 09 Mar 2016)
# ------------------------------------------------------------------------
# Filter out the lines with data on them, then get the usernames.
# Get a count of each unique username, and sort again, numerically (-n),
# reversed (-r).
svn log "${opts[@]}" "$path_to_check" |
fgrep ' | ' |
awk -F' \\| ' '{print $2}' |
sort |
uniq -c |
sort -nr