@@ -71,7 +71,7 @@ def clean_render(overviewerargs, verbose=False):
71
71
72
72
def get_stats (timelist ):
73
73
average = sum (timelist ) / float (len (timelist ))
74
- meandiff = [(x - stats [ " average" ] ) ** 2 for x in timelist ]
74
+ meandiff = [(x - average ) ** 2 for x in timelist ]
75
75
sd = math .sqrt (sum (meandiff ) / len (meandiff ))
76
76
return {
77
77
"count" : len (timelist ),
@@ -82,26 +82,29 @@ def get_stats(timelist):
82
82
}
83
83
84
84
85
- commitre = re .compile ('^commit ([a-z0-9]{40})$' , re .MULTILINE )
86
- branchre = re .compile ('^\\ * (.+)$' , re .MULTILINE )
85
+ def get_current_branch ():
86
+ gittext = check_output (split ('git rev-parse --abbrev-ref HEAD' ))
87
+ return gittext .strip () if gittext != "HEAD" else None
87
88
88
89
89
90
def get_current_commit ():
90
- gittext = check_output (split ('git branch' ))
91
- match = branchre .search (gittext )
92
- if match and not ("no branch" in match .group (1 )):
93
- return match .group (1 )
94
- gittext = check_output (split ('git show HEAD' ))
95
- match = commitre .match (gittext )
96
- if match == None :
97
- return None
98
- return match .group (1 )
91
+ gittext = check_output (split ('git rev-parse HEAD' ))
92
+ return gittext .strip () if gittext else None
93
+
94
+
95
+ def get_current_ref ():
96
+ branch = get_current_branch ()
97
+ if branch :
98
+ return branch
99
+
100
+ commit = get_current_commit ()
101
+ if commit :
102
+ return commit
99
103
100
104
101
105
def get_commits (gitrange ):
102
- gittext = check_output (split ('git log --raw --reverse' ) + [gitrange , ])
103
- for match in commitre .finditer (gittext ):
104
- yield match .group (1 )
106
+ gittext = check_output (split ('git rev-list --reverse' ) + [gitrange , ])
107
+ return (c for c in gittext .split ("\n " ))
105
108
106
109
107
110
def set_commit (commit ):
@@ -116,13 +119,13 @@ def main(args):
116
119
else :
117
120
commits .append (commit )
118
121
if not commits :
119
- commits = [get_current_commit (), ]
122
+ commits = [get_current_ref (), ]
120
123
121
124
log = None
122
125
if args .log :
123
126
log = args .log
124
127
125
- reset_commit = get_current_commit ()
128
+ reset_commit = get_current_ref ()
126
129
try :
127
130
for commit in commits :
128
131
print ("testing commit" , commit )
0 commit comments