From 27f79774ea127c07762bb29d087970a9b061460d Mon Sep 17 00:00:00 2001 From: david Date: Sat, 4 Aug 2012 23:23:11 +2100 Subject: [PATCH] [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file --- df/bdb0839bc51b3711bd89269fad275098215468 | 168 ++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 df/bdb0839bc51b3711bd89269fad275098215468 diff --git a/df/bdb0839bc51b3711bd89269fad275098215468 b/df/bdb0839bc51b3711bd89269fad275098215468 new file mode 100644 index 000000000..df5323040 --- /dev/null +++ b/df/bdb0839bc51b3711bd89269fad275098215468 @@ -0,0 +1,168 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 92325431FD2 + for ; Fri, 3 Aug 2012 19:23:32 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id d6a-B4nmGPb3 for ; + Fri, 3 Aug 2012 19:23:30 -0700 (PDT) +Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2E923431FC7 + for ; Fri, 3 Aug 2012 19:23:28 -0700 (PDT) +Received: from fctnnbsc30w-156034089108.dhcp-dynamic.fibreop.nb.bellaliant.net + ([156.34.89.108] helo=zancas.localnet) + by tesseract.cs.unb.ca with esmtpsa + (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) + (envelope-from ) + id 1SxU1X-0005C7-65; Fri, 03 Aug 2012 23:23:27 -0300 +Received: from bremner by zancas.localnet with local (Exim 4.80) + (envelope-from ) + id 1SxU1R-0006mS-Mg; Fri, 03 Aug 2012 23:23:21 -0300 +From: david@tethera.net +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] notmuch-dump: remove deprecated positional argument for + output file +Date: Fri, 3 Aug 2012 23:23:11 -0300 +Message-Id: <1344046992-25976-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1344046992-25976-1-git-send-email-david@tethera.net> +References: <1344046992-25976-1-git-send-email-david@tethera.net> +X-Spam_bar: - +Cc: David Bremner +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 04 Aug 2012 02:23:32 -0000 + +From: David Bremner + +The syntax --output=filename is a smaller change than deleting the +output argument completely, and conceivably useful e.g. when running +notmuch under a debugger. +--- + man/man1/notmuch-dump.1 | 5 ++--- + notmuch-dump.c | 3 +-- + test/dump-restore | 20 ++++++++------------ + test/maildir-sync | 2 +- + 4 files changed, 12 insertions(+), 18 deletions(-) + +diff --git a/man/man1/notmuch-dump.1 b/man/man1/notmuch-dump.1 +index 64abf01..5d1e197 100644 +--- a/man/man1/notmuch-dump.1 ++++ b/man/man1/notmuch-dump.1 +@@ -5,15 +5,14 @@ notmuch-dump \- creates a plain-text dump of the tags of each message + .SH SYNOPSIS + + .B "notmuch dump" +-.RI "[ <" filename "> ] [--]" ++.RI "[ --output=<" filename "> ] [--]" + .RI "[ <" search-term ">...]" + + .SH DESCRIPTION + + Dump tags for messages matching the given search terms. + +-Output is to the given filename, if any, or to stdout. Note that +-using the filename argument is deprecated. ++Output is to the given filename, if any, or to stdout. + + These tags are the only data in the notmuch database that can't be + recreated from the messages themselves. The output of notmuch dump is +diff --git a/notmuch-dump.c b/notmuch-dump.c +index 3743214..d8186fb 100644 +--- a/notmuch-dump.c ++++ b/notmuch-dump.c +@@ -44,7 +44,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) + int opt_index; + + notmuch_opt_desc_t options[] = { +- { NOTMUCH_OPT_POSITION, &output_file_name, 0, 0, 0 }, ++ { NOTMUCH_OPT_STRING, &output_file_name, "output", 'o', 0 }, + { 0, 0, 0, 0, 0 } + }; + +@@ -56,7 +56,6 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) + } + + if (output_file_name) { +- fprintf (stderr, "Warning: the output file argument of dump is deprecated.\n"); + output = fopen (output_file_name, "w"); + if (output == NULL) { + fprintf (stderr, "Error opening %s for writing: %s\n", +diff --git a/test/dump-restore b/test/dump-restore +index 439e998..c7801cf 100755 +--- a/test/dump-restore ++++ b/test/dump-restore +@@ -53,16 +53,12 @@ test_expect_success 'Restore with nothing to do, III' \ + test_expect_success 'Invalid restore invocation' \ + 'test_must_fail notmuch restore dump.expected another_one' + +-test_begin_subtest "dump outfile" +-notmuch dump dump-outfile.actual ++test_begin_subtest "dump --output=outfile" ++notmuch dump --output=dump-outfile.actual + test_expect_equal_file dump.expected dump-outfile.actual + +-test_begin_subtest "dump outfile # deprecated" +-test_expect_equal "Warning: the output file argument of dump is deprecated."\ +- "$(notmuch dump /dev/null 2>&1)" +- +-test_begin_subtest "dump outfile --" +-notmuch dump dump-1-arg-dash.actual -- ++test_begin_subtest "dump --output=outfile --" ++notmuch dump --output=dump-1-arg-dash.actual -- + test_expect_equal_file dump.expected dump-1-arg-dash.actual + + # Note, we assume all messages from cworth have a message-id +@@ -74,12 +70,12 @@ test_begin_subtest "dump -- from:cworth" + notmuch dump -- from:cworth > dump-dash-cworth.actual + test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual + +-test_begin_subtest "dump outfile from:cworth" +-notmuch dump dump-outfile-cworth.actual from:cworth ++test_begin_subtest "dump --output=outfile from:cworth" ++notmuch dump --output=dump-outfile-cworth.actual from:cworth + test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual + +-test_begin_subtest "dump outfile -- from:cworth" +-notmuch dump dump-outfile-dash-inbox.actual -- from:cworth ++test_begin_subtest "dump --output=outfile -- from:cworth" ++notmuch dump --output=dump-outfile-dash-inbox.actual -- from:cworth + test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual + + test_done +diff --git a/test/maildir-sync b/test/maildir-sync +index cd7d241..0914fa5 100755 +--- a/test/maildir-sync ++++ b/test/maildir-sync +@@ -124,7 +124,7 @@ mv $MAIL_DIR/cur/adding-replied-tag:2,RS $MAIL_DIR/cur/adding-replied-tag:2,S + mv $MAIL_DIR/cur/adding-s-flag:2,S $MAIL_DIR/cur/adding-s-flag:2, + mv $MAIL_DIR/cur/adding-with-s-flag:2,S $MAIL_DIR/cur/adding-with-s-flag:2,RS + mv $MAIL_DIR/cur/message-to-move-to-cur:2,S $MAIL_DIR/cur/message-to-move-to-cur:2,DS +-notmuch dump dump.txt ++notmuch dump --output=dump.txt + NOTMUCH_NEW >/dev/null + notmuch restore dump.txt + output=$(ls $MAIL_DIR/cur) +-- +1.7.10.4 + -- 2.26.2