[Patchew-devel] [PATCH] git: allow not passing the URL to applier-report

Paolo Bonzini posted 1 patch 5 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190111100233.24335-1-pbonzini@redhat.com
mods/git.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[Patchew-devel] [PATCH] git: allow not passing the URL to applier-report
Posted by Paolo Bonzini 5 years, 2 months ago
The applier-report handler tried to use the URL template from the project, but there
was a bug in the logic to do so.  Fix it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/git.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mods/git.py b/mods/git.py
index a163062..4f3236b 100644
--- a/mods/git.py
+++ b/mods/git.py
@@ -273,9 +273,10 @@ class ApplierReportView(APILoginRequiredView):
             data['tag'] = 'refs/tags/' + tag
             if url:
                 data['url'] = url
-            elif url_template and tag:
+            elif tag:
                 url_template = p.get_property("git.url_template")
-                data['url'] = url_template.replace("%t", tag)
+                if url_template:
+                    data['url'] = url_template.replace("%t", tag)
             if base:
                 data['base'] = base
             r.status = Result.SUCCESS
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
Re: [Patchew-devel] [PATCH] git: allow not passing the URL to applier-report
Posted by Fam Zheng 5 years, 2 months ago

> On Jan 11, 2019, at 18:02, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> The applier-report handler tried to use the URL template from the project, but there
> was a bug in the logic to do so.  Fix it.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> mods/git.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mods/git.py b/mods/git.py
> index a163062..4f3236b 100644
> --- a/mods/git.py
> +++ b/mods/git.py
> @@ -273,9 +273,10 @@ class ApplierReportView(APILoginRequiredView):
>             data['tag'] = 'refs/tags/' + tag
>             if url:
>                 data['url'] = url
> -            elif url_template and tag:
> +            elif tag:
>                 url_template = p.get_property("git.url_template")
> -                data['url'] = url_template.replace("%t", tag)
> +                if url_template:
> +                    data['url'] = url_template.replace("%t", tag)
>             if base:
>                 data['base'] = base
>             r.status = Result.SUCCESS

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




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