Add multi-repository support to protocol (ref #35)

This commit is contained in:
Jakob Borg
2014-02-13 12:41:25 +01:00
parent 9f63feef30
commit 21a7f3960a
10 changed files with 104 additions and 59 deletions

View File

@@ -496,7 +496,7 @@ func saveIndex(m *Model) {
gzw := gzip.NewWriter(idxf)
protocol.WriteIndex(gzw, m.ProtocolIndex())
protocol.WriteIndex(gzw, "local", m.ProtocolIndex())
gzw.Close()
idxf.Close()
os.Rename(fullName+".tmp", fullName)
@@ -516,8 +516,8 @@ func loadIndex(m *Model) {
}
defer gzr.Close()
idx, err := protocol.ReadIndex(gzr)
if err != nil {
repo, idx, err := protocol.ReadIndex(gzr)
if repo != "local" || err != nil {
return
}
m.SeedLocal(idx)