about summary refs log tree commit homepage
path: root/script/public-inbox-convert
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-07 03:41:52 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-07 03:42:28 +0000
commit42c485400522c7c255f6da11391526cb1bc5931b (patch)
treeef3c0256fe0ee4182aef735fcd608c63646ebc73 /script/public-inbox-convert
parent768b3d926e92c4df2274b0167613574eae808f0d (diff)
downloadpublic-inbox-42c485400522c7c255f6da11391526cb1bc5931b.tar.gz
public-inbox-convert ought to be 100% lossless, now
Diffstat (limited to 'script/public-inbox-convert')
-rwxr-xr-xscript/public-inbox-convert11
1 files changed, 10 insertions, 1 deletions
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 9aa27814..2742be79 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);