[Patchew-devel] [PATCH 05/10] git: Emit git result update event
Fam Zheng
famz at redhat.com
Thu Jul 26 08:26:20 UTC 2018
On Thu, Jul 26, 2018 at 4:21 PM Paolo Bonzini <pbonzini at redhat.com> wrote:
>
> On 26/07/2018 03:47, Fam Zheng wrote:
> > old_status will help testing mod to determine if recalculating test
> > results is necessary.
> >
> > Signed-off-by: Fam Zheng <famz at redhat.com>
> > ---
> > mods/git.py | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/mods/git.py b/mods/git.py
> > index 924547a..7970bc1 100644
> > --- a/mods/git.py
> > +++ b/mods/git.py
> > @@ -67,7 +67,9 @@ class GitModule(PatchewModule):
> > # Make sure git is available
> > subprocess.check_output(["git", "version"])
> > declare_event("ProjectGitUpdate", project="the updated project name")
> > - declare_event("SeriesApplied", series="the object of applied series")
> > + declare_event("GitResultUpdate", obj="the updated object",
> > + old_status='the old result status',
> > + result="the Git result object")
>
> What about making this a generic ResultUpdate event, raised from
> api.models (it could also use Django's signals, but I'd go for the
> former right now)? Otherwise everything in the series looks great.
Okay. Wanted to be quick and localized on this fix because I was
fixing patchew.org. But being more generic here makes more sense. Will
update it.
Fam
>
> Thanks,
>
> Paolo
>
> > register_handler("SeriesComplete", self.on_series_update)
> > register_handler("TagsUpdate", self.on_series_update)
> >
> > @@ -273,8 +275,10 @@ class ApplierReportView(APILoginRequiredView):
> > def handle(self, request, project, message_id, tag, url, base, repo,
> > failed, log):
> > p = Project.objects.get(name=project)
> > - r = Message.objects.series_heads().get(project=p,
> > - message_id=message_id).git_result
> > + series = Message.objects.series_heads().get(project=p,
> > + message_id=message_id)
> > + r = series.git_result
> > + old_status = r.status
> > r.log = log
> > data = {}
> > if failed:
> > @@ -292,3 +296,5 @@ class ApplierReportView(APILoginRequiredView):
> > r.status = Result.SUCCESS
> > r.data = data
> > r.save()
> > + emit_event("GitResultUpdate", obj=series, old_status=old_status,
> > + result=r)
> >
>
More information about the Patchew-devel
mailing list