2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 04:45:15 +00:00

Rename field in Snapshot: Tree -> TreeID

This commit is contained in:
Alexander Neumann 2014-08-04 23:25:32 +02:00
parent 500f4f9997
commit b923a2065a
4 changed files with 5 additions and 5 deletions

View File

@ -125,7 +125,7 @@ func commandBackup(repo *khepri.Repository, args []string) error {
} }
sn := khepri.NewSnapshot(target) sn := khepri.NewSnapshot(target)
sn.Tree = id sn.TreeID = id
snid, err := sn.Save(repo) snid, err := sn.Save(repo)
if err != nil { if err != nil {

View File

@ -127,7 +127,7 @@ func commandRestore(repo *khepri.Repository, args []string) error {
log.Fatalf("error loading snapshot %s", id) log.Fatalf("error loading snapshot %s", id)
} }
err = restore_dir(repo, sn.Tree, target) err = restore_dir(repo, sn.TreeID, target)
if err != nil { if err != nil {
return err return err
} }

View File

@ -9,7 +9,7 @@ import (
type Snapshot struct { type Snapshot struct {
Time time.Time `json:"time"` Time time.Time `json:"time"`
Tree ID `json:"tree"` TreeID ID `json:"tree"`
Dir string `json:"dir"` Dir string `json:"dir"`
Hostname string `json:"hostname,omitempty"` Hostname string `json:"hostname,omitempty"`
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
@ -39,7 +39,7 @@ func NewSnapshot(dir string) *Snapshot {
} }
func (sn *Snapshot) Save(repo *Repository) (ID, error) { func (sn *Snapshot) Save(repo *Repository) (ID, error) {
if sn.Tree == nil { if sn.TreeID == nil {
panic("Snapshot.Save() called with nil tree id") panic("Snapshot.Save() called with nil tree id")
} }

View File

@ -17,7 +17,7 @@ func TestSnapshot(t *testing.T) {
}() }()
sn := khepri.NewSnapshot("/home/foobar") sn := khepri.NewSnapshot("/home/foobar")
sn.Tree, err = khepri.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2") sn.TreeID, err = khepri.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
ok(t, err) ok(t, err)
sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00") sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00")
ok(t, err) ok(t, err)