From 202984a93f247b3dd034894f23050393d1cb925e Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 7 Dec 2014 14:14:07 +0100 Subject: [PATCH] Rename snapshot.Content -> snapshot.Tree --- archiver.go | 6 +++--- cmd/restic/cmd_fsck.go | 4 ++-- cmd/restic/cmd_ls.go | 2 +- restorer.go | 2 +- snapshot.go | 2 +- snapshot_test.go | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/archiver.go b/archiver.go index fb55be812..06037183c 100644 --- a/archiver.go +++ b/archiver.go @@ -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) diff --git a/cmd/restic/cmd_fsck.go b/cmd/restic/cmd_fsck.go index ac21987d6..0a37a31c1 100644 --- a/cmd/restic/cmd_fsck.go +++ b/cmd/restic/cmd_fsck.go @@ -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 { diff --git a/cmd/restic/cmd_ls.go b/cmd/restic/cmd_ls.go index 829bef756..ef3c4d1f6 100644 --- a/cmd/restic/cmd_ls.go +++ b/cmd/restic/cmd_ls.go @@ -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) } diff --git a/restorer.go b/restorer.go index 329dd09c1..83dd18da3 100644 --- a/restorer.go +++ b/restorer.go @@ -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 { diff --git a/snapshot.go b/snapshot.go index bdc2bca61..ddda498b4 100644 --- a/snapshot.go +++ b/snapshot.go @@ -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"` diff --git a/snapshot_test.go b/snapshot_test.go index 62b624361..a2c0d0958 100644 --- a/snapshot_test.go +++ b/snapshot_test.go @@ -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)