-
Notifications
You must be signed in to change notification settings - Fork 1
/
gwfqa
executable file
·51 lines (38 loc) · 1.82 KB
/
gwfqa
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
#!/usr/bin/env python2
import git_workflow_quality
import ConfigParser
import argparse
import sys
if __name__ == '__main__' :
parser = argparse.ArgumentParser(description='Extract simple analytics from git repository')
parser.add_argument('--primary', help='Ordered list with primary branches')
parser.add_argument('--detailed', action='store_true', help='Show per-branch statistics')
parser.add_argument('--graph', choices=['topo', 'date', 'backwards'], help='Generate gitgraphjs file')
parser.add_argument('--limit', type=int, default=-1, help='Number of commits to show in plot (-1 to plot all)')
parser.add_argument('--last', type=int, default=-1, help='Reduce analysis just to last commits (-1 means use all)')
parser.add_argument('--dot', help='Express branch relations in dot language')
args = parser.parse_args()
config = ConfigParser.ConfigParser()
config.read('.gwfqa')
if args.primary :
git_workflow_quality.Repository.primary = args.primary.split(',')
elif config.has_section('gwfqa') :
git_workflow_quality.Repository.primary = config.get('gwfqa', 'primary').split(',')
if args.limit != -1 and args.graph != 'backwards' :
print "WARNING : --limit does only apply to backwards graph"
repo = git_workflow_quality.Repository(args.last)
print repo.report(args.detailed)
if args.graph == 'backwards' :
git_workflow_quality.gitnetwork.graph( repo , args )
elif args.graph :
git_workflow_quality.gitgraphjs.graph( repo , args )
print repo.events(args.detailed)
if args.dot :
fd = open( args.dot , 'w' )
fd.write( 'digraph G {\n' )
for branch in repo.branches :
branch.dotlabel(fd)
for branch in repo.branches :
branch.digraph(fd)
fd.write( '}\n' )
fd.close()