unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Remove positional arguments to dump and restore
@ 2012-08-04  2:23 david
  2012-08-04  2:23 ` [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file david
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: david @ 2012-08-04  2:23 UTC (permalink / raw)
  To: notmuch


The positional argument to dump was deprecated quite a while ago. For
restore, we never formally deprecated it. It seems a bit more
consistent this way, but I don't mind leaving restore alone if people
feel strongly about it.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file
  2012-08-04  2:23 Remove positional arguments to dump and restore david
@ 2012-08-04  2:23 ` david
  2012-08-06 12:09   ` David Bremner
  2012-08-04  2:23 ` [PATCH 2/2] notmuch-restore: replace positional argument for input with option david
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: david @ 2012-08-04  2:23 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] notmuch-restore: replace positional argument for input with option
  2012-08-04  2:23 Remove positional arguments to dump and restore david
  2012-08-04  2:23 ` [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file david
@ 2012-08-04  2:23 ` david
  2012-08-04 12:55   ` [PATCH v2] " David Bremner
  2012-08-04 18:14 ` Remove positional arguments to dump and restore Jameson Graef Rollins
  2012-08-04 23:20 ` Tomi Ollila
  3 siblings, 1 reply; 8+ messages in thread
From: david @ 2012-08-04  2:23 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

Since notmuch dump doesn't use positional arguments anymore, it seems
better to be consistent.
---
 man/man1/notmuch-restore.1 |    2 +-
 notmuch-restore.c          |    2 +-
 test/dump-restore          |    8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/man/man1/notmuch-restore.1 b/man/man1/notmuch-restore.1
index 18281c7..d0d50dd 100644
--- a/man/man1/notmuch-restore.1
+++ b/man/man1/notmuch-restore.1
@@ -6,7 +6,7 @@ notmuch-restore \- restores the tags from the given file (see notmuch dump)
 
 .B "notmuch restore"
 .RB [ "--accumulate" ]
-.RI "[ <" filename "> ]"
+.RI "[ --input=<" filename "> ]"
 
 .SH DESCRIPTION
 
diff --git a/notmuch-restore.c b/notmuch-restore.c
index 4f4096e..08d5adc 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -122,7 +122,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
     synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
 
     notmuch_opt_desc_t options[] = {
-	{ NOTMUCH_OPT_POSITION, &input_file_name, 0, 0, 0 },
+	{ NOTMUCH_OPT_STRING, &input_file_name, "input", 'i', 0 },
 	{ NOTMUCH_OPT_BOOLEAN,  &accumulate, "accumulate", 'a', 0 },
 	{ 0, 0, 0, 0, 0 }
     };
diff --git a/test/dump-restore b/test/dump-restore
index c7801cf..f25f7cf 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -19,7 +19,7 @@ test_expect_success 'Dumping all tags II' \
 
 test_expect_success 'Clearing all tags' \
   'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
-  notmuch restore clear.expected &&
+  notmuch restore --input=clear.expected &&
   notmuch dump > clear.actual &&
   test_cmp clear.expected clear.actual'
 
@@ -30,7 +30,7 @@ test_expect_success 'Accumulate original tags' \
   test_cmp dump-ABC_DEF.expected dump.actual'
 
 test_expect_success 'Restoring original tags' \
-  'notmuch restore dump.expected &&
+  'notmuch restore --input=dump.expected &&
   notmuch dump > dump.actual &&
   test_cmp dump.expected dump.actual'
 
@@ -40,7 +40,7 @@ test_expect_success 'Restore with nothing to do' \
   test_cmp dump.expected dump.actual'
 
 test_expect_success 'Restore with nothing to do, II' \
-  'notmuch restore --accumulate dump.expected &&
+  'notmuch restore --accumulate --input=dump.expected &&
   notmuch dump > dump.actual &&
   test_cmp dump.expected dump.actual'
 
@@ -51,7 +51,7 @@ test_expect_success 'Restore with nothing to do, III' \
 
 # notmuch restore currently only considers the first argument.
 test_expect_success 'Invalid restore invocation' \
-  'test_must_fail notmuch restore dump.expected another_one'
+  'test_must_fail notmuch restore --input=dump.expected another_one'
 
 test_begin_subtest "dump --output=outfile"
 notmuch dump --output=dump-outfile.actual
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2] notmuch-restore: replace positional argument for input with option
  2012-08-04  2:23 ` [PATCH 2/2] notmuch-restore: replace positional argument for input with option david
