2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-24 21:57:41 +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.Tree = id
sn.TreeID = id
snid, err := sn.Save(repo)
if err != nil {

View File

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

View File

@ -9,7 +9,7 @@ import (
type Snapshot struct {
Time time.Time `json:"time"`
Tree ID `json:"tree"`
TreeID ID `json:"tree"`
Dir string `json:"dir"`
Hostname string `json:"hostname,omitempty"`
Username string `json:"username,omitempty"`
@ -39,7 +39,7 @@ func NewSnapshot(dir string) *Snapshot {
}
func (sn *Snapshot) Save(repo *Repository) (ID, error) {
if sn.Tree == nil {
if sn.TreeID == nil {
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.Tree, err = khepri.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
sn.TreeID, err = khepri.ParseID("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2")
ok(t, err)
sn.Time, err = time.Parse(time.RFC3339Nano, "2014-08-03T17:49:05.378595539+02:00")
ok(t, err)