From patchwork Wed Aug 1 19:04:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Ryabitsev X-Patchwork-Id: 952358 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41gjRQ5JTwz9s3Z for ; Thu, 2 Aug 2018 05:04:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VNWwGalP"; 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 41gjRQ3jVmzF1jP for ; Thu, 2 Aug 2018 05:04:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VNWwGalP"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linuxfoundation.org (client-ip=2607:f8b0:4001:c06::241; helo=mail-io0-x241.google.com; envelope-from=konstantin@linuxfoundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VNWwGalP"; dkim-atps=neutral Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41gjRF21l4zF1Qn for ; Thu, 2 Aug 2018 05:04:40 +1000 (AEST) Received: by mail-io0-x241.google.com with SMTP id v26-v6so17014381iog.5 for ; Wed, 01 Aug 2018 12:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=NaQjQzCpBgJZoFid3gQ9FSZoX01egdxJdJzTJcCuiDo=; b=VNWwGalPEVSNZLRlR9CxLuWOHCTqSAzPOsmdrWza6AXSRNLuLEz4s4w6Z8zoe81hyj ALovaVJk6r06JB9sQX+Wknmr2FhbERl7iPiHs3NwZUtNGFSgWrc9fDQYRNhaF24j7ZhE iZcXkF2tfj/Fmc1cn6j1JQS39G2T/a8Y/vBWA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=NaQjQzCpBgJZoFid3gQ9FSZoX01egdxJdJzTJcCuiDo=; b=Wur4yqqHn0NRIlzK1sFSVE/kuTrhcpKncy6hvV+abQFfI2aQG+UNi9Q2bQnJW1JhbY GmZmb05i4drtgWII0IJYKqXvDXsb7sFizthYztLmlWRnoPWUHWrUkwi6EkAxgmhdQnTD wjJW0nbiFmEPvxojzoQdEOx++9vpRQYQ7yYfcwJFte1GrmEnYYpCNgAW9EvH7WwNqFCg uN++PRgAwIaPfDENg0CABKMT1F8vNCeo53bFF6wlqXO8kNzxttHaDqVkB28L212yfzzg C5Dms6I+s+lX2mthDxYL9c4EUeRC8SOJxrqGjjA1+4pR2wNSMcgGR9VCKS6yxSmAwWRw d3jQ== X-Gm-Message-State: AOUpUlEmal+ahxdq3dHfqKpmTsDU40Hnhagrvnr65Mvsfh9OU8otsWKu jbpC9y4TO9YNlC1QFwNEwvOfHVLcjNE+qg== X-Google-Smtp-Source: AAOMgpenZwU/wVQtphALtgFTRqGyr7clj6URgoOfXsv8pZj4vMaq1rZDTB8odjOanAgy4V3s3Nc5Pg== X-Received: by 2002:a6b:dd5:: with SMTP id 204-v6mr4406967ion.172.1533150277758; Wed, 01 Aug 2018 12:04:37 -0700 (PDT) Received: from chatter (ca2x.mullvad.net. [162.219.176.251]) by smtp.gmail.com with ESMTPSA id g18-v6sm55727iti.4.2018.08.01.12.04.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Aug 2018 12:04:37 -0700 (PDT) Date: Wed, 1 Aug 2018 15:04:54 -0400 From: Konstantin Ryabitsev To: patchwork@lists.ozlabs.org Subject: RFE: permalink to submissions using list-id/message-id (GH issue 106) Message-ID: <20180801190454.GA14991@chatter> Mail-Followup-To: patchwork@lists.ozlabs.org MIME-Version: 1.0 User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.27 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" Hi, all: I'm largely duplicating what I wrote in the GitHub issue 106 (https://github.com/getpatchwork/patchwork/issues/106) just to reiterate a personal plea. :) One of the side-effects of moving the LKML project to a dedicated instance was the fact that I discovered just how many people were using patchwork.kernel.org links in various places. Arguably, this is the wrong way to use patchwork, since it's supposed to remain entirely behind the scenes, but this is obviously a losing battle, considering how many hits the following query returns: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=patchwork.kernel.org Android and ChromiumOS folks are also using it: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1092792 Since all patches have different IDs on the new instance (lore.kernel.org/patchwork), all these URLs were now broken. I fixed this for the moment by creating a simple dict matching of oldid -> newid mapped using the message-id of each submission, and added the following nasty hack to the running code: This does the job for the moment, though I probably shouldn't be keeping the mapping dict in RAM at all times, even if it *is* just a bunch of ints. Anyway, my request is that, since people can't be convinced to stop using patchwork links, that we provide them with a convenient way to obtain permalinks in a format that doesn't rely on patch-id. I suggest: sitename/p/list-id/message-id e.g.: patchwork.kernel.org/p/linux-kernel.vger.kernel.org/20170619152033.893467280@linuxfoundation.org Perhaps add a [permalink] button to the same row currently showing [patch-id | diff | mbox | series ]. This should contain all the necessary info for patchwork to rewrite this into a patch view. If the list-id changes, as they sometimes do, the site administrator can easily add a one-line rewrite rule that would preserve link validity. This has two added benefits over the status quo: 1. Moving projects between databases becomes possible 2. More importantly, this allows future code historians to still be able to get context about a commit even if the patchwork service is no longer operating. If they can see both the list-id and the message-id, that should give them enough information to locate the conversation in mailing list archives. -K diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index eccb544..242da7b 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -37,6 +37,13 @@ from patchwork.views import generic_list from patchwork.views.utils import patch_to_mbox from patchwork.views.utils import series_patch_to_mbox +try: + with open('/opt/patchwork/idmap.pickle', 'rb') as idp: + import pickle + lkml_idmap = pickle.load(idp) + idp.close() +except: + lkml_idmap = {} def patch_list(request, project_id): project = get_object_or_404(Project, linkname=project_id) @@ -58,6 +65,9 @@ def patch_detail(request, patch_id): if submissions: return HttpResponseRedirect( reverse('cover-detail', kwargs={'cover_id': patch_id})) + elif int(patch_id) in lkml_idmap: + newurl = 'https://lore.kernel.org/patchwork/patch/%s/' % lkml_idmap[int(patch_id)] + return HttpResponseRedirect(newurl) raise exc editable = patch.is_editable(request.user)