Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id A17D7E0073D; Wed, 30 Nov 2016 13:40:45 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.115 listed in list.dnswl.org] Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7C45CE006B4 for ; Wed, 30 Nov 2016 13:40:41 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP; 30 Nov 2016 13:40:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,574,1473145200"; d="scan'208";a="37393931" Received: from jalamego-mobl2.zpn.intel.com ([10.219.5.146]) by orsmga005.jf.intel.com with ESMTP; 30 Nov 2016 13:40:41 -0800 From: Jose Lamego To: yocto@yoctoproject.org Date: Wed, 30 Nov 2016 15:40:33 -0600 Message-Id: <1480542033-15238-1-git-send-email-jose.a.lamego@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480028409-13127-1-git-send-email-jose.a.lamego@linux.intel.com> References: <1480028409-13127-1-git-send-email-jose.a.lamego@linux.intel.com> Subject: [patchwork][PATCH v3] patchwork.models: Include first patch's name in series name X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 21:40:45 -0000 Patch Series created without a cover letter are named using a non-descriptive generic string. This change names the series using either the first 30 characters in patch #1 plus the remaining patches number, or the patch name for one-patch (1/1) series. [YOCTO #10625] Signed-off-by: Jose Lamego --- patchwork/models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patchwork/models.py b/patchwork/models.py index 3f531e6..1521641 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series): def _on_revision_complete(sender, revision, **kwargs): series = revision.series + # Now we know how many patches are in the revision, + # so we can update the name for series without a cover letter + if series.name == SERIES_DEFAULT_NAME: + name = series.latest_revision().ordered_patches()[0].name + n = re.compile(r'(\[\d+\/\d+\]\s?)') + name = n.sub('', name) + c = len(series.latest_revision().ordered_patches()) + # For one-patch series (1/1) without cover letter + if c == 1: + series.name = name + else: + series.name = "\"%s...\" and %s more" % (name[:30], c-1) + # update series.last_revision series.last_revision = series.latest_revision() series.save() -- 1.9.1