Rename variables

This commit is contained in:
Alexander Neumann
2015-05-09 13:32:52 +02:00
parent 7ec674f3e8
commit d9b5832034
18 changed files with 144 additions and 144 deletions

View File

@@ -59,9 +59,9 @@ func parseTime(str string) (time.Time, error) {
return time.Time{}, fmt.Errorf("unable to parse time: %q", str)
}
func (c CmdFind) findInTree(s *repo.Repository, id backend.ID, path string) ([]findResult, error) {
func (c CmdFind) findInTree(repo *repo.Repository, id backend.ID, path string) ([]findResult, error) {
debug.Log("restic.find", "checking tree %v\n", id)
tree, err := restic.LoadTree(s, id)
tree, err := restic.LoadTree(repo, id)
if err != nil {
return nil, err
}
@@ -93,7 +93,7 @@ func (c CmdFind) findInTree(s *repo.Repository, id backend.ID, path string) ([]f
}
if node.Type == "dir" {
subdirResults, err := c.findInTree(s, id, filepath.Join(path, node.Name))
subdirResults, err := c.findInTree(repo, id, filepath.Join(path, node.Name))
if err != nil {
return nil, err
}
@@ -105,7 +105,7 @@ func (c CmdFind) findInTree(s *repo.Repository, id backend.ID, path string) ([]f
return results, nil
}
func (c CmdFind) findInSnapshot(s *repo.Repository, name string) error {
func (c CmdFind) findInSnapshot(repo *repo.Repository, name string) error {
debug.Log("restic.find", "searching in snapshot %s\n for entries within [%s %s]", name, c.oldest, c.newest)
id, err := backend.ParseID(name)
@@ -113,12 +113,12 @@ func (c CmdFind) findInSnapshot(s *repo.Repository, name string) error {
return err
}
sn, err := restic.LoadSnapshot(s, id)
sn, err := restic.LoadSnapshot(repo, id)
if err != nil {
return err
}
results, err := c.findInTree(s, sn.Tree, "")
results, err := c.findInTree(repo, sn.Tree, "")
if err != nil {
return err
}

View File

@@ -34,7 +34,7 @@ func init() {
}
}
func fsckFile(opts CmdFsck, s *repo.Repository, IDs []backend.ID) (uint64, error) {
func fsckFile(opts CmdFsck, repo *repo.Repository, IDs []backend.ID) (uint64, error) {
debug.Log("restic.fsckFile", "checking file %v", IDs)
var bytes uint64
@@ -42,7 +42,7 @@ func fsckFile(opts CmdFsck, s *repo.Repository, IDs []backend.ID) (uint64, error
debug.Log("restic.fsck", " checking data blob %v\n", id)
// test if blob is in the index
packID, tpe, _, length, err := s.Index().Lookup(id)
packID, tpe, _, length, err := repo.Index().Lookup(id)
if err != nil {
return 0, fmt.Errorf("storage for blob %v (%v) not found", id, tpe)
}
@@ -52,13 +52,13 @@ func fsckFile(opts CmdFsck, s *repo.Repository, IDs []backend.ID) (uint64, error
if opts.CheckData {
// load content
_, err := s.LoadBlob(pack.Data, id)
_, err := repo.LoadBlob(pack.Data, id)
if err != nil {
return 0, err
}
} else {
// test if data blob is there
ok, err := s.Test(backend.Data, packID.String())
ok, err := repo.Test(backend.Data, packID.String())
if err != nil {
return 0, err
}
@@ -77,10 +77,10 @@ func fsckFile(opts CmdFsck, s *repo.Repository, IDs []backend.ID) (uint64, error
return bytes, nil
}
func fsckTree(opts CmdFsck, s *repo.Repository, id backend.ID) error {
func fsckTree(opts CmdFsck, repo *repo.Repository, id backend.ID) error {
debug.Log("restic.fsckTree", "checking tree %v", id.Str())
tree, err := restic.LoadTree(s, id)
tree, err := restic.LoadTree(repo, id)
if err != nil {
return err
}
@@ -122,7 +122,7 @@ func fsckTree(opts CmdFsck, s *repo.Repository, id backend.ID) error {
}
debug.Log("restic.fsckTree", "check file %v (%v)", node.Name, id.Str())
bytes, err := fsckFile(opts, s, node.Content)
bytes, err := fsckFile(opts, repo, node.Content)
if err != nil {
return err
}
@@ -139,7 +139,7 @@ func fsckTree(opts CmdFsck, s *repo.Repository, id backend.ID) error {
// record id
seenIDs.Insert(node.Subtree)
err = fsckTree(opts, s, node.Subtree)
err = fsckTree(opts, repo, node.Subtree)
if err != nil {
firstErr = err
fmt.Fprintf(os.Stderr, "%v\n", err)
@@ -157,15 +157,15 @@ func fsckTree(opts CmdFsck, s *repo.Repository, id backend.ID) error {
return firstErr
}
func fsckSnapshot(opts CmdFsck, s *repo.Repository, id backend.ID) error {
func fsckSnapshot(opts CmdFsck, repo *repo.Repository, id backend.ID) error {
debug.Log("restic.fsck", "checking snapshot %v\n", id)
sn, err := restic.LoadSnapshot(s, id)
sn, err := restic.LoadSnapshot(repo, id)
if err != nil {
return fmt.Errorf("loading snapshot %v failed: %v", id, err)
}
err = fsckTree(opts, s, sn.Tree)
err = fsckTree(opts, repo, sn.Tree)
if err != nil {
debug.Log("restic.fsck", " checking tree %v for snapshot %v\n", sn.Tree, id)
fmt.Fprintf(os.Stderr, "snapshot %v:\n error for tree %v:\n %v\n", id, sn.Tree, err)

View File

@@ -74,12 +74,12 @@ func addKey(s *repo.Repository) error {
return nil
}
func deleteKey(s *repo.Repository, name string) error {
if name == s.KeyName() {
func deleteKey(repo *repo.Repository, name string) error {
if name == repo.KeyName() {
return errors.New("refusing to remove key currently used to access repository")
}
err := s.Remove(backend.Key, name)
err := repo.Remove(backend.Key, name)
if err != nil {
return err
}

View File

@@ -38,8 +38,8 @@ func printNode(prefix string, n *restic.Node) string {
}
}
func printTree(prefix string, s *repo.Repository, id backend.ID) error {
tree, err := restic.LoadTree(s, id)
func printTree(prefix string, repo *repo.Repository, id backend.ID) error {
tree, err := restic.LoadTree(repo, id)
if err != nil {
return err
}
@@ -48,7 +48,7 @@ func printTree(prefix string, s *repo.Repository, id backend.ID) error {
fmt.Println(printNode(prefix, entry))
if entry.Type == "dir" && entry.Subtree != nil {
err = printTree(filepath.Join(prefix, entry.Name), s, entry.Subtree)
err = printTree(filepath.Join(prefix, entry.Name), repo, entry.Subtree)
if err != nil {
return err
}