Insist on having an index, and report an error (with a suggestion to
run "bup index") if one isn't found.
Previously (at least as recently as 0.25-rc1), bup save would just
create an empty tree if there was no index. The metadata work
unintentionally broke that behavior.
For now, treat a missing index as an error under the assumption that
it's not likely to be intentional. If a good use case for the
previous behavior is presented, we can always restore it.
Signed-off-by: Jean-Baptiste Denis <jbd@jbdenis.net>
[rlb@defaultvalue.org: adjust commit message and save-cmd.py error message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
indexfile = opt.indexfile or git.repo('bupindex')
r = index.Reader(indexfile)
+if not os.access(indexfile + '.meta', os.W_OK|os.R_OK):
+ log('error: cannot access "%s"; have you run bup index?' % indexfile)
+ sys.exit(1)
msr = index.MetaStoreReader(indexfile + '.meta')
hlink_db = hlinkdb.HLinkDB(indexfile + '.hlink')