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)