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

Paolo Bonzini pbonzini at redhat.com
Thu May 2 11:17:49 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 | 14 ++++----------
 patchew-cli  |  4 +---
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/api/views.py b/api/views.py
index d323ba3..4ac5636 100644
--- a/api/views.py
+++ b/api/views.py
@@ -137,14 +137,6 @@ class SetProjectPropertiesView(APILoginRequiredView):
             po.set_property(k, v)
 
 
-def get_properties(m):
-    r = m.get_properties()
-    # for compatibility with patchew-cli's applier mode
-    if m.tags:
-        r['tags'] = m.tags
-    return r
-
-
 class DeleteProjectPropertiesByPrefixView(APILoginRequiredView):
     name = "delete-project-properties-by-prefix"
     allowed_groups = ["maintainers"]
@@ -161,7 +153,8 @@ def prepare_patch(p):
     r = {"subject": p.subject,
          "message-id": p.message_id,
          "mbox": p.get_mbox(),
-         "properties": get_properties(p)
+         # For backwards compatibility with old clients
+         "properties": {}
          }
     return r
 
@@ -181,7 +174,8 @@ def prepare_series(request, s, fields=None):
     if want_field("patches"):
         r["patches"] = [prepare_patch(x) for x in s.get_patches()]
     if want_field("properties"):
-        r["properties"] = get_properties(s)
+        # For backwards compatibility with old clients
+        r["properties"] = {}
     if want_field("tags"):
         r["tags"] = s.tags
     if want_field("is_complete"):
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