Merge "milestone-review-dash detect current milestone"
This commit is contained in:
commit
0c88a3085c
@ -28,6 +28,20 @@ def is_milestone_valid(project, name):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_current_milestone(project):
|
||||||
|
series = project.get_timeline()['entries']
|
||||||
|
current_milestone = ""
|
||||||
|
for s in series:
|
||||||
|
if s['is_development_focus']:
|
||||||
|
for landmark in s['landmarks']:
|
||||||
|
#landmark with a date set are past milestones
|
||||||
|
if not landmark['date']:
|
||||||
|
if (landmark['name'] < current_milestone or
|
||||||
|
not current_milestone):
|
||||||
|
current_milestone = landmark['name']
|
||||||
|
return current_milestone
|
||||||
|
|
||||||
|
|
||||||
def _search_task(project, **kwargs):
|
def _search_task(project, **kwargs):
|
||||||
bugs = project.searchTasks(**kwargs)
|
bugs = project.searchTasks(**kwargs)
|
||||||
if not bugs:
|
if not bugs:
|
||||||
@ -105,23 +119,28 @@ parser = argparse.ArgumentParser(
|
|||||||
' folder that you can serve as input for gerrit-dash-creator.'
|
' folder that you can serve as input for gerrit-dash-creator.'
|
||||||
' The output of the script can be used to query Gerrit'
|
' The output of the script can be used to query Gerrit'
|
||||||
' directly.')
|
' directly.')
|
||||||
parser.add_argument('milestone', type=str, help='The release milestone')
|
parser.add_argument('-m', '--milestone', type=str,
|
||||||
|
help='The release milestone')
|
||||||
parser.add_argument('-o', '--output', type=str, help='Output file')
|
parser.add_argument('-o', '--output', type=str, help='Output file')
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
milestone = args.milestone
|
|
||||||
if args.output:
|
|
||||||
file_name = args.output
|
|
||||||
else:
|
|
||||||
file_name = milestone + '.dash'
|
|
||||||
|
|
||||||
cachedir = "~/.launchpadlib/cache/"
|
cachedir = "~/.launchpadlib/cache/"
|
||||||
launchpad = Launchpad.login_anonymously('just testing', 'production', cachedir,
|
launchpad = Launchpad.login_anonymously('just testing', 'production', cachedir,
|
||||||
version="devel")
|
version="devel")
|
||||||
neutron = launchpad.projects['neutron']
|
neutron = launchpad.projects['neutron']
|
||||||
neutron_client = launchpad.projects['python-neutronclient']
|
neutron_client = launchpad.projects['python-neutronclient']
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
if args.milestone:
|
||||||
|
milestone = args.milestone
|
||||||
if not is_milestone_valid(neutron, milestone):
|
if not is_milestone_valid(neutron, milestone):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
else:
|
||||||
|
milestone = get_current_milestone(neutron)
|
||||||
|
if args.output:
|
||||||
|
file_name = args.output
|
||||||
|
else:
|
||||||
|
file_name = milestone + '.dash'
|
||||||
|
|
||||||
|
|
||||||
with open(file_name, 'w') as f:
|
with open(file_name, 'w') as f:
|
||||||
title = "[dashboard]\ntitle = Neutron %s Review Inbox\n" % milestone
|
title = "[dashboard]\ntitle = Neutron %s Review Inbox\n" % milestone
|
||||||
|
Loading…
Reference in New Issue
Block a user