@ 2012-08-04 12:55   ` David Bremner
  2012-08-05 15:05     ` [PATCH] NEWS: discuss changes for dump and restore syntax david
  0 siblings, 1 reply; 8+ messages in thread
From: David Bremner @ 2012-08-04 12:55 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

Since notmuch dump doesn't use positional arguments anymore, it seems
better to be consistent.
---

dunno how I missed the failing test in maildir-sync

 man/man1/notmuch-restore.1 |    2 +-
 notmuch-restore.c          |    2 +-
 test/dump-restore          |    8 ++++----
 test/maildir-sync          |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/man/man1/notmuch-restore.1 b/man/man1/notmuch-restore.1
index 18281c7..d0d50dd 100644
--- a/man/man1/notmuch-restore.1
+++ b/man/man1/notmuch-restore.1
@@ -6,7 +6,7 @@ notmuch-restore \- restores the tags from the given file (see notmuch dump)
 
 .B "notmuch restore"
 .RB [ "--accumulate" ]
-.RI "[ <" filename "> ]"
+.RI "[ --input=<" filename "> ]"
 
 .SH DESCRIPTION
 
diff --git a/notmuch-restore.c b/notmuch-restore.c
index 4f4096e..08d5adc 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -122,7 +122,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
     synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
 
     notmuch_opt_desc_t options[] = {
-	{ NOTMUCH_OPT_POSITION, &input_file_name, 0, 0, 0 },
+	{ NOTMUCH_OPT_STRING, &input_file_name, "input", 'i', 0 },
 	{ NOTMUCH_OPT_BOOLEAN,  &accumulate, "accumulate", 'a', 0 },
 	{ 0, 0, 0, 0, 0 }
     };
diff --git a/test/dump-restore b/test/dump-restore
index c7801cf..f25f7cf 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -19,7 +19,7 @@ test_expect_success 'Dumping all tags II' \
 
 test_expect_success 'Clearing all tags' \
   'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
-  notmuch restore clear.expected &&
+  notmuch restore --input=clear.expected &&
   notmuch dump > clear.actual &&
   test_cmp clear.expected clear.actual'
 
@@ -30,7 +30,7 @@ test_expect_success 'Accumulate original tags' \
   test_cmp dump-ABC_DEF.expected dump.actual'
 
 test_expect_success 'Restoring original tags' \
-  'notmuch restore dump.expected &&
+  'notmuch restore --input=dump.expected &&
   notmuch dump > dump.actual &&
   test_cmp dump.expected dump.actual'
 
@@ -40,7 +40,7 @@ test_expect_success 'Restore with nothing to do' \
   test_cmp dump.expected dump.actual'
 
 test_expect_success 'Restore with nothing to do, II' \
-  'notmuch restore --accumulate dump.expected &&
+  'notmuch restore --accumulate --input=dump.expected &&
   notmuch dump > dump.actual &&
   test_cmp dump.expected dump.actual'
 
@@ -51,7 +51,7 @@ test_expect_success 'Restore with nothing to do, III' \
 
 # notmuch restore currently only considers the first argument.
 test_expect_success 'Invalid restore invocation' \
-  'test_must_fail notmuch restore dump.expected another_one'
+  'test_must_fail notmuch restore --input=dump.expected another_one'
 
 test_begin_subtest "dump --output=outfile"
 notmuch dump --output=dump-outfile.actual
diff --git a/test/maildir-sync b/test/maildir-sync
index 0914fa5..0fc742a 100755
--- a/test/maildir-sync
+++ b/test/maildir-sync
@@ -126,7 +126,7 @@ 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 --output=dump.txt
 NOTMUCH_NEW >/dev/null
-notmuch restore dump.txt
+notmuch restore --input=dump.txt
 output=$(ls $MAIL_DIR/cur)
 test_expect_equal "$output" "$expected"
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Remove positional arguments to dump and restore
  2012-08-04  2:23 Remove positional arguments to dump and restore david
  2012-08-04  2:23 ` [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file david
  2012-08-04  2:23 ` [PATCH 2/2] notmuch-restore: replace positional argument for input with option david
