[Patchew-devel] [PATCH 6/7] git: do not return properties from applier-get

Paolo Bonzini pbonzini at redhat.com
Wed Apr 17 10:09:47 UTC 2019


Properties that are of interest to the applier are already returned
directly in the applier-get reply; the applier is only using properties
to retrieve tags from old servers that do not have commit 32bddb4 ("models:
convert tags from property to field", 2018-10-30).  It is not needed
anymore, remove it to hide properties from the API.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 api/views.py | 2 --
 mods/git.py  | 4 +++-
 patchew-cli  | 4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/api/views.py b/api/views.py
index d323ba3..22d5cb5 100644
--- a/api/views.py
+++ b/api/views.py
@@ -180,8 +180,6 @@ def prepare_series(request, s, fields=None):
         r["message-id"] = s.message_id
     if want_field("patches"):
         r["patches"] = [prepare_patch(x) for x in s.get_patches()]
-    if want_field("properties"):
-        r["properties"] = get_properties(s)
     if want_field("tags"):
         r["tags"] = s.tags
     if want_field("is_complete"):
diff --git a/mods/git.py b/mods/git.py
index d0b1f87..e91ca8c 100644
--- a/mods/git.py
+++ b/mods/git.py
@@ -257,13 +257,15 @@ class ApplierGetView(APILoginRequiredView):
             return None
 
         response = prepare_series(request, m, fields=["project", "message-id", "patches",
-                                                      "properties", "tags"])
+                                                      "tags"])
 
         po = m.project
         for prop in ["git.push_to", "git.public_repo", "git.url_template"]:
             if po.get_property(prop):
                 response[prop] = po.get_property(prop)
         base = _instance.get_base(m)
+        # For backwards compatibility with old clients
+        response["properties"] = {}
         if base:
             response["git.repo"] = base.data["repo"]
             response["git.base"] = base.data["tag"]
diff --git a/patchew-cli b/patchew-cli
index efc6f13..bfff69c 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -681,9 +681,7 @@ class ApplyCommand(SubCommand):
                     subprocess.check_output(["git", "log", "-n", "1",
                                              "--format=%b"], cwd=repo) \
                                            .decode('utf-8').splitlines()
-            # old servers do not have "tags" directly in the response
-            for t in set(p["properties"].get("tags", []) + p.get("tags", []) + \
-                         s["properties"].get("tags", []) + s.get("tags", [])):
+            for t in set(p.get("tags", []) + s.get("tags", [])):
                 if t in commit_message_lines:
                     continue
                 filter_cmd += "echo '%s';" % t
-- 
2.21.0





More information about the Patchew-devel mailing list