@ -470,8 +470,8 @@ class MyActivity(object):
ret [ ' modified ' ] = datetime_from_google_code ( issue [ ' updated ' ] [ ' $t ' ] )
ret [ ' modified ' ] = datetime_from_google_code ( issue [ ' updated ' ] [ ' $t ' ] )
ret [ ' owner ' ] = ' '
ret [ ' owner ' ] = ' '
if ' issues : owner' in issue :
if ' issues $ owner' in issue :
ret [ ' owner ' ] = issue [ ' issues :owner' ] [ 0 ] [ ' issues:username ' ] [ 0 ] [ ' $t ' ]
ret [ ' owner ' ] = issue [ ' issues $owner' ] [ ' issues$username ' ] [ ' $t ' ]
ret [ ' author ' ] = issue [ ' author ' ] [ 0 ] [ ' name ' ] [ ' $t ' ]
ret [ ' author ' ] = issue [ ' author ' ] [ 0 ] [ ' name ' ] [ ' $t ' ]
if ' shorturl ' in project :
if ' shorturl ' in project :
@ -708,19 +708,49 @@ class MyActivity(object):
print " No %s in committers.py, skipping WebKit checks. " % email
print " No %s in committers.py, skipping WebKit checks. " % email
self . webkit_repo = None
self . webkit_repo = None
@staticmethod
def print_change ( self , change ) :
def print_change ( change ) :
self . print_generic ( self . options . output_format ,
print ' %s %s ' % (
self . options . output_format_changes ,
change [ ' review_url ' ] ,
change [ ' header ' ] ,
change [ ' header ' ] ,
change [ ' review_url ' ] ,
)
change [ ' author ' ] )
def print_issue ( self , issue ) :
optional_values = {
' owner ' : issue [ ' owner ' ] ,
}
self . print_generic ( self . options . output_format ,
self . options . output_format_issues ,
issue [ ' header ' ] ,
issue [ ' url ' ] ,
issue [ ' author ' ] ,
optional_values )
def print_review ( self , review ) :
self . print_generic ( self . options . output_format ,
self . options . output_format_reviews ,
review [ ' header ' ] ,
review [ ' review_url ' ] ,
review [ ' author ' ] )
@staticmethod
@staticmethod
def print_issue ( issue ) :
def print_generic ( default_fmt , specific_fmt ,
print ' %s %s ' % (
title , url , author ,
issue [ ' url ' ] ,
optional_values = None ) :
issue [ ' header ' ] ,
output_format = specific_fmt if specific_fmt is not None else default_fmt
)
output_format = unicode ( output_format )
required_values = {
' title ' : title ,
' url ' : url ,
' author ' : author ,
}
# Merge required and optional values.
if optional_values is not None :
values = dict ( required_values . items ( ) + optional_values . items ( ) )
else :
values = required_values
print output_format . format ( * * values )
def filter_issue ( self , issue , should_filter_by_user = True ) :
def filter_issue ( self , issue , should_filter_by_user = True ) :
def maybe_filter_username ( email ) :
def maybe_filter_username ( email ) :
@ -791,7 +821,7 @@ class MyActivity(object):
if self . reviews :
if self . reviews :
print ' \n Reviews: '
print ' \n Reviews: '
for review in self . reviews :
for review in self . reviews :
self . print_ change ( review )
self . print_ review ( review )
def get_issues ( self ) :
def get_issues ( self ) :
for project in google_code_projects :
for project in google_code_projects :
@ -800,6 +830,12 @@ class MyActivity(object):
for instance in bugzilla_instances :
for instance in bugzilla_instances :
self . issues + = self . bugzilla_issues ( instance , self . user )
self . issues + = self . bugzilla_issues ( instance , self . user )
def print_issues ( self ) :
if self . issues :
print ' \n Issues: '
for issue in self . issues :
self . print_issue ( issue )
def process_activities ( self ) :
def process_activities ( self ) :
# If a webkit bug was a review, don't list it as an issue.
# If a webkit bug was a review, don't list it as an issue.
ids = { }
ids = { }
@ -814,12 +850,6 @@ class MyActivity(object):
self . issues = filter ( lambda issue : not duplicate_issue ( issue ) , self . issues )
self . issues = filter ( lambda issue : not duplicate_issue ( issue ) , self . issues )
def print_issues ( self ) :
if self . issues :
print ' \n Issues: '
for c in self . issues :
self . print_issue ( c )
def print_activity ( self ) :
def print_activity ( self ) :
self . print_changes ( )
self . print_changes ( )
self . print_reviews ( )
self . print_reviews ( )
@ -862,23 +892,52 @@ def main():
action = ' store_true ' ,
action = ' store_true ' ,
help = ' Ask to authenticate for instances with no auth cookie ' )
help = ' Ask to authenticate for instances with no auth cookie ' )
group = optparse . OptionGroup ( parser , ' Activity Types ' ,
activity_types_ group = optparse . OptionGroup ( parser , ' Activity Types ' ,
' By default, all activity will be looked up and '
' By default, all activity will be looked up and '
' printed. If any of these are specified, only '
' printed. If any of these are specified, only '
' those specified will be searched. ' )
' those specified will be searched. ' )
group. add_option (
activity_types_ group. add_option (
' -c ' , ' --changes ' ,
' -c ' , ' --changes ' ,
action = ' store_true ' ,
action = ' store_true ' ,
help = ' Show changes. ' )
help = ' Show changes. ' )
group. add_option (
activity_types_ group. add_option (
' -i ' , ' --issues ' ,
' -i ' , ' --issues ' ,
action = ' store_true ' ,
action = ' store_true ' ,
help = ' Show issues. ' )
help = ' Show issues. ' )
group. add_option (
activity_types_ group. add_option (
' -r ' , ' --reviews ' ,
' -r ' , ' --reviews ' ,
action = ' store_true ' ,
action = ' store_true ' ,
help = ' Show reviews. ' )
help = ' Show reviews. ' )
parser . add_option_group ( group )
parser . add_option_group ( activity_types_group )
output_format_group = optparse . OptionGroup ( parser , ' Output Format ' ,
' By default, all activity will be printed in the '
' following format: {url} {title} . This can be '
' changed for either all activity types or '
' individually for each activity type. The format '
' is defined as documented for '
' string.format(...). The variables available for '
' all activity types are url, title and author. '
' Format options for specific activity types will '
' override the generic format. ' )
output_format_group . add_option (
' -f ' , ' --output-format ' , metavar = ' <format> ' ,
default = u ' {url} {title} ' ,
help = ' Specifies the format to use when printing all your activity. ' )
output_format_group . add_option (
' --output-format-changes ' , metavar = ' <format> ' ,
default = None ,
help = ' Specifies the format to use when printing changes. ' )
output_format_group . add_option (
' --output-format-issues ' , metavar = ' <format> ' ,
default = None ,
help = ' Specifies the format to use when printing issues. Has support '
' for the additional variable owner. ' )
output_format_group . add_option (
' --output-format-reviews ' , metavar = ' <format> ' ,
default = None ,
help = ' Specifies the format to use when printing reviews. ' )
parser . add_option_group ( output_format_group )
# Remove description formatting
# Remove description formatting
parser . format_description = (
parser . format_description = (