@ 2012-08-04 18:14 ` Jameson Graef Rollins
  2012-08-04 23:20 ` Tomi Ollila
  3 siblings, 0 replies; 8+ messages in thread
From: Jameson Graef Rollins @ 2012-08-04 18:14 UTC (permalink / raw)
  To: david, notmuch

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

On Fri, Aug 03 2012, david@tethera.net wrote:
> The positional argument to dump was deprecated quite a while ago. For
> restore, we never formally deprecated it. It seems a bit more
> consistent this way, but I don't mind leaving restore alone if people
> feel strongly about it.

LGTM.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Remove positional arguments to dump and restore
  2012-08-04  2:23 Remove positional arguments to dump and restore david
                   ` (2 preceding siblings ...)
  2012-08-04 18:14 ` Remove positional arguments to dump and restore Jameson Graef Rollins
@ 2012-08-04 23:20 ` Tomi Ollila
  3 siblings, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2012-08-04 23:20 UTC (permalink / raw)
  To: david, notmuch

On Sat, Aug 04 2012, david@tethera.net wrote:

> The positional argument to dump was deprecated quite a while ago. For
> restore, we never formally deprecated it. It seems a bit more
> consistent this way, but I don't mind leaving restore alone if people
> feel strongly about it.


LGTM.

Tomi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] NEWS: discuss changes for dump and restore syntax.
  2012-08-04 12:55   ` [PATCH v2] " David Bremner
@ 2012-08-05 15:05     ` david
  0 siblings, 0 replies; 8+ messages in thread
From: david @ 2012-08-05 15:05 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

The duplication in NEWS.Debian is so that Debian users will be warned
during upgrade.
---
 NEWS               |   10 ++++++++++
 debian/NEWS.Debian |   14 ++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/NEWS b/NEWS
index 7b1f36c..761b2c1 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,16 @@ Maildir tag synchronization
   messages (typically causing new messages to not receive the "unread"
   tag).
 
+Command-Line Interface
+----------------------
+
+  The deprecated positional output file argument to `notmuch dump` has
+  been replaced with an `--output` option. The input file positional
+  argument to `notmuch restore` has been replaced with an `--input`
+  option for consistency with dump.  These changes simplify the syntax
+  of dump/restore options and make them more consistent with other
+  notmuch commands.
+
 Emacs Interface
 ---------------
 
diff --git a/debian/NEWS.Debian b/debian/NEWS.Debian
index 6947754..bf95738 100644
--- a/debian/NEWS.Debian
+++ b/debian/NEWS.Debian
@@ -1,3 +1,17 @@
+notmuch (0.14-1) unstable; urgency=low
+
+  There is an incompatible change in option syntax for dump and restore
+  in this release. Please update your scripts.
+
+  From upstream NEWS:
+
+  The deprecated positional output file argument to notmuch dump has
+  been replaced with an --output option. The input file positional
+  argument for restore has been replaced with an --input option for
+  consistency with dump.
+
+ -- David Bremner <bremner@debian.org>  Sun, 05 Aug 2012 11:52:49 -0300
+
 notmuch (0.6~238) unstable; urgency=low
 
   The emacs user interface to notmuch is now contained in a seperate
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file
  2012-08-04  2:23 ` [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file david
@ 2012-08-06 12:09   ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2012-08-06 12:09 UTC (permalink / raw)
  To: notmuch

david@tethera.net writes:

> From: David Bremner <bremner@debian.org>
>
> 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.

I pushed these three patches. Let the angry howls from people running
production systems on automatic builds of notmuch master begin ;).

d

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-06 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-04  2:23 Remove positional arguments to dump and restore david
2012-08-04  2:23 ` [PATCH 1/2] notmuch-dump: remove deprecated positional argument for output file david
2012-08-06 12:09   ` David Bremner
2012-08-04  2:23 ` [PATCH 2/2] notmuch-restore: replace positional argument for input with option david
2012-08-04 12:55   ` [PATCH v2] " David Bremner
2012-08-05 15:05     ` [PATCH] NEWS: discuss changes for dump and restore syntax david
2012-08-04 18:14 ` Remove positional arguments to dump and restore Jameson Graef Rollins
2012-08-04 23:20 ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).