2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Optimize 'cat' and 'snapshots' commands

This commit is contained in:
Alexander Neumann 2014-12-21 17:29:37 +01:00
parent 5eaa427e80
commit 0e1045301a
2 changed files with 11 additions and 6 deletions

View File

@ -58,13 +58,13 @@ func (cmd CmdCat) Execute(args []string) error {
return err
}
switch tpe {
case "blob":
err = ch.LoadAllMaps()
if err != nil {
return err
}
switch tpe {
case "blob":
// try id
data, err := ch.Load(backend.Data, id)
if err == nil {
@ -88,6 +88,11 @@ func (cmd CmdCat) Execute(args []string) error {
return err
case "tree":
err = ch.LoadAllMaps()
if err != nil {
return err
}
var tree restic.Tree
// try id
err := ch.LoadJSON(backend.Tree, id, &tree)

View File

@ -108,7 +108,7 @@ func (cmd CmdSnapshots) Execute(args []string) error {
list := []*restic.Snapshot{}
backend.EachID(be, backend.Snapshot, func(id backend.ID) {
sn, err := ch.LoadSnapshot(id)
sn, err := restic.LoadSnapshot(ch, id)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading snapshot %s: %v\n", id, err)
return