Merge lp:~nataliabidart/ubuntu-dev-tools/multiple-series-for-project-upload into lp:~ubuntu-dev/ubuntu-dev-tools/trunk

Proposed by Natalia Bidart
Status: Merged
Merged at revision: 771
Proposed branch: lp:~nataliabidart/ubuntu-dev-tools/multiple-series-for-project-upload
Merge into: lp:~ubuntu-dev/ubuntu-dev-tools/trunk
Diff against target: 37 lines (+22/-3)
1 file modified
lp-project-upload (+22/-3)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-dev-tools/multiple-series-for-project-upload
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+36354@code.launchpad.net

Description of the change

Added support to lp-project-upload for handling multiple project series.

To post a comment you must log in.
759. By Natalia Bidart

Removing uneeded blank line.

Revision history for this message
Stefano Rivera (stefanor) wrote :

This doesn't support the case where a milestone exists but has no release yet.

Otherwise it looks good

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

> This doesn't support the case where a milestone exists but has no release yet.
>
> Otherwise it looks good

Can you please explain what the script should do in that case? I'll be happy to add that code.

Revision history for this message
Martin Pitt (pitti) wrote :

Since it didn't do anything on an empty series array before, this looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lp-project-upload'
2--- lp-project-upload 2010-09-21 15:42:04 +0000
3+++ lp-project-upload 2010-09-22 18:24:45 +0000
4@@ -30,11 +30,30 @@
5 answer = sys.stdin.readline().strip()
6 if answer.startswith('n'):
7 sys.exit(0)
8- if len(proj.series) != 1:
9- print >> sys.stderr, 'Does not support creating releases if more than one series exists.'
10+
11+ n_series = len(proj.series)
12+ if n_series == 1:
13+ series = proj.series[0]
14+ elif n_series > 1:
15+ msg = 'More than one series exist. Which one would you like to ' \
16+ 'upload to? Possible series are (listed as index, name):'
17+ print msg
18+ for idx, serie in enumerate(proj.series):
19+ print '\t%i - %s' % (idx, serie.name)
20+ print 'Enter series index: '
21+ answer = sys.stdin.readline().strip()
22+ try:
23+ series = proj.series[int(answer)]
24+ except (ValueError, IndexError):
25+ print >> sys.stderr, 'The series index is invalid (%s).' % answer
26+ sys.exit(3)
27+ else:
28+ print "Using series named '%s'" % series.name
29+ else:
30+ print >> sys.stderr, 'Does not support creating releases if no series exists.'
31 sys.exit(3)
32+
33 release_date = datetime.date.today().strftime('%Y-%m-%d')
34- series = proj.series[0]
35 milestone = series.newMilestone(name=version,
36 date_targeted=release_date)
37 return milestone.createProductRelease(date_released=release_date)