commit 0df2e14fa7cf13189060a098821c209347615875
parent c8f9f9d1bf408bf39f4b10682219cf2b129d3248
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Tue, 25 May 2010 20:38:37 -0700
Merge branch 'maildir' into next
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/bin/sup-dump b/bin/sup-dump
@@ -15,8 +15,6 @@ later use sup-sync --restored --restore <filename> to recover the index.
This tool is primarily useful in the event that a Sup upgrade breaks index
format compatibility.
-This sup-dump supports index versions 0 through 4.
-
Usage:
sup-dump > <filename>
sup-dump | bzip2 > <filename> # even better
@@ -24,15 +22,15 @@ EOS
end
xapian = Xapian::Database.new File.join(BASE_DIR, 'xapian')
-db_version = xapian.get_metadata 'version'
-db_version = '0' if db_version.empty?
+version = xapian.get_metadata 'rescue-version'
+version = '0' if version.empty?
-case db_version
-when '0', '1', '2', '3', '4'
+case version
+when '0'
xapian.postlist('Kmail').each do |x|
entry = Marshal.load(xapian.document(x.docid).data)
puts "#{entry[:message_id]} (#{entry[:labels].sort_by { |l| l.to_s } * ' '})"
end
else
- abort "unknown index version #{db_version.inspect}"
+ abort "this sup-dump version doesn't understand your index"
end
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -109,11 +109,12 @@ EOS
info "Upgrading index format #{db_version} to #{INDEX_VERSION}"
@xapian.set_metadata 'version', INDEX_VERSION
elsif db_version != INDEX_VERSION
- fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please downgrade to your previous version and dump your labels before upgrading to this version (then run sup-sync --restore)."
+ fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please run sup-dump to save your labels, move #{SUP_BASE}/xapian out of the way, and run sup-sync --restore."
end
else
@xapian = Xapian::WritableDatabase.new(path, Xapian::DB_CREATE)
@xapian.set_metadata 'version', INDEX_VERSION
+ @xapian.set_metadata 'rescue-version', '0'
end
@enquire = Xapian::Enquire.new @xapian
@enquire.weighting_scheme = Xapian::BoolWeight.new