[PATCH v2 02/11] cli: Separate current and deprecated format version
authorAustin Clements <amdragon@MIT.EDU>
Thu, 24 Oct 2013 15:19:02 +0000 (11:19 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:35 +0000 (09:57 -0800)
b5/59027b4a3ef9ae3194fb61fc317affab0bf4e6 [new file with mode: 0644]

diff --git a/b5/59027b4a3ef9ae3194fb61fc317affab0bf4e6 b/b5/59027b4a3ef9ae3194fb61fc317affab0bf4e6
new file mode 100644 (file)
index 0000000..aac6fc5
--- /dev/null
@@ -0,0 +1,118 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 277B1429E49\r
+       for <notmuch@notmuchmail.org>; Thu, 24 Oct 2013 08:19:23 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 33WI5egioZOz for <notmuch@notmuchmail.org>;\r
+       Thu, 24 Oct 2013 08:19:17 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id D0AA1429E39\r
+       for <notmuch@notmuchmail.org>; Thu, 24 Oct 2013 08:19:16 -0700 (PDT)\r
+X-AuditID: 1209190f-b7fa08e0000009c6-9e-52693a7420bc\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 46.10.02502.47A39625; Thu, 24 Oct 2013 11:19:16 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r9OFJF3C030434; \r
+       Thu, 24 Oct 2013 11:19:15 -0400\r
+Received: from drake.dyndns.org\r
+       (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [216.15.114.40]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r9OFJCre012907\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 24 Oct 2013 11:19:14 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VZMgq-0006dl-Mn; Thu, 24 Oct 2013 11:19:12 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 02/11] cli: Separate current and deprecated format version\r
+Date: Thu, 24 Oct 2013 11:19:02 -0400\r
+Message-Id: <1382627951-25252-3-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
+References: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrVtilRlkcPW8hEXTdGeL1XN5LK7f\r
+       nMnswOyxc9Zddo9b91+zezxbdYs5gDmKyyYlNSezLLVI3y6BK6Nl0Rnmgi98FY2PjjI2MHbz\r
+       dDFyckgImEjsenCSDcIWk7hwbz2QzcUhJLCPUeLunGlQzkZGiR+Tn7JDOHeYJObv/cEI4cxl\r
+       lJjS+RGsn01AQ2Lb/uWMILaIgLTEzruzWUFsZoFoiSOXZ4DVCAv4Sqz/9BashkVAVeLK3kns\r
+       IDavgIPEpnm7WSDuUJJYeGobWC+ngKPEz9fXwOqFgGp+/T7DMoGRfwEjwypG2ZTcKt3cxMyc\r
+       4tRk3eLkxLy81CJdE73czBK91JTSTYzg4JLk38H47aDSIUYBDkYlHl6ND+lBQqyJZcWVuYcY\r
+       JTmYlER575lmBgnxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4Z2mB5TjTUmsrEotyodJSXOwKInz\r
+       3uSwDxISSE8sSc1OTS1ILYLJynBwKEnwdloCNQoWpaanVqRl5pQgpJk4OEGG8wANXwpSw1tc\r
+       kJhbnJkOkT/FqCglzjsPJCEAksgozYPrhUX/K0ZxoFeEeTeBVPEAEwdc9yugwUxAg6csSQMZ\r
+       XJKIkJJqYBTqC7UQWLqB+4gk2+JN4at5pqxMi89axHyPRUzcwSZ3VWMbq+bZtTvmHd52XGi9\r
+       SHY286sznwpuFDRdtJ161nv/Vna5ftGXh++Gp6c2Ts28zlpk/uXHvJVfe7Rz9x+qPKR2eMpZ\r
+       97qElTO8Yuw6t+R9sTFKW3/XctLztfNnad79krv45PkLjluUWIozEg21mIuKEwErz1Ld2QIA        AA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 24 Oct 2013 15:19:23 -0000\r
+\r
+Previously, the CLI would print a deprecation warning if a client\r
+requested any format version other than the current one.  However, if\r
+we add fields that are backwards-compatible, but want clients to be\r
+able to depend on, we need to bump the version, but that doesn't make\r
+the older version deprecated.\r
+\r
+Hence, separate out the "minimum active" version and only print a\r
+warning for requests below this version number.\r
+---\r
+ notmuch-client.h | 6 ++++++\r
+ notmuch.c        | 2 +-\r
+ 2 files changed, 7 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 0bfa4da..4ecb3ae 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -142,6 +142,12 @@ chomp_newline (char *str)\r
+ /* The minimum supported structured output format version.  Requests\r
+  * for format versions below this will return an error. */\r
+ #define NOTMUCH_FORMAT_MIN 1\r
++/* The minimum non-deprecated structured output format version.\r
++ * Requests for format versions below this will print a stern warning.\r
++ * Must be between NOTMUCH_FORMAT_MIN and NOTMUCH_FORMAT_CUR,\r
++ * inclusive.\r
++ */\r
++#define NOTMUCH_FORMAT_MIN_ACTIVE 1\r
\r
+ /* The output format version requested by the caller on the command\r
+  * line.  If no format version is requested, this will be set to\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 8d303a1..54f46c6 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -127,7 +127,7 @@ by the notmuch CLI (it requires at least version %d).  You may need to\n\\r
+ upgrade your notmuch front-end.\n",\r
+                notmuch_format_version, NOTMUCH_FORMAT_MIN);\r
+       exit (NOTMUCH_EXIT_FORMAT_TOO_OLD);\r
+-    } else if (notmuch_format_version != NOTMUCH_FORMAT_CUR) {\r
++    } else if (notmuch_format_version < NOTMUCH_FORMAT_MIN_ACTIVE) {\r
+       /* Warn about old version requests so compatibility issues are\r
+        * less likely when we drop support for a deprecated format\r
+        * versions. */\r
+-- \r
+1.8.4.rc3\r
+\r