Add --release-version for explicitly setting the release version number
authorTim Cuthbertson <tim@gfxmonk.net>
Tue, 12 Mar 2013 09:44:32 +0000 (12 20:44 +1100)
committerThomas Leonard <talex5@gmail.com>
Sun, 17 Mar 2013 12:43:04 +0000 (17 12:43 +0000)
0release
release.py

index a1c1796..490cf2f 100755 (executable)
--- a/0release
+++ b/0release
@@ -29,6 +29,7 @@ parser.add_option("", "--master-feed-file", help="local file to extend with new
 parser.add_option("", "--archive-upload-command", help="shell command to upload releases", metavar='COMMAND')
 parser.add_option("", "--master-feed-upload-command", help="shell command to upload feed", metavar='COMMAND')
 parser.add_option("", "--public-scm-repository", help="the name of the repository to push to", metavar='REPOS')
+parser.add_option("", "--release-version", help="explicitly set the version of this release", metavar='VERSION')
 parser.add_option("-V", "--version", help="display version information", action='store_true')
 
 (options, args) = parser.parse_args()
index c683527..32a3435 100644 (file)
@@ -191,10 +191,12 @@ def do_release(local_feed, options):
 
        def set_to_release():
                print "Snapshot version is " + local_impl.get_version()
-               suggested = support.suggest_release_version(local_impl.get_version())
-               release_version = raw_input("Version number for new release [%s]: " % suggested)
-               if not release_version:
-                       release_version = suggested
+               release_version = options.release_version
+               if release_version is None:
+                       suggested = support.suggest_release_version(local_impl.get_version())
+                       release_version = raw_input("Version number for new release [%s]: " % suggested)
+                       if not release_version:
+                               release_version = suggested
 
                scm.ensure_no_tag(release_version)
 
@@ -364,6 +366,8 @@ def do_release(local_feed, options):
                head = scm.get_head_revision() 
                if status.release_version:
                        print "RESUMING release of %s %s" % (local_feed.get_name(), status.release_version)
+                       if options.release_version and options.release_version != status.release_version:
+                               raise SafeException("Can't start release of version %s; we are currently releasing %s.\nDelete the release-status file to abort the previous release." % (options.release_version, status.release_version))
                elif head == status.head_before_release:
                        print "Restarting release of %s (HEAD revision has not changed)" % local_feed.get_name()
                else: