forked from TrueCloudLab/restic
commit
134d129986
497 changed files with 366 additions and 412 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,8 +1,4 @@
|
|||
/.gopath
|
||||
/pkg
|
||||
/bin
|
||||
/restic
|
||||
/restic.debug
|
||||
/dirdiff
|
||||
cmd/dirdiff/dirdiff
|
||||
cmd/gentestdata/gentestdata
|
||||
cmd/restic/restic
|
||||
/.vagrant
|
||||
|
|
|
@ -5,7 +5,7 @@ go:
|
|||
- 1.3.3
|
||||
- 1.4.3
|
||||
- 1.5.3
|
||||
- 1.6rc2
|
||||
- 1.6
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
@ -18,7 +18,7 @@ matrix:
|
|||
- os: osx
|
||||
go: 1.4.3
|
||||
- os: osx
|
||||
go: 1.6rc2
|
||||
go: 1.5.3
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
|
@ -32,7 +32,6 @@ install:
|
|||
- go version
|
||||
- export GOBIN="$GOPATH/bin"
|
||||
- export PATH="$PATH:$GOBIN"
|
||||
- export GOPATH="$GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace"
|
||||
- go env
|
||||
|
||||
script:
|
||||
|
|
|
@ -57,39 +57,32 @@ uploading it somewhere or post only the parts that are really relevant.
|
|||
Development Environment
|
||||
=======================
|
||||
|
||||
For development, it is recommended to check out the restic repository within a
|
||||
`GOPATH`, an introductory text is
|
||||
["How to Write Go Code"](https://golang.org/doc/code.html). It is recommended
|
||||
to have a working directory, we're using `~/work/restic` in the following. This
|
||||
directory mainly contains the directory `src`, where the source code is stored.
|
||||
For development you need the build tool [`gb`](https://getgb.io), it can be
|
||||
installed by running the following command:
|
||||
|
||||
First, create the necessary directory structure and clone the restic repository
|
||||
to the correct location:
|
||||
$ go get github.com/constabulary/...
|
||||
|
||||
The repository contains two directories with code: `src/` contains the code
|
||||
written for restic, whereas `vendor/` contains copies of libraries restic
|
||||
depends on. The libraries are managed with the `gb vendor` command.
|
||||
|
||||
Just clone the repository, `cd` to it and run `gb build` to build the binary:
|
||||
|
||||
$ mkdir --parents ~/work/restic/src/github.com/restic
|
||||
$ cd ~/work/restic/src/github.com/restic
|
||||
$ git clone https://github.com/restic/restic
|
||||
$ cd restic
|
||||
|
||||
Now we're in the main directory of the restic repository. The last step is to
|
||||
set the environment variable `$GOPATH` to the correct value:
|
||||
|
||||
$ export GOPATH=~/work/restic:~/work/restic/src/github.com/restic/restic/Godeps/_workspace
|
||||
$ gb build
|
||||
[...]
|
||||
$ bin/restic version
|
||||
restic compiled manually
|
||||
compiled at unknown time with go1.6
|
||||
|
||||
The following commands can be used to run all the tests:
|
||||
|
||||
$ go test ./...
|
||||
$ gb test
|
||||
ok github.com/restic/restic 8.174s
|
||||
[...]
|
||||
|
||||
The restic binary can be built from the directory `cmd/restic` this way:
|
||||
|
||||
$ cd cmd/restic
|
||||
$ go build
|
||||
$ ./restic version
|
||||
restic compiled manually on go1.4.2
|
||||
|
||||
if you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
|
||||
If you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
|
||||
[vagrant](https://www.vagrantup.com/) with the proveded `Vagrantfile` to
|
||||
quickly set up VMs and run the tests, e.g.:
|
||||
|
||||
|
@ -107,23 +100,32 @@ get it into the project! The workflow we're using is also described on the
|
|||
[GitHub Flow](https://guides.github.com/introduction/flow/) website, it boils
|
||||
down to the following steps:
|
||||
|
||||
0. If you want to work on something, please add a comment to the issue on
|
||||
GitHub. For a new feature, please add an issue before starting to work on
|
||||
it, so that duplicate work is prevented.
|
||||
|
||||
1. First we would kindly ask you to fork our project on GitHub if you haven't
|
||||
done so already.
|
||||
|
||||
2. Clone the repository locally and create a new branch. If you are working on
|
||||
the code itself, please set up the development environment as described in
|
||||
the previous section and instead of cloning add your fork on GitHub as a
|
||||
remote to the clone of the restic repository.
|
||||
the previous section.
|
||||
|
||||
3. Then commit your changes as fine grained as possible, as smaller patches,
|
||||
that handle one and only one issue are easier to discuss and merge.
|
||||
|
||||
4. Push the new branch with your changes to your fork of the repository.
|
||||
|
||||
5. Create a pull request by visiting the GitHub website, it will guide you
|
||||
through the process.
|
||||
|
||||
6. You will receive comments on your code and the feature or bug that they
|
||||
address. Maybe you need to rework some minor things, in this case push new
|
||||
commits to the branch you created for the pull request, they will be
|
||||
automatically added to the pull request.
|
||||
7. Once your code looks good, we'll merge it. Thanks a low for your
|
||||
contribution!
|
||||
|
||||
7. Once your code looks good and passes all the tests, we'll merge it. Thanks
|
||||
a low for your contribution!
|
||||
|
||||
Please provide the patches for each bug or feature in a separate branch and
|
||||
open up a pull request for each.
|
||||
|
|
30
Dockerfile
30
Dockerfile
|
@ -4,18 +4,21 @@
|
|||
# build the image:
|
||||
# docker build -t restic/test .
|
||||
#
|
||||
# run tests:
|
||||
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go run run_integration_tests.go
|
||||
# run all tests and cross-compile restic:
|
||||
# docker run --rm -v $PWD:/home/travis/restic restic/test go run run_integration_tests.go -minio minio
|
||||
#
|
||||
# run interactively with:
|
||||
# docker run --interactive --tty --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test /bin/bash
|
||||
# run interactively:
|
||||
# docker run --interactive --tty --rm -v $PWD:/home/travis/restic restic/test /bin/bash
|
||||
#
|
||||
# run a tests:
|
||||
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go test -v ./backend
|
||||
# run a subset of tests:
|
||||
# docker run --rm -v $PWD:/home/travis/restic restic/test gb test -v ./backend
|
||||
#
|
||||
# build the image for an older version of Go:
|
||||
# docker build --build-arg GOVERSION=1.3.3 -t restic/test:go1.3.3 .
|
||||
|
||||
FROM ubuntu:14.04
|
||||
|
||||
ARG GOVERSION=1.5.3
|
||||
ARG GOVERSION=1.6
|
||||
ARG GOARCH=amd64
|
||||
|
||||
# install dependencies
|
||||
|
@ -34,15 +37,13 @@ WORKDIR $HOME
|
|||
RUN wget -q -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go${GOVERSION}.linux-${GOARCH}.tar.gz
|
||||
RUN tar xf /tmp/go.tar.gz && rm -f /tmp/go.tar.gz
|
||||
ENV GOROOT $HOME/go
|
||||
ENV PATH $PATH:$GOROOT/bin
|
||||
|
||||
ENV GOPATH $HOME/gopath
|
||||
ENV PATH $PATH:$GOPATH/bin
|
||||
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin:$HOME/bin
|
||||
|
||||
RUN mkdir -p $GOPATH/src/github.com/restic/restic
|
||||
RUN mkdir -p $HOME/restic
|
||||
|
||||
# pre-install tools, this speeds up running the tests itself
|
||||
RUN go get github.com/tools/godep
|
||||
RUN go get github.com/constabulary/gb/...
|
||||
RUN go get golang.org/x/tools/cmd/cover
|
||||
RUN go get github.com/mattn/goveralls
|
||||
RUN go get github.com/mitchellh/gox
|
||||
|
@ -52,7 +53,6 @@ RUN mkdir $HOME/bin \
|
|||
&& chmod +x $HOME/bin/minio
|
||||
|
||||
# set TRAVIS_BUILD_DIR for integration script
|
||||
ENV TRAVIS_BUILD_DIR $GOPATH/src/github.com/restic/restic
|
||||
ENV GOPATH $GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace
|
||||
ENV TRAVIS_BUILD_DIR $HOME/restic
|
||||
|
||||
WORKDIR $TRAVIS_BUILD_DIR
|
||||
WORKDIR $HOME/restic
|
||||
|
|
59
Godeps/Godeps.json
generated
59
Godeps/Godeps.json
generated
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
"ImportPath": "github.com/restic/restic",
|
||||
"GoVersion": "go1.5",
|
||||
"Packages": [
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "bazil.org/fuse",
|
||||
"Rev": "18419ee53958df28fcfc9490fe6123bd59e237bb"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/jessevdk/go-flags",
|
||||
"Comment": "v1-297-g1b89bf7",
|
||||
"Rev": "1b89bf73cd2c3a911d7b2a279ab085c4a18cf539"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/juju/errors",
|
||||
"Rev": "4567a5e69fd3130ca0d89f69478e7ac025b67452"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kr/fs",
|
||||
"Rev": "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/minio/minio-go",
|
||||
"Comment": "v0.2.5-251-ga4cd3ca",
|
||||
"Rev": "a4cd3caabd5f9c35ac100110eb60c2b80798f1af"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pkg/sftp",
|
||||
"Rev": "e84cc8c755ca39b7b64f510fe1fffc1b51f210a5"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/restic/chunker",
|
||||
"Rev": "fc45043175c38d59374024a38fb7123c40a64f20"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/pbkdf2",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/poly1305",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/scrypt",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ssh",
|
||||
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/context",
|
||||
"Rev": "7654728e381988afd88e58cabfd6363a5ea91810"
|
||||
}
|
||||
]
|
||||
}
|
5
Godeps/Readme
generated
5
Godeps/Readme
generated
|
@ -1,5 +0,0 @@
|
|||
This directory tree is generated automatically by godep.
|
||||
|
||||
Please do not edit.
|
||||
|
||||
See https://github.com/tools/godep for more information.
|
2
Godeps/_workspace/.gitignore
generated
vendored
2
Godeps/_workspace/.gitignore
generated
vendored
|
@ -1,2 +0,0 @@
|
|||
/pkg
|
||||
/bin
|
17
Vagrantfile
vendored
17
Vagrantfile
vendored
|
@ -1,7 +1,7 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
GO_VERSION = '1.4.2'
|
||||
GO_VERSION = '1.6'
|
||||
|
||||
def packages_freebsd
|
||||
return <<-EOF
|
||||
|
@ -57,24 +57,23 @@ def prepare_user(boxname)
|
|||
|
||||
gimme #{GO_VERSION} >> ~/.profile
|
||||
echo export 'GOPATH=/vagrant/go' >> ~/.profile
|
||||
echo export 'CDPATH=.:$GOPATH/src/github.com' >> ~/.profile
|
||||
echo export 'PATH=$GOPATH/bin:/usr/local/bin:$PATH' >> ~/.profile
|
||||
|
||||
. ~/.profile
|
||||
|
||||
go get golang.org/x/tools/cmd/cover
|
||||
go get github.com/tools/godep
|
||||
go get github.com/constabulary/gb/...
|
||||
|
||||
echo
|
||||
echo "Run:"
|
||||
echo " vagrant rsync #{boxname}"
|
||||
echo " vagrant ssh #{boxname} -c 'cd project/path; godep go test ./...'"
|
||||
echo " vagrant ssh #{boxname} -c 'cd /vagrant; gb build && gb test'"
|
||||
EOF
|
||||
end
|
||||
|
||||
def fix_perms
|
||||
return <<-EOF
|
||||
chown -R vagrant /vagrant/go
|
||||
chown -R vagrant /vagrant
|
||||
EOF
|
||||
end
|
||||
|
||||
|
@ -84,12 +83,16 @@ end
|
|||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
# use rsync to copy content to the folder
|
||||
config.vm.synced_folder ".", "/vagrant/go/src/github.com/restic/restic", :type => "rsync"
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.synced_folder ".", "/vagrant", :type => "rsync"
|
||||
|
||||
# fix permissions on synced folder
|
||||
config.vm.provision "fix perms", :type => :shell, :inline => fix_perms
|
||||
|
||||
# fix network card
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
|
||||
end
|
||||
|
||||
config.vm.define "linux" do |b|
|
||||
b.vm.box = "ubuntu/trusty64"
|
||||
b.vm.provision "packages linux", :type => :shell, :inline => packages_linux
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
clone_folder: c:\gopath\src\github.com\restic\restic
|
||||
clone_folder: c:\restic
|
||||
|
||||
environment:
|
||||
GOPATH: c:\gopath;c:\gopath\src\github.com\restic\restic\Godeps\_workspace
|
||||
GOPATH: c:\gopath
|
||||
|
||||
init:
|
||||
- ps: >-
|
||||
|
@ -13,8 +13,8 @@ init:
|
|||
|
||||
install:
|
||||
- rmdir c:\go /s /q
|
||||
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.5.3.windows-amd64.msi
|
||||
- msiexec /i go1.5.3.windows-amd64.msi /q
|
||||
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.6.windows-amd64.msi
|
||||
- msiexec /i go1.6.windows-amd64.msi /q
|
||||
- go version
|
||||
- go env
|
||||
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip
|
||||
|
|
34
build.go
34
build.go
|
@ -30,7 +30,11 @@ func specialDir(name string) bool {
|
|||
}
|
||||
|
||||
base := filepath.Base(name)
|
||||
return base[0] == '_' || base[0] == '.'
|
||||
if base == "vendor" || base[0] == '_' || base[0] == '.' {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// excludePath returns true if the file should not be copied to the new GOPATH.
|
||||
|
@ -177,10 +181,11 @@ func cleanEnv() (env []string) {
|
|||
}
|
||||
|
||||
// build runs "go build args..." with GOPATH set to gopath.
|
||||
func build(gopath string, args ...string) error {
|
||||
func build(cwd, gopath string, args ...string) error {
|
||||
args = append([]string{"build"}, args...)
|
||||
cmd := exec.Command("go", args...)
|
||||
cmd.Env = append(cleanEnv(), "GOPATH="+gopath)
|
||||
cmd.Dir = cwd
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
verbosePrintf("go %s\n", args)
|
||||
|
@ -189,10 +194,11 @@ func build(gopath string, args ...string) error {
|
|||
}
|
||||
|
||||
// test runs "go test args..." with GOPATH set to gopath.
|
||||
func test(gopath string, args ...string) error {
|
||||
func test(cwd, gopath string, args ...string) error {
|
||||
args = append([]string{"test"}, args...)
|
||||
cmd := exec.Command("go", args...)
|
||||
cmd.Env = append(cleanEnv(), "GOPATH="+gopath)
|
||||
cmd.Dir = cwd
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
verbosePrintf("go %s\n", args)
|
||||
|
@ -293,6 +299,7 @@ func main() {
|
|||
runTests = true
|
||||
case "-h":
|
||||
showUsage(os.Stdout)
|
||||
return
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "Error: unknown option %q\n\n", arg)
|
||||
showUsage(os.Stderr)
|
||||
|
@ -322,11 +329,11 @@ func main() {
|
|||
}
|
||||
|
||||
verbosePrintf("create GOPATH at %v\n", gopath)
|
||||
if err = updateGopath(gopath, root, "github.com/restic/restic"); err != nil {
|
||||
if err = updateGopath(gopath, filepath.Join(root, "src"), ""); err != nil {
|
||||
die("copying files from %v to %v failed: %v\n", root, gopath, err)
|
||||
}
|
||||
|
||||
vendor := filepath.Join(root, "Godeps", "_workspace", "src")
|
||||
vendor := filepath.Join(root, "vendor", "src")
|
||||
if err = updateGopath(gopath, vendor, ""); err != nil {
|
||||
die("copying files from %v to %v failed: %v\n", root, gopath, err)
|
||||
}
|
||||
|
@ -342,10 +349,17 @@ func main() {
|
|||
}
|
||||
}()
|
||||
|
||||
output := "restic"
|
||||
outputFilename := "restic"
|
||||
if runtime.GOOS == "windows" {
|
||||
output = "restic.exe"
|
||||
outputFilename = "restic.exe"
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
die("Getwd() returned %v\n", err)
|
||||
}
|
||||
output := filepath.Join(cwd, outputFilename)
|
||||
|
||||
version := getVersion()
|
||||
compileTime := time.Now().Format(timeFormat)
|
||||
constants := Constants{`main.compiledAt`: compileTime}
|
||||
|
@ -358,10 +372,10 @@ func main() {
|
|||
args := []string{
|
||||
"-tags", strings.Join(buildTags, " "),
|
||||
"-ldflags", ldflags,
|
||||
"-o", output, "github.com/restic/restic/cmd/restic",
|
||||
"-o", output, "restic/cmd/restic",
|
||||
}
|
||||
|
||||
err = build(gopath, args...)
|
||||
err = build(filepath.Join(gopath, "src"), gopath, args...)
|
||||
if err != nil {
|
||||
die("build failed: %v\n", err)
|
||||
}
|
||||
|
@ -369,7 +383,7 @@ func main() {
|
|||
if runTests {
|
||||
verbosePrintf("running tests\n")
|
||||
|
||||
err = test(gopath, "github.com/restic/restic/...")
|
||||
err = test(filepath.Join(gopath, "src"), gopath, "restic/...")
|
||||
if err != nil {
|
||||
die("running tests failed: %v\n", err)
|
||||
}
|
||||
|
|
|
@ -154,27 +154,31 @@ func (env *TravisEnvironment) RunTests() {
|
|||
os.Setenv("RESTIC_TEST_FUSE", "0")
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Getwd() returned error: %v", err)
|
||||
os.Exit(9)
|
||||
}
|
||||
|
||||
envWithGOPATH := make(map[string]string)
|
||||
envWithGOPATH["GOPATH"] = cwd + ":" + filepath.Join(cwd, "vendor")
|
||||
|
||||
if *runCrossCompile {
|
||||
// compile for all target architectures with tags
|
||||
for _, tags := range []string{"release", "debug"} {
|
||||
run("gox", "-verbose",
|
||||
runWithEnv(envWithGOPATH, "gox", "-verbose",
|
||||
"-os", strings.Join(env.goxOS, " "),
|
||||
"-arch", strings.Join(env.goxArch, " "),
|
||||
"-tags", tags,
|
||||
"-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}",
|
||||
"./cmd/restic")
|
||||
"restic/cmd/restic")
|
||||
}
|
||||
}
|
||||
|
||||
// run the build script
|
||||
run("go", "run", "build.go")
|
||||
|
||||
var (
|
||||
testEnv map[string]string
|
||||
srv *MinioServer
|
||||
err error
|
||||
)
|
||||
|
||||
var srv *MinioServer
|
||||
if env.minio != "" {
|
||||
srv, err = NewMinioServer(env.minio)
|
||||
if err != nil {
|
||||
|
@ -182,11 +186,13 @@ func (env *TravisEnvironment) RunTests() {
|
|||
os.Exit(8)
|
||||
}
|
||||
|
||||
testEnv = minioEnv
|
||||
for k, v := range minioEnv {
|
||||
envWithGOPATH[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
// run the tests and gather coverage information
|
||||
runWithEnv(testEnv, "gotestcover", "-coverprofile", "all.cov", "./...")
|
||||
runWithEnv(envWithGOPATH, "gotestcover", "-coverprofile", "all.cov", "restic/...")
|
||||
|
||||
runGofmt()
|
||||
|
||||
|
@ -206,7 +212,7 @@ func (env *AppveyorEnvironment) RunTests() {
|
|||
// findGoFiles returns a list of go source code file names below dir.
|
||||
func findGoFiles(dir string) (list []string, err error) {
|
||||
err = filepath.Walk(dir, func(name string, fi os.FileInfo, err error) error {
|
||||
if filepath.Base(name) == "Godeps" {
|
||||
if filepath.Base(name) == "vendor" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/restic/chunker"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/pipe"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/pack"
|
||||
"restic/pipe"
|
||||
"restic/repository"
|
||||
|
||||
"github.com/juju/errors"
|
||||
)
|
|
@ -10,10 +10,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
const parallelSaves = 50
|
|
@ -4,7 +4,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/pipe"
|
||||
"restic/pipe"
|
||||
)
|
||||
|
||||
var treeJobs = []string{
|
|
@ -8,13 +8,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/restic/chunker"
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/checker"
|
||||
"github.com/restic/restic/crypto"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/checker"
|
||||
"restic/crypto"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var testPol = chunker.Pol(0x3DA3358B4DC173)
|
|
@ -3,8 +3,8 @@ package backend_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
type mockBackend struct {
|
|
@ -3,8 +3,8 @@ package backend_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var TestStrings = []struct {
|
|
@ -4,8 +4,8 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var uniqTests = []struct {
|
|
@ -3,8 +3,8 @@ package backend_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var idsetTests = []struct {
|
|
@ -4,7 +4,7 @@ package local_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -8,8 +8,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
// Local is a backend in a local directory.
|
|
@ -5,9 +5,9 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/local"
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend"
|
||||
"restic/backend/local"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var tempBackendDir string
|
|
@ -4,7 +4,7 @@ package mem_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -5,8 +5,8 @@ import (
|
|||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
type entry struct {
|
|
@ -3,9 +3,9 @@ package mem_test
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/mem"
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend"
|
||||
"restic/backend/mem"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var be backend.Backend
|
|
@ -4,7 +4,7 @@ package s3_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
"github.com/minio/minio-go"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
const connLimit = 10
|
|
@ -6,10 +6,10 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/s3"
|
||||
"github.com/restic/restic/backend/test"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
"restic/backend/s3"
|
||||
"restic/backend/test"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
//go:generate go run ../test/generate_backend_tests.go
|
|
@ -4,7 +4,7 @@ package sftp_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
"github.com/juju/errors"
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
const (
|
|
@ -7,11 +7,11 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/sftp"
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend"
|
||||
"restic/backend/sftp"
|
||||
"restic/backend/test"
|
||||
|
||||
. "github.com/restic/restic/test"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var tempBackendDir string
|
|
@ -4,7 +4,7 @@ package test_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -30,7 +30,7 @@ package {{ .Package }}
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var SkipMessage string
|
|
@ -10,8 +10,8 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
// CreateFn is a function that creates a temporary repository for the tests.
|
|
@ -3,9 +3,9 @@ package test_test
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/mem"
|
||||
"github.com/restic/restic/backend/test"
|
||||
"restic/backend"
|
||||
"restic/backend/mem"
|
||||
"restic/backend/test"
|
||||
)
|
||||
|
||||
var be backend.Backend
|
|
@ -5,9 +5,9 @@ import (
|
|||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/mem"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
"restic/backend/mem"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
const KiB = 1 << 10
|
|
@ -9,9 +9,9 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
// Cache is used to locally cache items from a repository.
|
|
@ -3,8 +3,8 @@ package restic_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
func TestCache(t *testing.T) {
|
|
@ -6,12 +6,12 @@ import (
|
|||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/crypto"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/crypto"
|
||||
"restic/debug"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
// Checker runs various checks on a repository. It is advisable to create an
|
|
@ -7,12 +7,12 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/mem"
|
||||
"github.com/restic/restic/checker"
|
||||
"github.com/restic/restic/repository"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/backend/mem"
|
||||
"restic/checker"
|
||||
"restic/repository"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var checkerTestData = filepath.Join("testdata", "checker-test-repo.tar.gz")
|
|
@ -3,9 +3,9 @@ package checker
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
// Repacker extracts still used blobs from packs with unused blobs and creates
|
|
@ -3,10 +3,10 @@ package checker_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/checker"
|
||||
"restic/backend"
|
||||
"restic/checker"
|
||||
|
||||
. "github.com/restic/restic/test"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
var findPackTests = []struct {
|
|
@ -7,7 +7,7 @@ import (
|
|||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/restic/restic/debug"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
var cleanupHandlers struct {
|
|
@ -8,12 +8,12 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/filter"
|
||||
"github.com/restic/restic/repository"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/filter"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdBackup struct {
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"restic"
|
||||
)
|
||||
|
||||
type CmdCache struct {
|
|
@ -6,11 +6,11 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdCat struct {
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/checker"
|
||||
"restic"
|
||||
"restic/checker"
|
||||
)
|
||||
|
||||
type CmdCheck struct {
|
|
@ -9,10 +9,10 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/juju/errors"
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdDump struct {
|
|
@ -5,10 +5,10 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type findResult struct {
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdInit struct {
|
|
@ -4,8 +4,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/backend"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdKey struct {
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"restic/backend"
|
||||
)
|
||||
|
||||
type CmdList struct {
|
|
@ -5,9 +5,9 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdLs struct {
|
|
@ -7,7 +7,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/restic/restic/fuse"
|
||||
"restic/fuse"
|
||||
|
||||
systemFuse "bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
|
@ -4,8 +4,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/checker"
|
||||
"restic/backend"
|
||||
"restic/checker"
|
||||
)
|
||||
|
||||
type CmdOptimize struct {
|
|
@ -4,10 +4,10 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/pack"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/pack"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
type CmdRebuildIndex struct {
|
|
@ -4,9 +4,9 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/filter"
|
||||
"restic"
|
||||
"restic/debug"
|
||||
"restic/filter"
|
||||
)
|
||||
|
||||
type CmdRestore struct {
|
|
@ -8,8 +8,8 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
)
|
||||
|
||||
type Table struct {
|
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
import "github.com/restic/restic"
|
||||
import "restic"
|
||||
|
||||
type CmdUnlock struct {
|
||||
RemoveAll bool `long:"remove-all" description:"Remove all locks, even stale ones"`
|
|
@ -9,14 +9,14 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/backend/local"
|
||||
"github.com/restic/restic/backend/s3"
|
||||
"github.com/restic/restic/backend/sftp"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/location"
|
||||
"github.com/restic/restic/repository"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"restic/backend"
|
||||
"restic/backend/local"
|
||||
"restic/backend/s3"
|
||||
"restic/backend/sftp"
|
||||
"restic/debug"
|
||||
"restic/location"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
var version = "compiled manually"
|
|
@ -11,10 +11,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/repository"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic"
|
||||
"restic/backend"
|
||||
"restic/repository"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
const (
|
|
@ -8,7 +8,7 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
. "github.com/restic/restic/test"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
type dirEntry struct {
|
|
@ -15,11 +15,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/filter"
|
||||
"github.com/restic/restic/repository"
|
||||
. "github.com/restic/restic/test"
|
||||
"restic/backend"
|
||||
"restic/debug"
|
||||
"restic/filter"
|
||||
"restic/repository"
|
||||
. "restic/test"
|
||||
)
|
||||
|
||||
func parseIDsFromReader(t testing.TB, rd io.Reader) backend.IDs {
|
|
@ -6,9 +6,9 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/debug"
|
||||
"github.com/restic/restic/repository"
|
||||
"restic"
|
||||
"restic/debug"
|
||||
"restic/repository"
|
||||
)
|
||||
|
||||
var globalLocks struct {
|
|
@ -6,8 +6,8 @@ import (
|
|||
"runtime"
|
||||
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/restic/restic"
|
||||
"github.com/restic/restic/debug"
|
||||
"restic"
|
||||
"restic/debug"
|
||||
)
|
||||
|
||||
func init() {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue