Subversion Repositories DevTools

Rev

Rev 5258 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5258 Rev 5298
Line 7... Line 7...
7
LOCATION_KEY = 'location'
7
LOCATION_KEY = 'location'
8
LAT_KEY = 'lat'
8
LAT_KEY = 'lat'
9
LNG_KEY = 'lng'
9
LNG_KEY = 'lng'
10
 
10
 
11
def trace(*objs) :
11
def trace(*objs) :
12
    print(*objs,file=sys.stderr)
12
    # print(*objs,file=sys.stderr)
13
    sys.stderr.flush()
13
    # sys.stderr.flush()
-
 
14
    pass
14
    
15
    
15
class CrucibleExtractor :
16
class CrucibleExtractor :
16
    def __init__(self) :
17
    def __init__(self) :
17
        pass
18
        pass
18
        self.selected_reviews = {}
19
        self.selected_reviews = {}
Line 161... Line 162...
161
        trace ( "Reviews with unclassified defects: %s" % (self.unclassified_defect_reviews,) )
162
        trace ( "Reviews with unclassified defects: %s" % (self.unclassified_defect_reviews,) )
162
 
163
 
163
if __name__ == "__main__" :
164
if __name__ == "__main__" :
164
    extractor = CrucibleExtractor()
165
    extractor = CrucibleExtractor()
165
    
166
    
-
 
167
    if len(sys.argv)>=2 :
166
    if len(sys.argv)<2 or sys.argv[1] == "--usage" :
168
        if sys.argv[1] == "--usage" :
167
        trace ( "crucible_reporting.py YYYY-MM" )
169
            trace ( "crucible_reporting.py YYYY-MM" )
168
        trace ( "   report stats for specified month" )
170
            trace ( "   report stats for specified month" )
169
        sys.exit(0)
171
            sys.exit(0)
170
    elif sys.argv[1] == "--verbose" :
172
        elif sys.argv[1] == "--verbose" :
171
        extractor.verbose = True
173
            extractor.verbose = True
172
        sys.argv = sys.argv[1:]
174
            sys.argv = sys.argv[1:]
173
        
175
    
174
    if len(sys.argv) < 2 :
176
    if len(sys.argv)<2 :
175
        today = datetime.date.today()
177
        today = datetime.date.today()
176
        if today.month!= 1 :
178
        if today.month!= 1 :
177
            month_prefix = "%04d-%02d" % (today.year, today.month-1)
179
            month_prefix = "%04d-%02d" % (today.year, today.month-1)
178
        else :
180
        else :
179
            month_prefix = "%04d-%02d" % (today.year-1, 12)
181
            month_prefix = "%04d-%02d" % (today.year-1, 12)
180
        trace ( "Generating report for previous month (" + month_prefix + ")" )
182
        trace ( "Generating report for previous month (" + month_prefix + ")" )
181
    else :
183
    else :
182
        month_prefix = sys.argv[1]
184
        month_prefix = sys.argv[1]
-
 
185
        trace ( "Generating report for " + month_prefix )
183
    
186
    
-
 
187
    sys.stdout = open("%s.txt"%(month_prefix,),"w")
184
    extractor.summarize_by_project(month_prefix)
188
    extractor.summarize_by_project(month_prefix)
185
    extractor.summarize_by_defect_type()
189
    extractor.summarize_by_defect_type()
186
    extractor.report_on_unclassified_defects()
190
    extractor.report_on_unclassified_defects()
187
 
191
 
188
 
192