From patchwork Wed Mar 4 11:54:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1248970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48XXQV39WCz9sQt for ; Wed, 4 Mar 2020 22:56:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=li8c/D8/; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48XXQT3F7bzDqW5 for ; Wed, 4 Mar 2020 22:56:01 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=199.181.239.162; helo=relay0162.mxlogin.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=li8c/D8/; dkim-atps=neutral Received: from relay0162.mxlogin.com (relay0162.mxlogin.com [199.181.239.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48XXPX3QCfzDqT2 for ; Wed, 4 Mar 2020 22:55:11 +1100 (AEDT) Received: from filter004.mxroute.com ([149.28.56.236] 149.28.56.236.vultr.com) (Authenticated sender: mN4UYu2MZsgR) by relay0162.mxlogin.com (ZoneMTA) with ESMTPSA id 170a5663f5f000c6c5.002 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Wed, 04 Mar 2020 11:55:06 +0000 X-Zone-Loop: f6b5a88af998cb7a1021b06a37e7491b892483114be2 X-Originating-IP: [149.28.56.236] Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id A6CFC3EA1E; Wed, 4 Mar 2020 11:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lbp0bxYg3VYl5ltXb6rb5ZyLX3nKtDLbyN6JCfbKPko=; b=li8c/D8/3LC75ibW/Xm8wNGb8A STCGeiN4wfhfdZsk/EQrEpL6Mdf4n0ptsEZxHRdWh3bNrhQ1d/fnXHzsAH76NoWtuokNUMOHOk6yX VOITRvjlcfDTkh3YwsnDOSPYJhgwERyuEf5c0EoIWc/z+yQhJcht53+VOHlpeJBO05RhDehx93tKw xHAzIw6BKT9pqv+gSqkVqmrTIX+P4gfbscKx/jmjz6bThkYy6LCfvQ9Y37Uzqw7zPO7QR0cf5vbTo QHxSZQCKIlMZA8/vWRtJomeVVirQVGPanZnIAx1uF6OCqZVLcB8Tl9DZ7I6j8B8BCuH82PpEJGKBS SJe5adtA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 0/5] Remove 'Submission' model Date: Wed, 4 Mar 2020 11:54:52 +0000 Message-Id: <20200304115457.32300-1-stephen@that.guru> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Time to clean up the Submission-Patch-CoverLetter mess and unblock features like Veronika's reworked tagging infrastructure series. As discussed in the commit message, this series ulimately takes us from this model hierarchy: Submission Patch CoverLetter Comment To this hierarchy: Patch PatchComment Cover CoverComment It does this by splitting out the cover letter-related entries from the Submission-CoverLetter and Comment models into two entirely new models, Cover and CoverComment, and then renaming Comment to PatchComment and combining Patch and Submission. This is all explored in more detail in the commit messages. There were a couple of other approaches explored over the two years or so of on-and-off investigation I've had into this issue, which I've listed below: - Add entirely new models Add new models that will replace Patch, CoverLetter and Comment, as well as Submission. These could be called Patch, Cover, PatchComment and CoverComment, (with some intermediate names to allow the old and new models to coexist while we migrate stuff across), so: Submission+Patch -> Patch Submission+CoverLetter -> Cover Comment -> PatchComment or CoverComment, depending on parent Rejected because of the sheer amount of data that has to be moved around for this to work. Effectively, the entire database would need to be rewritten. - Drop CoverLetter in favour of Series A cover letter is essentially additional metadata for a series and could be folded into this. Rejected because of the impact on the API and UI since we'd no longer have cover letter IDs to use in the URL. Doesn't give us enough to justify the effort. - Use generic relations for 'Comment' The contenttypes framework provided by Django allows you to map a model to another model. This means we could have a single Comment model that could point to either the Cover or Patch model. Rejected because I didn't think the complexity was worth it. I may revisit this though before we merge since we'll presumably want similar functionality for the reworked tags feature in the future. - Merge Submission into Patch, rather than the other way around This was actually my first approach and initially seemed easier due to the amount of references to the Patch model. Rejected because this is not currently possible using stock Django due to bug #23521, which states that there is no way to change a model's 'bases' attribute at the moment. I had to copy code from an unmerged PR, #11222, to get this to work which didn't seem ideal. In addition, it turned out updating the references wasn't difficult once I realized that another bug, #25530, only affected Django 1.11 and could be worked around. Daniel: I'm thinking this could form the bulk of a 3.0 release, alongside removal of Python 2.7 support and legacy Django version. This appears to resolve Konstantin's DB murdering query, and should also make better performance a more achievable goal for the patch relations work. As such, I'd personally also like to hold off the latter until we get this in. [1] https://code.djangoproject.com/ticket/23521 [2] https://github.com/django/django/pull/11222 [3] https://code.djangoproject.com/ticket/25530 Stephen Finucane (5): trivial: Rename 'CoverLetter' references to 'Cover' Remove unnecessary references to Submission model Revert "Be sensible computing project patch counts" models: Split 'CoverLetter' from 'Submission' models: Merge 'Patch' and 'Submission' docs/api/schemas/latest/patchwork.yaml | 14 +- docs/api/schemas/patchwork.j2 | 14 +- docs/api/schemas/v1.0/patchwork.yaml | 14 +- docs/api/schemas/v1.1/patchwork.yaml | 14 +- docs/api/schemas/v1.2/patchwork.yaml | 14 +- patchwork/admin.py | 28 +- patchwork/api/comment.py | 56 +++- patchwork/api/cover.py | 34 +-- patchwork/api/embedded.py | 4 +- patchwork/api/event.py | 4 +- patchwork/api/filters.py | 8 +- patchwork/api/series.py | 4 +- patchwork/management/commands/dumparchive.py | 2 +- patchwork/management/commands/parsearchive.py | 11 +- patchwork/migrations/0040_add_cover_model.py | 249 ++++++++++++++++ .../0041_merge_patch_submission_a.py | 281 ++++++++++++++++++ .../0042_merge_patch_submission_b.py | 17 ++ patchwork/models.py | 170 +++++++---- patchwork/parser.py | 89 ++++-- patchwork/signals.py | 4 +- patchwork/tests/api/test_comment.py | 11 +- patchwork/tests/api/test_cover.py | 2 +- patchwork/tests/test_detail.py | 33 +- patchwork/tests/test_mboxviews.py | 40 ++- patchwork/tests/test_parser.py | 4 +- patchwork/tests/test_series.py | 2 +- patchwork/tests/test_tags.py | 6 +- patchwork/tests/utils.py | 37 ++- patchwork/urls.py | 8 +- patchwork/views/__init__.py | 2 +- patchwork/views/comment.py | 43 ++- patchwork/views/cover.py | 22 +- patchwork/views/patch.py | 13 +- patchwork/views/project.py | 29 +- patchwork/views/utils.py | 21 +- 35 files changed, 1020 insertions(+), 284 deletions(-) create mode 100644 patchwork/migrations/0040_add_cover_model.py create mode 100644 patchwork/migrations/0041_merge_patch_submission_a.py create mode 100644 patchwork/migrations/0042_merge_patch_submission_b.py