user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/5] more MH-related updates
@ 2024-01-31 10:20  7% Eric Wong
  2024-01-31 10:20  7% ` [PATCH 1/5] lei convert: explicitly allow --sort for inputs Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2024-01-31 10:20 UTC (permalink / raw)
  To: meta

MH can be for slrnpull (and presumably many other NNTP) spools,
too.  I'm thinking 5/5 is a nice quality-of-life improvement
since I didn't want to document --sort=sequence in all the
updated scripts/import_*

Eric Wong (5):
  lei convert: explicitly allow --sort for inputs
  import: drop redundant `use' statement
  scripts/slrnspool2maildir: use MHreader and LeiToMail
  scripts/import_*: update usage to include lei tips
  lei: sort MH inputs sequentially by default

 lib/PublicInbox/Import.pm     |  1 -
 lib/PublicInbox/LeiConvert.pm |  1 +
 lib/PublicInbox/LeiInput.pm   |  2 +-
 lib/PublicInbox/LeiToMail.pm  |  2 +
 lib/PublicInbox/MHreader.pm   |  3 +-
 scripts/import_maildir        | 20 +++++---
 scripts/import_slrnspool      | 26 ++++++----
 scripts/import_vger_from_mbox |  6 +--
 scripts/slrnspool2maildir     | 90 ++++++++++++++++++-----------------
 t/mh_reader.t                 | 15 +++++-
 10 files changed, 102 insertions(+), 64 deletions(-)

^ permalink raw reply	[relevance 7%]

* [PATCH 1/5] lei convert: explicitly allow --sort for inputs
  2024-01-31 10:20  7% [PATCH 0/5] more MH-related updates Eric Wong
@ 2024-01-31 10:20  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2024-01-31 10:20 UTC (permalink / raw)
  To: meta

LeiToMail can't sort v2 output, but sorting MH input (and
NNTP spool + mlmmj archives) numerically makes sense.
---
 lib/PublicInbox/LeiConvert.pm | 1 +
 lib/PublicInbox/LeiToMail.pm  | 2 ++
 t/mh_reader.t                 | 9 ++++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiConvert.pm b/lib/PublicInbox/LeiConvert.pm
index 17a952f2..4d4fceb2 100644
--- a/lib/PublicInbox/LeiConvert.pm
+++ b/lib/PublicInbox/LeiConvert.pm
@@ -52,6 +52,7 @@ sub lei_convert { # the main "lei convert" method
 	my ($lei, @inputs) = @_;
 	$lei->{opt}->{kw} //= 1;
 	$lei->{opt}->{dedupe} //= 'none';
+	$lei->{input_opt}->{sort} = 1; # for LeiToMail conflict check
 	my $self = bless {}, __PACKAGE__;
 	my $ovv = PublicInbox::LeiOverview->new($lei, 'out-format');
 	$lei->{l2m} or return
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 9197bb44..a816df6c 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -451,6 +451,8 @@ EOM
 		(-d $dst || (-e _ && !-w _)) and die
 			"$dst exists and is not a writable file\n";
 	}
+	$lei->{input_opt} and # lei_convert sets this
+		@conflict = grep { !$lei->{input_opt}->{$_} } @conflict;
 	my @err = map { defined($lei->{opt}->{$_}) ? "--$_" : () } @conflict;
 	die "@err incompatible with $fmt\n" if @err;
 	$self->{dst} = $dst;
diff --git a/t/mh_reader.t b/t/mh_reader.t
index e8f69fa8..711fc8aa 100644
--- a/t/mh_reader.t
+++ b/t/mh_reader.t
@@ -101,7 +101,14 @@ test_lei(sub {
 	lei_ok qw(index), 'mh:'.$stale;
 	lei qw(q -f mboxrd), 's:msg 4';
 	like $lei_out, qr/^Subject: msg 4\nStatus: RO\n\n\n/ms,
-		"message retrieved after `lei index'"
+		"message retrieved after `lei index'";
+
+	# ensure sort works for _input_ when output disallows sort
+	my $v2out = "$ENV{HOME}/v2-out";
+	lei_ok qw(convert -s sequence), "mh:$for_sort", '-o', "v2:$v2out";
+	my $git = PublicInbox::Git->new("$v2out/git/0.git");
+	chomp(my @l = $git->qx(qw(log --pretty=oneline --format=%s)));
+	is_xdeeply \@l, [1, 22, 333], 'sequence order preserved for v2';
 });
 
 done_testing;

^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2024-01-31 10:20  7% [PATCH 0/5] more MH-related updates Eric Wong
2024-01-31 10:20  7% ` [PATCH 1/5] lei convert: explicitly allow --sort for inputs Eric Wong

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

	https://80x24.org/public-inbox.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).