summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorMagnus Hagander2016-03-02 13:39:17 +0000
committerMagnus Hagander2016-03-02 13:39:17 +0000
commitb6560189236779953947717f55685abab4e9d2ce (patch)
tree172bee53e8e13d802b7a0086f7fe382889de9845 /pgcommitfest/commitfest/views.py
parent61219385bccc67a059437818a9f9e53a6beee048 (diff)
Maintain patch status when moving to next CF
So a patch that's in "ready for committer" status remains there. When doing this, also refuse to move any patches that are not either "waiting for review" or "ready for committer". They will have to have their existing status changed first, and then be moved.
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index ddd62c9..a6aee9c 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -461,6 +461,24 @@ def close(request, cfid, patchid, status):
elif status == 'feedback':
poc.status = PatchOnCommitFest.STATUS_RETURNED
elif status == 'next':
+ # Only some patch statuses can actually be moved.
+ if poc.status in (PatchOnCommitFest.STATUS_AUTHOR,
+ PatchOnCommitFest.STATUS_COMMITTED,
+ PatchOnCommitFest.STATUS_NEXT,
+ PatchOnCommitFest.STATUS_RETURNED,
+ PatchOnCommitFest.STATUS_REJECTED):
+ # Can't be moved!
+ messages.error(request, "A patch in status {0} cannot be moved to next commitfest.".format(poc.statusstring))
+ return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
+ elif poc.status in (PatchOnCommitFest.STATUS_REVIEW,
+ PatchOnCommitFest.STATUS_COMMITTER):
+ # This one can be moved
+ pass
+ else:
+ messages.error(request, "Invalid existing patch status")
+
+ oldstatus = poc.status
+
poc.status = PatchOnCommitFest.STATUS_NEXT
# Figure out the commitfest to actually put it on
newcf = CommitFest.objects.filter(status=CommitFest.STATUS_OPEN)
@@ -490,7 +508,10 @@ def close(request, cfid, patchid, status):
return HttpResponseRedirect('/%s/%s/' % (poc.commitfest.id, poc.patch.id))
# Create a mapping to the new commitfest that we are bouncing
# this patch to.
- newpoc = PatchOnCommitFest(patch=poc.patch, commitfest=newcf[0], enterdate=datetime.now())
+ newpoc = PatchOnCommitFest(patch=poc.patch,
+ commitfest=newcf[0],
+ status=oldstatus,
+ enterdate=datetime.now())
newpoc.save()
elif status == 'committed':
committer = get_object_or_404(Committer, user__username=request.GET['c'])