lp-project-upload: Add an optional parameter for creating a new

milestone to add future bugs to.
This commit is contained in:
Stefano Rivera 2011-04-19 17:32:42 +02:00
commit c5f75d2af3
3 changed files with 22 additions and 4 deletions

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
ubuntu-dev-tools (0.122) UNRELEASED; urgency=low
[ Ted Gould ]
* lp-project-upload: Add an optional parameter for creating a new
milestone to add future bugs to.
-- Ted Gould <ted@ubuntu.com> Tue, 19 Apr 2011 17:32:03 +0200
ubuntu-dev-tools (0.121) unstable; urgency=low ubuntu-dev-tools (0.121) unstable; urgency=low
[ Daniel Holbach ] [ Daniel Holbach ]

View File

@ -4,7 +4,7 @@ lp\-project\-upload \- Upload a release tarball to a Launchpad project.
.SH SYNOPSIS .SH SYNOPSIS
.B lp\-project\-upload .B lp\-project\-upload
.I project-name version tarball .I project-name version tarball [new milestone]
.SH DESCRIPTION .SH DESCRIPTION
\fBlp\-project\-upload\fR uploads a tarball release of a project to Launchpad. \fBlp\-project\-upload\fR uploads a tarball release of a project to Launchpad.

View File

@ -79,13 +79,16 @@ def edit_file(prefix, description):
return content.strip() return content.strip()
def main(): def main():
if len(sys.argv) != 4: if len(sys.argv) != 4 and len(sys.argv) != 5:
print >> sys.stderr, '''Upload a release tarball to a Launchpad project. print >> sys.stderr, '''Upload a release tarball to a Launchpad project.
Usage: %s <project name> <version> <tarball>''' % sys.argv[0] Usage: %s <project name> <version> <tarball> [new milestone]''' % sys.argv[0]
sys.exit(1) sys.exit(1)
if len(sys.argv) == 4:
(project, version, tarball) = sys.argv[1:] (project, version, tarball) = sys.argv[1:]
else:
(project, version, tarball, new_milestone) = sys.argv[1:]
try: try:
launchpad = Launchpad.login_with('ubuntu-dev-tools', 'production') launchpad = Launchpad.login_with('ubuntu-dev-tools', 'production')
@ -141,6 +144,13 @@ def main():
release.lp_save() release.lp_save()
# Create a new milestone if requested
if new_milestone is not None:
mil = release.milestone
for series in proj.series:
if mil.name in [milestone.name for milestone in series.all_milestones]:
series.newMilestone(name=new_milestone)
except HTTPError, error: except HTTPError, error:
print 'An error happened in the upload:', error.content print 'An error happened in the upload:', error.content
sys.exit(1) sys.exit(1)