Merged [4885] from rjsparks@nostrum.com:
refactored close_open_ballots, creating a way to close one abllot at a time. rewrote the clear ballot code to close each open ballot and open a new one
- Legacy-Id: 4960
Note: SVN reference [4885] has been migrated to Git commit b3bdbc9506
This commit is contained in:
commit
8493ce7e38
|
@ -74,20 +74,23 @@ def needed_ballot_positions(doc, active_positions):
|
|||
|
||||
return " ".join(answer)
|
||||
|
||||
def create_ballot_if_not_open(doc, by, ballot_type_slug):
|
||||
if not doc.ballot_open(ballot_type_slug):
|
||||
def create_ballot_if_not_open(doc, by, ballot_slug):
|
||||
if not doc.ballot_open(ballot_slug):
|
||||
e = BallotDocEvent(type="created_ballot", by=by, doc=doc)
|
||||
e.ballot_type = BallotType.objects.get(doc_type=doc.type, slug=ballot_type_slug)
|
||||
e.ballot_type = BallotType.objects.get(doc_type=doc.type, slug=ballot_slug)
|
||||
e.desc = u'Created "%s" ballot' % e.ballot_type.name
|
||||
e.save()
|
||||
|
||||
def close_ballot(doc, by, ballot_slug):
|
||||
if doc.ballot_open(ballot_slug):
|
||||
e = BallotDocEvent(type="closed_ballot", doc=doc, by=by)
|
||||
e.ballot_type = BallotType.objects.get(doc_type=doc.type,slug=ballot_slug)
|
||||
e.desc = 'Closed "%s" ballot' % e.ballot_type.name
|
||||
e.save()
|
||||
|
||||
def close_open_ballots(doc, by):
|
||||
for t in BallotType.objects.filter(doc_type=doc.type_id):
|
||||
if doc.ballot_open(t.slug):
|
||||
e = BallotDocEvent(type="closed_ballot", doc=doc, by=by)
|
||||
e.ballot_type = t
|
||||
e.desc = 'Closed "%s" ballot' % t.name
|
||||
e.save()
|
||||
close_ballot(doc, by, t.slug )
|
||||
|
||||
def augment_with_start_time(docs):
|
||||
"""Add a started_time attribute to each document with the time of
|
||||
|
|
|
@ -385,15 +385,13 @@ if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
|||
|
||||
@group_required('Secretariat')
|
||||
def clear_ballot(request, name):
|
||||
"""Clear all positions and discusses. This is actually accomplished by creating a new
|
||||
started_iesg_process DocEvent."""
|
||||
"""Clear all positions and discusses on every open ballot for a document."""
|
||||
doc = get_object_or_404(Document, name=name)
|
||||
if request.method == 'POST':
|
||||
DocEvent.objects.create(type='started_iesg_process',
|
||||
doc=doc,
|
||||
by=request.user.get_profile(),
|
||||
desc='cleared_ballot')
|
||||
|
||||
by = request.user.get_profile()
|
||||
for t in BallotType.objects.filter(doc_type=doc.type_id):
|
||||
close_ballot(doc, by, t.slug)
|
||||
create_ballot_if_not_open(doc, by, t.slug)
|
||||
return HttpResponseRedirect(urlreverse("doc_view", kwargs=dict(name=doc.name)))
|
||||
|
||||
return render_to_response('idrfc/clear_ballot.html',
|
||||
|
|
|
@ -124,7 +124,7 @@ else
|
|||
die "Could not find a branch matching '$branch'"
|
||||
fi
|
||||
|
||||
if grep "@rev $branch" mergelog; then die "Changeset $branch@rev is already in the merge log"; fi
|
||||
if grep "@$rev $branch" mergelog; then die "Changeset $branch@$rev is already in the merge log"; fi
|
||||
|
||||
note "Will attempt merge from $branch@$rev"
|
||||
|
||||
|
@ -135,12 +135,11 @@ who=$2; echo -e "\n$who"
|
|||
comment=$(echo "$info" | tail -n +3); echo -e "$comment\n"
|
||||
files=$(svn diff ${repo}/ -c $rev --summarize | awk '{$1=""; print;}' | while read file; do echo "${file/$repo\/$branch\//}"; done)
|
||||
|
||||
echo -n "Files: \n$files"
|
||||
echo -e "Files: \n$files"
|
||||
|
||||
note "Writing commit script"
|
||||
echo -e "#!/bin/bash\n\nsvn commit -m \"Merged [$rev] from $who: ${comment/\"/\'} ${fix/\"/\'}\" && rm $0" > ../commit-${rev}-merge.sh
|
||||
chmod +x ../commit-${rev}-merge.sh
|
||||
cp ../commit-${rev}-merge.sh ./commit
|
||||
echo -e "#!/bin/bash\n\nsvn commit -m \"Merged [$rev] from $who: ${comment/\"/\'} ${fix/\"/\'}\"" > ../cicmd/commit-${rev}-merge.sh
|
||||
chmod +x ../cicmd/commit-${rev}-merge.sh
|
||||
|
||||
note "Do the merge:"
|
||||
svn merge -c $rev ${repo}/$branch . || die "Merge of $branch @$rev failed. The merge command was:
|
||||
|
@ -155,14 +154,11 @@ date +"%Y-%m-%d %H:%M:%S $G$C$M @$rev $branch" >> mergelog
|
|||
|
||||
cd ../
|
||||
rsync -a $cwd/ merged@$rev/
|
||||
cd merged@$rev/
|
||||
cp ../commit-${rev}-merge.sh commit
|
||||
note "Now in $PWD"
|
||||
|
||||
note "Running tests..."
|
||||
{ PYTHONPATH=$PWD ietf/manage.py test || die "Testing of $branch@$rev merged to trunk failed -- not sending email, not committing."; } 2>&1 | tee testlog
|
||||
cp cicmd/commit-${rev}-merge.sh merged@$rev/commit
|
||||
cd -
|
||||
|
||||
note "Sending email to changeset author: <$who>"
|
||||
|
||||
mail -s "Merged datatracker branch personal/$branch@$rev to trunk" $who -c henrik@levkowetz.com <<-EOF
|
||||
Hi,
|
||||
|
||||
|
@ -183,7 +179,7 @@ if [ "$ARG_COMMIT" ]; then
|
|||
svn commit -m "Merged [$rev] from $who: $comment $fix"
|
||||
else
|
||||
echo "This merge has not been committed yet."
|
||||
echo "To commit it, run this commit command: ../commit-$rev-merge.sh"
|
||||
echo "To commit it, run this commit command: ../cicmd/commit-$rev-merge.sh"
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue