2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-21 20:35:12 +00:00

Rename snapshot.Content -> snapshot.Tree

This commit is contained in:
Alexander Neumann 2014-12-07 14:14:07 +01:00
parent 73be0d5b18
commit 202984a93f
6 changed files with 9 additions and 9 deletions

View File

@ -384,7 +384,7 @@ func (arch *Archiver) LoadTree(path string, parentSnapshot backend.ID) (*Tree, e
return nil, arrar.Annotate(err, "load old snapshot")
}
if snapshot.Content == nil {
if snapshot.Tree == nil {
return nil, errors.New("snapshot without tree!")
}
@ -394,7 +394,7 @@ func (arch *Archiver) LoadTree(path string, parentSnapshot backend.ID) (*Tree, e
return nil, err
}
oldTree, err = LoadTree(arch.ch, snapshot.Content)
oldTree, err = LoadTree(arch.ch, snapshot.Tree)
if err != nil {
return nil, arrar.Annotate(err, "load old tree")
}
@ -520,7 +520,7 @@ func (arch *Archiver) Snapshot(dir string, t *Tree, parentSnapshot backend.ID) (
if err != nil {
return nil, nil, err
}
sn.Content = blob.ID
sn.Tree = blob.ID
// save bloblist
blob, err = arch.SaveJSON(backend.Map, arch.bl)

View File

@ -81,7 +81,7 @@ func fsck_snapshot(be backend.Server, key *restic.Key, id backend.ID) error {
return err
}
if sn.Content == nil {
if sn.Tree == nil {
return fmt.Errorf("snapshot %v has no content", sn.ID)
}
@ -89,7 +89,7 @@ func fsck_snapshot(be backend.Server, key *restic.Key, id backend.ID) error {
return fmt.Errorf("snapshot %v has no map", sn.ID)
}
return fsckTree(ch, sn.Content)
return fsckTree(ch, sn.Tree)
}
func commandFsck(be backend.Server, key *restic.Key, args []string) error {

View File

@ -74,5 +74,5 @@ func commandLs(be backend.Server, key *restic.Key, args []string) error {
fmt.Printf("snapshot of %s at %s:\n", sn.Dir, sn.Time)
return print_tree("", ch, sn.Content)
return print_tree("", ch, sn.Tree)
}

View File

@ -93,7 +93,7 @@ func (res *Restorer) RestoreTo(dir string) error {
return err
}
return res.to(dir, res.sn.Content)
return res.to(dir, res.sn.Tree)
}
func (res *Restorer) Snapshot() *Snapshot {

View File

@ -13,7 +13,7 @@ import (
type Snapshot struct {
Time time.Time `json:"time"`
Parent backend.ID `json:"parent,omitempty"`
Content backend.ID `json:"content"`
Tree backend.ID `json:"tree"`
Map backend.ID `json:"map"`
Dir string `json:"dir"`
Hostname string `json:"hostname,omitempty"`

View File

@ -11,7 +11,7 @@ import (
func testSnapshot(t *testing.T, be backend.Server) {
var err error
sn := restic.NewSnapshot("/home/foobar")
sn.Content, err = backend.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
sn.Tree, err = backend.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
ok(t, err)
sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00")
ok(t, err)