[PATCH v2] notmuch-restore: replace positional argument for input with option
authorDavid Bremner <david@tethera.net>
Sat, 4 Aug 2012 12:55:45 +0000 (09:55 +2100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:50 +0000 (09:48 -0800)
21/2133834db59875a77a96f23403eaaa2419aa07 [new file with mode: 0644]

diff --git a/21/2133834db59875a77a96f23403eaaa2419aa07 b/21/2133834db59875a77a96f23403eaaa2419aa07
new file mode 100644 (file)
index 0000000..a39981b
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <bremner@tethera.net>\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 E382D431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  4 Aug 2012 05:56:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       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 eeV6mxrShlim for <notmuch@notmuchmail.org>;\r
+       Sat,  4 Aug 2012 05:56:06 -0700 (PDT)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 5C8B7431FAE\r
+       for <notmuch@notmuchmail.org>; Sat,  4 Aug 2012 05:56:06 -0700 (PDT)\r
+Received: from fctnnbsc30w-156034089108.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+       ([156.34.89.108] helo=zancas.localnet)\r
+       by tesseract.cs.unb.ca with esmtpsa\r
+       (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1Sxdti-0005Sw-UF; Sat, 04 Aug 2012 09:56:03 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+       (envelope-from <bremner@tethera.net>)\r
+       id 1Sxdtd-00070c-I3; Sat, 04 Aug 2012 09:55:57 -0300\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] notmuch-restore: replace positional argument for input\r
+       with option\r
+Date: Sat,  4 Aug 2012 09:55:45 -0300\r
+Message-Id: <1344084945-26825-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1344046992-25976-3-git-send-email-david@tethera.net>\r
+References: <1344046992-25976-3-git-send-email-david@tethera.net>\r
+X-Spam_bar: -\r
+Cc: David Bremner <bremner@debian.org>\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: Sat, 04 Aug 2012 12:56:07 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+Since notmuch dump doesn't use positional arguments anymore, it seems\r
+better to be consistent.\r
+---\r
+\r
+dunno how I missed the failing test in maildir-sync\r
+\r
+ man/man1/notmuch-restore.1 |    2 +-\r
+ notmuch-restore.c          |    2 +-\r
+ test/dump-restore          |    8 ++++----\r
+ test/maildir-sync          |    2 +-\r
+ 4 files changed, 7 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/man/man1/notmuch-restore.1 b/man/man1/notmuch-restore.1\r
+index 18281c7..d0d50dd 100644\r
+--- a/man/man1/notmuch-restore.1\r
++++ b/man/man1/notmuch-restore.1\r
+@@ -6,7 +6,7 @@ notmuch-restore \- restores the tags from the given file (see notmuch dump)\r
\r
+ .B "notmuch restore"\r
+ .RB [ "--accumulate" ]\r
+-.RI "[ <" filename "> ]"\r
++.RI "[ --input=<" filename "> ]"\r
\r
+ .SH DESCRIPTION\r
\r
+diff --git a/notmuch-restore.c b/notmuch-restore.c\r
+index 4f4096e..08d5adc 100644\r
+--- a/notmuch-restore.c\r
++++ b/notmuch-restore.c\r
+@@ -122,7 +122,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
+     synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);\r
\r
+     notmuch_opt_desc_t options[] = {\r
+-      { NOTMUCH_OPT_POSITION, &input_file_name, 0, 0, 0 },\r
++      { NOTMUCH_OPT_STRING, &input_file_name, "input", 'i', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN,  &accumulate, "accumulate", 'a', 0 },\r
+       { 0, 0, 0, 0, 0 }\r
+     };\r
+diff --git a/test/dump-restore b/test/dump-restore\r
+index c7801cf..f25f7cf 100755\r
+--- a/test/dump-restore\r
++++ b/test/dump-restore\r
+@@ -19,7 +19,7 @@ test_expect_success 'Dumping all tags II' \\r
\r
+ test_expect_success 'Clearing all tags' \\r
+   'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&\r
+-  notmuch restore clear.expected &&\r
++  notmuch restore --input=clear.expected &&\r
+   notmuch dump > clear.actual &&\r
+   test_cmp clear.expected clear.actual'\r
\r
+@@ -30,7 +30,7 @@ test_expect_success 'Accumulate original tags' \\r
+   test_cmp dump-ABC_DEF.expected dump.actual'\r
\r
+ test_expect_success 'Restoring original tags' \\r
+-  'notmuch restore dump.expected &&\r
++  'notmuch restore --input=dump.expected &&\r
+   notmuch dump > dump.actual &&\r
+   test_cmp dump.expected dump.actual'\r
\r
+@@ -40,7 +40,7 @@ test_expect_success 'Restore with nothing to do' \\r
+   test_cmp dump.expected dump.actual'\r
\r
+ test_expect_success 'Restore with nothing to do, II' \\r
+-  'notmuch restore --accumulate dump.expected &&\r
++  'notmuch restore --accumulate --input=dump.expected &&\r
+   notmuch dump > dump.actual &&\r
+   test_cmp dump.expected dump.actual'\r
\r
+@@ -51,7 +51,7 @@ test_expect_success 'Restore with nothing to do, III' \\r
\r
+ # notmuch restore currently only considers the first argument.\r
+ test_expect_success 'Invalid restore invocation' \\r
+-  'test_must_fail notmuch restore dump.expected another_one'\r
++  'test_must_fail notmuch restore --input=dump.expected another_one'\r
\r
+ test_begin_subtest "dump --output=outfile"\r
+ notmuch dump --output=dump-outfile.actual\r
+diff --git a/test/maildir-sync b/test/maildir-sync\r
+index 0914fa5..0fc742a 100755\r
+--- a/test/maildir-sync\r
++++ b/test/maildir-sync\r
+@@ -126,7 +126,7 @@ mv $MAIL_DIR/cur/adding-with-s-flag:2,S $MAIL_DIR/cur/adding-with-s-flag:2,RS\r
+ mv $MAIL_DIR/cur/message-to-move-to-cur:2,S $MAIL_DIR/cur/message-to-move-to-cur:2,DS\r
+ notmuch dump --output=dump.txt\r
+ NOTMUCH_NEW >/dev/null\r
+-notmuch restore dump.txt\r
++notmuch restore --input=dump.txt\r
+ output=$(ls $MAIL_DIR/cur)\r
+ test_expect_equal "$output" "$expected"\r
\r
+-- \r
+1.7.10.4\r
+\r