mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-22 10:42:55 +01:00
release.py: Allow for a dry-run to double-check the results
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
b82e22b019
commit
d09a4cbbc5
@ -28,8 +28,10 @@ def system(sh, errmsg=None):
|
||||
error(errmsg + ' (error code: %s)' % ret)
|
||||
|
||||
def usage():
|
||||
error('Usage: %s [-s] <sf username> <version>\nSpecify -s to pass it on '
|
||||
'to the relevant git commands.\nMust be called from a git checkout.'
|
||||
error('Usage: %s [-s|-n] <sf username> <version>\nSpecify -s to pass it on '
|
||||
'to the relevant git commands.\nSpecify -n to perform a dry-run '
|
||||
'release. No commits or tags are pushed and no files are uploaded.'
|
||||
'\nMust be called from a git checkout.'
|
||||
% sys.argv[0])
|
||||
|
||||
def checkGitRepo():
|
||||
@ -44,16 +46,20 @@ def checkGitRepo():
|
||||
'Your tree is unclean. Can\'t run from here.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3 or len(sys.argv) > 4:
|
||||
if len(sys.argv) < 3 or len(sys.argv) > 5:
|
||||
usage()
|
||||
|
||||
checkGitRepo()
|
||||
|
||||
sign = ''
|
||||
if len(sys.argv) == 4:
|
||||
dryrun = False
|
||||
while len(sys.argv) > 3:
|
||||
if sys.argv[1] == '-s':
|
||||
sign = '-s'
|
||||
sys.argv.pop(1)
|
||||
elif sys.argv[1] == '-n':
|
||||
dryrun = True
|
||||
sys.argv.pop(1)
|
||||
else:
|
||||
usage()
|
||||
|
||||
@ -101,7 +107,8 @@ if __name__ == '__main__':
|
||||
system('git commit %s -m \'Updated to %s.\' %s'
|
||||
% (sign, v, ' '.join(versionFiles)))
|
||||
|
||||
print 'Pushing commits.'
|
||||
if not dryrun:
|
||||
print 'Pushing commits and tag.'
|
||||
system('git push origin master')
|
||||
system('git push --tags')
|
||||
|
||||
@ -118,6 +125,7 @@ if __name__ == '__main__':
|
||||
os.chdir('..')
|
||||
shutil.rmtree('supybot')
|
||||
|
||||
if not dryrun:
|
||||
print 'Uploading package files to upload.sf.net.'
|
||||
system('scp Supybot-%s.tar.gz Supybot-%s.tar.bz2 Supybot-%s.zip '
|
||||
'%s@frs.sourceforge.net:uploads' % (v, v, v, u))
|
||||
|
Loading…
Reference in New Issue
Block a user