Move package 'repo' to package 'repository'

This commit is contained in:
Alexander Neumann 2015-05-09 23:52:03 +02:00
parent b2dcdf00e3
commit 232c472836
22 changed files with 62 additions and 62 deletions

View file

@ -10,14 +10,14 @@ import (
"github.com/restic/restic"
"github.com/restic/restic/backend"
"github.com/restic/restic/backend/local"
"github.com/restic/restic/repo"
"github.com/restic/restic/repository"
)
var TestPassword = flag.String("test.password", "geheim", `use this password for repositories created during tests (default: "geheim")`)
var TestCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
var TestTempDir = flag.String("test.tempdir", "", "use this directory for temporary storage (default: system temp dir)")
func SetupRepo(t testing.TB) *repo.Repo {
func SetupRepo(t testing.TB) *repository.Repo {
tempdir, err := ioutil.TempDir(*TestTempDir, "restic-test-")
OK(t, err)
@ -29,12 +29,12 @@ func SetupRepo(t testing.TB) *repo.Repo {
err = os.Setenv("RESTIC_CACHE", filepath.Join(tempdir, "cache"))
OK(t, err)
repo := repo.New(b)
repo := repository.New(b)
OK(t, repo.Init(*TestPassword))
return repo
}
func TeardownRepo(t testing.TB, repo *repo.Repo) {
func TeardownRepo(t testing.TB, repo *repository.Repo) {
if !*TestCleanup {
l := repo.Backend().(*local.Local)
t.Logf("leaving local backend at %s\n", l.Location())
@ -44,7 +44,7 @@ func TeardownRepo(t testing.TB, repo *repo.Repo) {
OK(t, repo.Delete())
}
func SnapshotDir(t testing.TB, repo *repo.Repo, path string, parent backend.ID) *restic.Snapshot {
func SnapshotDir(t testing.TB, repo *repository.Repo, path string, parent backend.ID) *restic.Snapshot {
arch := restic.NewArchiver(repo)
sn, _, err := arch.Snapshot(nil, []string{path}, parent)
OK(t, err)