contrib/release.py: consider positive feedbacks from testers
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
7d1a540598
commit
ceb69c7033
@ -253,6 +253,9 @@ class Tester(object):
|
||||
def getFeedback(self):
|
||||
return self.feedback
|
||||
|
||||
def positiveFeedback(self):
|
||||
return self.feedback is True
|
||||
|
||||
def setFeedback(self, feedback):
|
||||
assert feedback in [True, False, None]
|
||||
self.feedback = feedback
|
||||
@ -263,10 +266,11 @@ class Tester(object):
|
||||
|
||||
class Testers(object):
|
||||
def __init__(self):
|
||||
self.testers = []
|
||||
self.testers = None
|
||||
self._read()
|
||||
|
||||
def _read(self):
|
||||
self.testers = []
|
||||
with open(TESTERS_FILE, 'r') as fd:
|
||||
testers = yaml.load(fd)
|
||||
for tester in testers:
|
||||
@ -299,6 +303,13 @@ class Testers(object):
|
||||
testersList += "- {}\n".format(tester.getName())
|
||||
return testersList
|
||||
|
||||
def getListOk(self):
|
||||
testersOk = []
|
||||
for tester in self.testers:
|
||||
if tester.positiveFeedback():
|
||||
testersOk.append(tester)
|
||||
return testersOk
|
||||
|
||||
def reset(self):
|
||||
for tester in self.testers:
|
||||
tester.setFeedback(None)
|
||||
|
@ -112,11 +112,14 @@ class State(object):
|
||||
|
||||
def restore(self):
|
||||
Git.chdirToRepositoryTopLevel()
|
||||
Git.checkout('-f')
|
||||
Git.checkout('master')
|
||||
Git.resetKeep(self.master)
|
||||
Git.checkout('next')
|
||||
Git.resetKeep(self.next)
|
||||
try:
|
||||
Git.checkout('-f')
|
||||
except:
|
||||
pass
|
||||
# Git.checkout('master')
|
||||
# Git.resetKeep(self.master)
|
||||
# Git.checkout('next')
|
||||
# Git.resetKeep(self.next)
|
||||
|
||||
if self.tag is not None:
|
||||
Git.rmTag(self.tag)
|
||||
@ -152,7 +155,9 @@ class Changelog(object):
|
||||
return False
|
||||
|
||||
def showPrevious(self):
|
||||
return run(shlex.split("tail {}".format(CHANGELOG_EXCERPT_OLD)))
|
||||
output = run(shlex.split("cat '{}'".format(CHANGELOG_EXCERPT_OLD)))
|
||||
for line in output.splitlines():
|
||||
print(line.decode('utf-8')) # Weird to have to decode bytes here.
|
||||
|
||||
def usePrevious(self):
|
||||
rename(CHANGELOG_EXCERPT_OLD, CHANGELOG_EXCERPT)
|
||||
@ -354,9 +359,13 @@ class Release(object):
|
||||
|
||||
if not self.changelog.usingPrevious():
|
||||
date = datetime.now().strftime('%Y-%m-%d')
|
||||
testersList = self.testers.getList()
|
||||
testersList = ""
|
||||
testers = self.testers.getListOk()
|
||||
authorsList = ""
|
||||
authors = Git.getAuthorsList(currentVersion)
|
||||
|
||||
for tester in testers:
|
||||
testersList += "- {}\n".format(tester.getName())
|
||||
for author in authors:
|
||||
authorsList += "- {} ({})\n".format(
|
||||
author.getName(), author.getCount()
|
||||
@ -386,7 +395,7 @@ class Release(object):
|
||||
Git.add('offlineimap/__init__.py')
|
||||
Git.add('Changelog.md')
|
||||
commitMsg = "{}\n".format(newVersion)
|
||||
for tester in self.testers.get():
|
||||
for tester in self.testers.getListOk():
|
||||
commitMsg = "{}\nTested-by: {} {}".format(
|
||||
commitMsg, tester.getName(), tester.getEmail()
|
||||
)
|
||||
@ -441,7 +450,11 @@ if __name__ == '__main__':
|
||||
release.after()
|
||||
|
||||
websiteBranch = release.getWebsiteBranch()
|
||||
print(END_MESSAGE.format(ANNOUNCE_FILE, newVersion, websiteBranch))
|
||||
print(END_MESSAGE.format(
|
||||
announce=ANNOUNCE_FILE,
|
||||
new_version=newVersion,
|
||||
website_branch=websiteBranch)
|
||||
)
|
||||
except Exception as e:
|
||||
release.restore()
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user