forked from TrueCloudLab/restic
Create package restic/errors
This commit is contained in:
parent
765b5437bd
commit
bc42dbdf87
75 changed files with 140 additions and 102 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
@ -232,7 +232,7 @@ func filterExisting(items []string) (result []string, err error) {
|
|||
}
|
||||
|
||||
if len(result) == 0 {
|
||||
return nil, restic.Fatal("all target directories/files do not exist")
|
||||
return nil, errors.Fatal("all target directories/files do not exist")
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -240,7 +240,7 @@ func filterExisting(items []string) (result []string, err error) {
|
|||
|
||||
func (cmd CmdBackup) readFromStdin(args []string) error {
|
||||
if len(args) != 0 {
|
||||
return restic.Fatalf("when reading from stdin, no additional files can be specified")
|
||||
return errors.Fatalf("when reading from stdin, no additional files can be specified")
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
@ -274,7 +274,7 @@ func (cmd CmdBackup) Execute(args []string) error {
|
|||
}
|
||||
|
||||
if len(args) == 0 {
|
||||
return restic.Fatalf("wrong number of parameters, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of parameters, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
target := make([]string, 0, len(args))
|
||||
|
@ -312,7 +312,7 @@ func (cmd CmdBackup) Execute(args []string) error {
|
|||
if !cmd.Force && cmd.Parent != "" {
|
||||
id, err := restic.FindSnapshot(repo, cmd.Parent)
|
||||
if err != nil {
|
||||
return restic.Fatalf("invalid id %q: %v", cmd.Parent, err)
|
||||
return errors.Fatalf("invalid id %q: %v", cmd.Parent, err)
|
||||
}
|
||||
|
||||
parentSnapshotID = &id
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"restic"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/errors"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
|
@ -31,7 +32,7 @@ func (cmd CmdCat) Usage() string {
|
|||
|
||||
func (cmd CmdCat) Execute(args []string) error {
|
||||
if len(args) < 1 || (args[0] != "masterkey" && args[0] != "config" && len(args) != 2) {
|
||||
return restic.Fatalf("type or ID not specified, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("type or ID not specified, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
@ -52,7 +53,7 @@ func (cmd CmdCat) Execute(args []string) error {
|
|||
id, err = restic.ParseID(args[1])
|
||||
if err != nil {
|
||||
if tpe != "snapshot" {
|
||||
return restic.Fatalf("unable to parse ID: %v\n", err)
|
||||
return errors.Fatalf("unable to parse ID: %v\n", err)
|
||||
}
|
||||
|
||||
// find snapshot id with prefix
|
||||
|
@ -181,7 +182,7 @@ func (cmd CmdCat) Execute(args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return restic.Fatal("blob not found")
|
||||
return errors.Fatal("blob not found")
|
||||
|
||||
case "tree":
|
||||
debug.Log("cat", "cat tree %v", id.Str())
|
||||
|
@ -202,6 +203,6 @@ func (cmd CmdCat) Execute(args []string) error {
|
|||
return nil
|
||||
|
||||
default:
|
||||
return restic.Fatal("invalid type")
|
||||
return errors.Fatal("invalid type")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"restic"
|
||||
"restic/checker"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
type CmdCheck struct {
|
||||
|
@ -65,7 +66,7 @@ func (cmd CmdCheck) newReadProgress(todo restic.Stat) *restic.Progress {
|
|||
|
||||
func (cmd CmdCheck) Execute(args []string) error {
|
||||
if len(args) != 0 {
|
||||
return restic.Fatal("check has no arguments")
|
||||
return errors.Fatal("check has no arguments")
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
@ -103,7 +104,7 @@ func (cmd CmdCheck) Execute(args []string) error {
|
|||
for _, err := range errs {
|
||||
cmd.global.Warnf("error: %v\n", err)
|
||||
}
|
||||
return restic.Fatal("LoadIndex returned errors")
|
||||
return errors.Fatal("LoadIndex returned errors")
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
|
@ -158,7 +159,7 @@ func (cmd CmdCheck) Execute(args []string) error {
|
|||
}
|
||||
|
||||
if errorsFound {
|
||||
return restic.Fatal("repository contains errors")
|
||||
return errors.Fatal("repository contains errors")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
|
||||
"restic"
|
||||
"restic/errors"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
|
||||
|
@ -170,7 +171,7 @@ func (cmd CmdDump) DumpIndexes() error {
|
|||
|
||||
func (cmd CmdDump) Execute(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return restic.Fatalf("type not specified, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("type not specified, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
@ -214,6 +215,6 @@ func (cmd CmdDump) Execute(args []string) error {
|
|||
|
||||
return nil
|
||||
default:
|
||||
return restic.Fatalf("no such type %q", tpe)
|
||||
return errors.Fatalf("no such type %q", tpe)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"restic"
|
||||
"restic/debug"
|
||||
"restic/errors"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
|
@ -55,7 +56,7 @@ func parseTime(str string) (time.Time, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return time.Time{}, restic.Fatalf("unable to parse time: %q", str)
|
||||
return time.Time{}, errors.Fatalf("unable to parse time: %q", str)
|
||||
}
|
||||
|
||||
func (c CmdFind) findInTree(repo *repository.Repository, id restic.ID, path string) ([]findResult, error) {
|
||||
|
@ -135,7 +136,7 @@ func (CmdFind) Usage() string {
|
|||
|
||||
func (c CmdFind) Execute(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return restic.Fatalf("wrong number of arguments, Usage: %s", c.Usage())
|
||||
return errors.Fatalf("wrong number of arguments, Usage: %s", c.Usage())
|
||||
}
|
||||
|
||||
var err error
|
||||
|
@ -175,7 +176,7 @@ func (c CmdFind) Execute(args []string) error {
|
|||
if c.Snapshot != "" {
|
||||
snapshotID, err := restic.FindSnapshot(repo, c.Snapshot)
|
||||
if err != nil {
|
||||
return restic.Fatalf("invalid id %q: %v", args[1], err)
|
||||
return errors.Fatalf("invalid id %q: %v", args[1], err)
|
||||
}
|
||||
|
||||
return c.findInSnapshot(repo, snapshotID)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"restic"
|
||||
"restic/errors"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
|
@ -11,7 +11,7 @@ type CmdInit struct {
|
|||
|
||||
func (cmd CmdInit) Execute(args []string) error {
|
||||
if cmd.global.Repo == "" {
|
||||
return restic.Fatal("Please specify repository location (-r)")
|
||||
return errors.Fatal("Please specify repository location (-r)")
|
||||
}
|
||||
|
||||
be, err := create(cmd.global.Repo)
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"restic"
|
||||
|
||||
"restic/errors"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
|
@ -68,7 +69,7 @@ func (cmd CmdKey) getNewPassword() string {
|
|||
func (cmd CmdKey) addKey(repo *repository.Repository) error {
|
||||
id, err := repository.AddKey(repo, cmd.getNewPassword(), repo.Key())
|
||||
if err != nil {
|
||||
return restic.Fatalf("creating new key failed: %v\n", err)
|
||||
return errors.Fatalf("creating new key failed: %v\n", err)
|
||||
}
|
||||
|
||||
cmd.global.Verbosef("saved new key as %s\n", id)
|
||||
|
@ -78,7 +79,7 @@ func (cmd CmdKey) addKey(repo *repository.Repository) error {
|
|||
|
||||
func (cmd CmdKey) deleteKey(repo *repository.Repository, name string) error {
|
||||
if name == repo.KeyName() {
|
||||
return restic.Fatal("refusing to remove key currently used to access repository")
|
||||
return errors.Fatal("refusing to remove key currently used to access repository")
|
||||
}
|
||||
|
||||
err := repo.Backend().Remove(restic.KeyFile, name)
|
||||
|
@ -93,7 +94,7 @@ func (cmd CmdKey) deleteKey(repo *repository.Repository, name string) error {
|
|||
func (cmd CmdKey) changePassword(repo *repository.Repository) error {
|
||||
id, err := repository.AddKey(repo, cmd.getNewPassword(), repo.Key())
|
||||
if err != nil {
|
||||
return restic.Fatalf("creating new key failed: %v\n", err)
|
||||
return errors.Fatalf("creating new key failed: %v\n", err)
|
||||
}
|
||||
|
||||
err = repo.Backend().Remove(restic.KeyFile, repo.KeyName())
|
||||
|
@ -112,7 +113,7 @@ func (cmd CmdKey) Usage() string {
|
|||
|
||||
func (cmd CmdKey) Execute(args []string) error {
|
||||
if len(args) < 1 || (args[0] == "rm" && len(args) != 2) {
|
||||
return restic.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package main
|
||||
|
||||
import "restic"
|
||||
import (
|
||||
"restic"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
type CmdList struct {
|
||||
global *GlobalOptions
|
||||
|
@ -22,7 +25,7 @@ func (cmd CmdList) Usage() string {
|
|||
|
||||
func (cmd CmdList) Execute(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return restic.Fatalf("type not specified, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("type not specified, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
@ -51,7 +54,7 @@ func (cmd CmdList) Execute(args []string) error {
|
|||
case "locks":
|
||||
t = restic.LockFile
|
||||
default:
|
||||
return restic.Fatal("invalid type")
|
||||
return errors.Fatal("invalid type")
|
||||
}
|
||||
|
||||
for id := range repo.List(t, nil) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"restic"
|
||||
"restic/errors"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
|
@ -71,7 +72,7 @@ func (cmd CmdLs) Usage() string {
|
|||
|
||||
func (cmd CmdLs) Execute(args []string) error {
|
||||
if len(args) < 1 || len(args) > 2 {
|
||||
return restic.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
|
|
@ -5,9 +5,8 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
resticfs "restic/fs"
|
||||
"restic/fuse"
|
||||
|
@ -44,7 +43,7 @@ func (cmd CmdMount) Usage() string {
|
|||
|
||||
func (cmd CmdMount) Execute(args []string) error {
|
||||
if len(args) == 0 {
|
||||
return restic.Fatalf("wrong number of parameters, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of parameters, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"os"
|
||||
"restic"
|
||||
"restic/debug"
|
||||
"restic/errors"
|
||||
"restic/index"
|
||||
"restic/repository"
|
||||
"time"
|
||||
|
@ -189,7 +190,7 @@ nextPack:
|
|||
removePacks.Insert(packID)
|
||||
|
||||
if !rewritePacks.Has(packID) {
|
||||
return restic.Fatalf("pack %v is unneeded, but not contained in rewritePacks", packID.Str())
|
||||
return errors.Fatalf("pack %v is unneeded, but not contained in rewritePacks", packID.Str())
|
||||
}
|
||||
|
||||
rewritePacks.Delete(packID)
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"restic"
|
||||
"restic/debug"
|
||||
"restic/errors"
|
||||
"restic/filter"
|
||||
)
|
||||
|
||||
|
@ -32,15 +33,15 @@ func (cmd CmdRestore) Usage() string {
|
|||
|
||||
func (cmd CmdRestore) Execute(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return restic.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of arguments, Usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
if cmd.Target == "" {
|
||||
return restic.Fatal("please specify a directory to restore to (--target)")
|
||||
return errors.Fatal("please specify a directory to restore to (--target)")
|
||||
}
|
||||
|
||||
if len(cmd.Exclude) > 0 && len(cmd.Include) > 0 {
|
||||
return restic.Fatal("exclude and include patterns are mutually exclusive")
|
||||
return errors.Fatal("exclude and include patterns are mutually exclusive")
|
||||
}
|
||||
|
||||
snapshotIDString := args[0]
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"restic/errors"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
@ -69,7 +70,7 @@ func (cmd CmdSnapshots) Usage() string {
|
|||
|
||||
func (cmd CmdSnapshots) Execute(args []string) error {
|
||||
if len(args) != 0 {
|
||||
return restic.Fatalf("wrong number of arguments, usage: %s", cmd.Usage())
|
||||
return errors.Fatalf("wrong number of arguments, usage: %s", cmd.Usage())
|
||||
}
|
||||
|
||||
repo, err := cmd.global.OpenRepository()
|
||||
|
|
|
@ -17,8 +17,9 @@ import (
|
|||
"restic/location"
|
||||
"restic/repository"
|
||||
|
||||
"restic/errors"
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
|
@ -246,7 +247,7 @@ const maxKeys = 20
|
|||
// OpenRepository reads the password and opens the repository.
|
||||
func (o GlobalOptions) OpenRepository() (*repository.Repository, error) {
|
||||
if o.Repo == "" {
|
||||
return nil, restic.Fatal("Please specify repository location (-r)")
|
||||
return nil, errors.Fatal("Please specify repository location (-r)")
|
||||
}
|
||||
|
||||
be, err := open(o.Repo)
|
||||
|
@ -262,7 +263,7 @@ func (o GlobalOptions) OpenRepository() (*repository.Repository, error) {
|
|||
|
||||
err = s.SearchKey(o.password, maxKeys)
|
||||
if err != nil {
|
||||
return nil, restic.Fatalf("unable to open repo: %v", err)
|
||||
return nil, errors.Fatalf("unable to open repo: %v", err)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
|
@ -300,7 +301,7 @@ func open(s string) (restic.Backend, error) {
|
|||
}
|
||||
|
||||
debug.Log("open", "invalid repository location: %v", s)
|
||||
return nil, restic.Fatalf("invalid scheme %q", loc.Scheme)
|
||||
return nil, errors.Fatalf("invalid scheme %q", loc.Scheme)
|
||||
}
|
||||
|
||||
// Create the backend specified by URI.
|
||||
|
@ -335,5 +336,5 @@ func create(s string) (restic.Backend, error) {
|
|||
}
|
||||
|
||||
debug.Log("open", "invalid repository scheme: %v", s)
|
||||
return nil, restic.Fatalf("invalid scheme %q", loc.Scheme)
|
||||
return nil, errors.Fatalf("invalid scheme %q", loc.Scheme)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic"
|
||||
"restic/repository"
|
||||
|
@ -50,7 +50,7 @@ func waitForMount(dir string) error {
|
|||
time.Sleep(mountSleep)
|
||||
}
|
||||
|
||||
return restic.Fatalf("subdir %q of dir %s never appeared", mountTestSubdir, dir)
|
||||
return errors.Fatalf("subdir %q of dir %s never appeared", mountTestSubdir, dir)
|
||||
}
|
||||
|
||||
func cmdMount(t testing.TB, global GlobalOptions, dir string, ready, done chan struct{}) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
"restic/filter"
|
||||
|
@ -582,7 +582,7 @@ func testFileSize(filename string, size int64) error {
|
|||
}
|
||||
|
||||
if fi.Size() != size {
|
||||
return restic.Fatalf("wrong file size for %v: expected %v, got %v", filename, size, fi.Size())
|
||||
return errors.Fatalf("wrong file size for %v: expected %v, got %v", filename, size, fi.Size())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"restic/debug"
|
||||
"runtime"
|
||||
|
||||
"restic/errors"
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -42,7 +43,7 @@ func main() {
|
|||
switch {
|
||||
case restic.IsAlreadyLocked(errors.Cause(err)):
|
||||
fmt.Fprintf(os.Stderr, "%v\nthe `unlock` command can be used to remove stale locks\n", err)
|
||||
case restic.IsFatal(errors.Cause(err)):
|
||||
case errors.IsFatal(errors.Cause(err)):
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
case err != nil:
|
||||
fmt.Fprintf(os.Stderr, "%+v\n", err)
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
"restic/debug"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/restic/chunker"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// saveTreeJSON stores a tree in the repository.
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
"restic/fs"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic"
|
||||
"restic/archiver"
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"restic/crypto"
|
||||
. "restic/test"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/restic/chunker"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
var testPol = chunker.Pol(0x3DA3358B4DC173)
|
||||
|
|
|
@ -3,7 +3,7 @@ package local
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// ParseConfig parses a local backend config.
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"path/filepath"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"restic"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package mem_test
|
|||
import (
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend/mem"
|
||||
"restic/backend/test"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Config contains all configuration necessary to connect to a REST server.
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"restic"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend/rest"
|
||||
"restic/backend/test"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Config contains all configuration necessary to connect to an s3 compatible
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"restic"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"github.com/minio/minio-go"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend/s3"
|
||||
"restic/backend/test"
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Config collects all information required to connect to an sftp server.
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"restic"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend/sftp"
|
||||
"restic/backend/test"
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
|
|
|
@ -3,7 +3,7 @@ package test_test
|
|||
import (
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend/mem"
|
||||
"restic/backend/test"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"io"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// LoadAll reads all data stored in the backend for the handle. The buffer buf
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package restic
|
||||
|
||||
import "github.com/pkg/errors"
|
||||
import "restic/errors"
|
||||
|
||||
// ErrNoIDPrefixFound is returned by Find() when no ID for the given prefix
|
||||
// could be found.
|
||||
|
|
|
@ -3,7 +3,7 @@ package restic
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Blob is one part of a file or a tree.
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic"
|
||||
"restic/backend"
|
||||
|
|
|
@ -3,7 +3,7 @@ package restic
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"golang.org/x/crypto/poly1305"
|
||||
)
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"time"
|
||||
|
||||
sscrypt "github.com/elithrar/simple-scrypt"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/crypto/scrypt"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
const saltLength = 64
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
type process struct {
|
||||
|
|
2
src/restic/errors/doc.go
Normal file
2
src/restic/errors/doc.go
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Package errors provides custom error types used within restic.
|
||||
package errors
|
|
@ -1,4 +1,4 @@
|
|||
package restic
|
||||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
23
src/restic/errors/wrap.go
Normal file
23
src/restic/errors/wrap.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package errors
|
||||
|
||||
import "github.com/pkg/errors"
|
||||
|
||||
// Cause returns the cause of an error.
|
||||
func Cause(err error) error {
|
||||
return errors.Cause(err)
|
||||
}
|
||||
|
||||
// New creates a new error based on message.
|
||||
func New(message string) error {
|
||||
return errors.New(message)
|
||||
}
|
||||
|
||||
// Errorf creates an error based on a format string and values.
|
||||
func Errorf(format string, args ...interface{}) error {
|
||||
return errors.Errorf(format, args...)
|
||||
}
|
||||
|
||||
// Wrap wraps an error retrieved from outside of restic.
|
||||
func Wrap(err error, message string) error {
|
||||
return errors.Wrap(err, message)
|
||||
}
|
|
@ -3,7 +3,7 @@ package restic
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// FileType is the type of a file in the backend.
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// ErrBadString is returned when Match is called with the empty string as the
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ package fuse
|
|||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic"
|
||||
"restic/debug"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"bazil.org/fuse"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Hash returns the ID for data.
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"restic/list"
|
||||
"restic/worker"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Pack contains information about the contents of a pack.
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strconv"
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package mock
|
|||
import (
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Backend implements a mock backend.
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"runtime"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/fs"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package restic
|
|||
import (
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// mknod() creates a filesystem node (file, device
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"restic"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/crypto"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
"restic/fs"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"io"
|
||||
"math/rand"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// RandReader allows reading from a rand.Rand.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/crypto"
|
||||
"restic/debug"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"restic"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
"restic/crypto"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"restic"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"restic"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/crypto"
|
||||
"restic/debug"
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/repository"
|
||||
. "restic/test"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"restic/debug"
|
||||
"restic/pack"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Repack takes a list of packs together with a list of blobs contained in
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"os"
|
||||
"restic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/backend"
|
||||
"restic/crypto"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
"restic/fs"
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// Snapshot is the state of a resource at one point in time.
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/restic/chunker"
|
||||
"restic/errors"
|
||||
)
|
||||
|
||||
// fakeFile returns a reader which yields deterministic pseudo-random data.
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/debug"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package worker_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"restic/errors"
|
||||
|
||||
"restic/worker"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue