release: Allow specifying a branch to cut the release from.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2012-06-17 09:36:29 -04:00
parent d1bf3feaea
commit fefacf5b2f

View File

@ -43,12 +43,14 @@ def checkGitRepo():
if __name__ == '__main__': if __name__ == '__main__':
usage = 'usage: %prog [options] <username> <version>' usage = 'usage: %prog [options] <username> <version>'
parser = OptionParser(usage=usage) parser = OptionParser(usage=usage)
parser.set_defaults(sign=False, verbose=False) parser.set_defaults(sign=False, verbose=False, branch='master')
parser.add_option('-s', '--sign', action='store_true', dest='sign', parser.add_option('-s', '--sign', action='store_true', dest='sign',
help='Pass on -s to relevant git commands') help='Pass on -s to relevant git commands')
parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run', parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
help='Build the release, but do not push to the git ' help='Build the release, but do not push to the git '
'remote or upload the release archives.') 'remote or upload the release archives.')
parser.add_option('-b', '--branch', metavar='BRANCH', dest='branch',
help='Branch to use for the release. Default: %default')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) != 2: if len(args) != 2:
@ -63,14 +65,15 @@ if __name__ == '__main__':
sign = options.sign sign = options.sign
dryrun = options.dry_run dryrun = options.dry_run
branch = options.branch
if os.path.exists('supybot'): if os.path.exists('supybot'):
error('I need to make the directory "supybot" but it already exists.' error('I need to make the directory "supybot" but it already exists.'
' Change to an appropriate directory or remove the supybot ' ' Change to an appropriate directory or remove the supybot '
'directory to continue.') 'directory to continue.')
print 'Checking out fresh tree from git.' print 'Checking out fresh tree from git.'
system('git clone git+ssh://%s@supybot.git.sourceforge.net/gitroot/supybot' system('git clone -b %s git+ssh://%s@supybot.git.sourceforge.net/gitroot/supybot'
% u) % (branch, u))
os.chdir('supybot') os.chdir('supybot')
print 'Checking RELNOTES version line.' print 'Checking RELNOTES version line.'
@ -105,7 +108,7 @@ if __name__ == '__main__':
if not dryrun: if not dryrun:
print 'Pushing commits and tag.' print 'Pushing commits and tag.'
system('git push origin master') system('git push origin %s' % branch)
system('git push --tags') system('git push --tags')
print 'Creating tarball (gzip).' print 'Creating tarball (gzip).'