From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id F36861F519 for ; Sat, 7 Apr 2018 03:41:55 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 6/8] convert: support converting with altid defined Date: Sat, 7 Apr 2018 03:41:52 +0000 Message-Id: <20180407034154.2309-7-e@80x24.org> In-Reply-To: <20180407034154.2309-1-e@80x24.org> References: <20180407034154.2309-1-e@80x24.org> List-Id: public-inbox-convert ought to be 100% lossless, now --- script/public-inbox-convert | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 9aa2781..2742be7 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -45,7 +45,6 @@ if (($old->{version} || 1) >= 2) { die "Only conversion from v1 inboxes is supported\n"; } my $new = { %$old }; -delete $new->{altid}; # TODO: support altid for v2 $new->{mainrepo} = abs_path($new_dir); $new->{version} = 2; $new = PublicInbox::InboxWritable->new($new); @@ -61,6 +60,16 @@ $old->with_umask(sub { "--file=$new->{mainrepo}/all.git/config", 'core.sharedRepository', $sr]); } + if (my $alt = $new->{altid}) { + require PublicInbox::AltId; + foreach my $i (0..$#$alt) { + my $src = PublicInbox::AltId->new($old, $alt->[$i], 0); + $src->mm_alt or next; + my $dst = PublicInbox::AltId->new($new, $alt->[$i], 1); + $dst = $dst->{filename}; + $src->mm_alt->{dbh}->sqlite_backup_to_file($dst); + } + } }); my $state = ''; my ($prev, $from); -- EW