[Patchew-devel] [PATCH] models: add SeriesMerged event

Paolo Bonzini posted 1 patch 13 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190416164753.27632-1-pbonzini@redhat.com
api/models.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

[Patchew-devel] [PATCH] models: add SeriesMerged event

Posted by Paolo Bonzini 13 weeks ago
This can be used to send email when a patch is applied.
---
 api/models.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/api/models.py b/api/models.py
index aa99eb8..f3e8211 100644
--- a/api/models.py
+++ b/api/models.py
@@ -278,8 +278,7 @@ class Project(models.Model):
                 if not p.is_merged:
                     break
             else:
-                series.is_merged = True
-                series.save()
+                series.set_merged()
         return len(updated_series)
 
     def create_result(self, **kwargs):
@@ -306,7 +305,8 @@ class ProjectProperty(models.Model):
 
 declare_event("SeriesComplete", project="project object",
               series="series instance that is marked complete")
-
+declare_event("SeriesMerged", project="project object",
+              series="series instance that is marked complete")
 
 declare_event("MessageAdded", message="message object that is added")
 
@@ -740,6 +740,13 @@ class Message(models.Model):
         self.save()
         emit_event("SeriesComplete", project=self.project, series=self)
 
+    def set_merged(self):
+        if self.is_merged:
+            return
+        self.is_merged = True
+        self.save()
+        emit_event("SeriesMerged", project=self.project, series=self)
+
     def create_result(self, **kwargs):
         return MessageResult(message=self, **kwargs)
 
-- 
2.21.0

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel

Re: [Patchew-devel] [PATCH] models: add SeriesMerged event

Posted by Fam Zheng 13 weeks ago

> On Apr 17, 2019, at 00:47, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> This can be used to send email when a patch is applied.
> ---
> api/models.py | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/api/models.py b/api/models.py
> index aa99eb8..f3e8211 100644
> --- a/api/models.py
> +++ b/api/models.py
> @@ -278,8 +278,7 @@ class Project(models.Model):
>                 if not p.is_merged:
>                     break
>             else:
> -                series.is_merged = True
> -                series.save()
> +                series.set_merged()
>         return len(updated_series)
> 
>     def create_result(self, **kwargs):
> @@ -306,7 +305,8 @@ class ProjectProperty(models.Model):
> 
> declare_event("SeriesComplete", project="project object",
>               series="series instance that is marked complete")
> -
> +declare_event("SeriesMerged", project="project object",
> +              series="series instance that is marked complete")
> 
> declare_event("MessageAdded", message="message object that is added")
> 
> @@ -740,6 +740,13 @@ class Message(models.Model):
>         self.save()
>         emit_event("SeriesComplete", project=self.project, series=self)
> 
> +    def set_merged(self):
> +        if self.is_merged:
> +            return
> +        self.is_merged = True
> +        self.save()
> +        emit_event("SeriesMerged", project=self.project, series=self)
> +
>     def create_result(self, **kwargs):
>         return MessageResult(message=self, **kwargs)

Reviewed-by: Fam Zheng <fam@euphon.net>

> 
> -- 
> 2.21.0
> 
> _______________________________________________
> Patchew-devel mailing list
> Patchew-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/patchew-devel


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel