2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-05 04:47:51 +00:00

Merge pull request #445 from restic/switch-to-gb

Switch to gb
This commit is contained in:
Alexander Neumann 2016-02-20 18:23:40 +01:00
commit 134d129986
497 changed files with 366 additions and 412 deletions

8
.gitignore vendored
View File

@ -1,8 +1,4 @@
/.gopath /pkg
/bin
/restic /restic
/restic.debug
/dirdiff
cmd/dirdiff/dirdiff
cmd/gentestdata/gentestdata
cmd/restic/restic
/.vagrant /.vagrant

View File

@ -5,7 +5,7 @@ go:
- 1.3.3 - 1.3.3
- 1.4.3 - 1.4.3
- 1.5.3 - 1.5.3
- 1.6rc2 - 1.6
os: os:
- linux - linux
@ -18,7 +18,7 @@ matrix:
- os: osx - os: osx
go: 1.4.3 go: 1.4.3
- os: osx - os: osx
go: 1.6rc2 go: 1.5.3
notifications: notifications:
irc: irc:
@ -32,7 +32,6 @@ install:
- go version - go version
- export GOBIN="$GOPATH/bin" - export GOBIN="$GOPATH/bin"
- export PATH="$PATH:$GOBIN" - export PATH="$PATH:$GOBIN"
- export GOPATH="$GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace"
- go env - go env
script: script:

View File

@ -57,39 +57,32 @@ uploading it somewhere or post only the parts that are really relevant.
Development Environment Development Environment
======================= =======================
For development, it is recommended to check out the restic repository within a For development you need the build tool [`gb`](https://getgb.io), it can be
`GOPATH`, an introductory text is installed by running the following command:
["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.
First, create the necessary directory structure and clone the restic repository $ go get github.com/constabulary/...
to the correct location:
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 $ git clone https://github.com/restic/restic
$ cd restic $ cd restic
$ gb build
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: $ bin/restic version
restic compiled manually
$ export GOPATH=~/work/restic:~/work/restic/src/github.com/restic/restic/Godeps/_workspace compiled at unknown time with go1.6
The following commands can be used to run all the tests: The following commands can be used to run all the tests:
$ go test ./... $ gb test
ok github.com/restic/restic 8.174s ok github.com/restic/restic 8.174s
[...] [...]
The restic binary can be built from the directory `cmd/restic` this way: If you want to run your tests on Linux, OpenBSD or FreeBSD, you can use
$ 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
[vagrant](https://www.vagrantup.com/) with the proveded `Vagrantfile` to [vagrant](https://www.vagrantup.com/) with the proveded `Vagrantfile` to
quickly set up VMs and run the tests, e.g.: 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 [GitHub Flow](https://guides.github.com/introduction/flow/) website, it boils
down to the following steps: 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 1. First we would kindly ask you to fork our project on GitHub if you haven't
done so already. done so already.
2. Clone the repository locally and create a new branch. If you are working on 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 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 the previous section.
remote to the clone of the restic repository.
3. Then commit your changes as fine grained as possible, as smaller patches, 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. 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. 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 5. Create a pull request by visiting the GitHub website, it will guide you
through the process. through the process.
6. You will receive comments on your code and the feature or bug that they 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 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 commits to the branch you created for the pull request, they will be
automatically added to the pull request. 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 Please provide the patches for each bug or feature in a separate branch and
open up a pull request for each. open up a pull request for each.

View File

@ -4,18 +4,21 @@
# build the image: # build the image:
# docker build -t restic/test . # docker build -t restic/test .
# #
# run tests: # run all tests and cross-compile restic:
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go run run_integration_tests.go # docker run --rm -v $PWD:/home/travis/restic restic/test go run run_integration_tests.go -minio minio
# #
# run interactively with: # run interactively:
# docker run --interactive --tty --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test /bin/bash # docker run --interactive --tty --rm -v $PWD:/home/travis/restic restic/test /bin/bash
# #
# run a tests: # run a subset of tests:
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go test -v ./backend # 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 FROM ubuntu:14.04
ARG GOVERSION=1.5.3 ARG GOVERSION=1.6
ARG GOARCH=amd64 ARG GOARCH=amd64
# install dependencies # 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 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 RUN tar xf /tmp/go.tar.gz && rm -f /tmp/go.tar.gz
ENV GOROOT $HOME/go ENV GOROOT $HOME/go
ENV PATH $PATH:$GOROOT/bin
ENV GOPATH $HOME/gopath 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 # 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 golang.org/x/tools/cmd/cover
RUN go get github.com/mattn/goveralls RUN go get github.com/mattn/goveralls
RUN go get github.com/mitchellh/gox RUN go get github.com/mitchellh/gox
@ -52,7 +53,6 @@ RUN mkdir $HOME/bin \
&& chmod +x $HOME/bin/minio && chmod +x $HOME/bin/minio
# set TRAVIS_BUILD_DIR for integration script # set TRAVIS_BUILD_DIR for integration script
ENV TRAVIS_BUILD_DIR $GOPATH/src/github.com/restic/restic ENV TRAVIS_BUILD_DIR $HOME/restic
ENV GOPATH $GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace
WORKDIR $TRAVIS_BUILD_DIR WORKDIR $HOME/restic

59
Godeps/Godeps.json generated
View File

@ -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
View File

@ -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
View File

@ -1,2 +0,0 @@
/pkg
/bin

17
Vagrantfile vendored
View File

@ -1,7 +1,7 @@
# -*- mode: ruby -*- # -*- mode: ruby -*-
# vi: set ft=ruby : # vi: set ft=ruby :
GO_VERSION = '1.4.2' GO_VERSION = '1.6'
def packages_freebsd def packages_freebsd
return <<-EOF return <<-EOF
@ -57,24 +57,23 @@ def prepare_user(boxname)
gimme #{GO_VERSION} >> ~/.profile gimme #{GO_VERSION} >> ~/.profile
echo export 'GOPATH=/vagrant/go' >> ~/.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 echo export 'PATH=$GOPATH/bin:/usr/local/bin:$PATH' >> ~/.profile
. ~/.profile . ~/.profile
go get golang.org/x/tools/cmd/cover go get golang.org/x/tools/cmd/cover
go get github.com/tools/godep go get github.com/constabulary/gb/...
echo echo
echo "Run:" echo "Run:"
echo " vagrant rsync #{boxname}" 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 EOF
end end
def fix_perms def fix_perms
return <<-EOF return <<-EOF
chown -R vagrant /vagrant/go chown -R vagrant /vagrant
EOF EOF
end end
@ -84,12 +83,16 @@ end
# you're doing. # you're doing.
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
# use rsync to copy content to the folder # 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", :type => "rsync"
config.vm.synced_folder ".", "/vagrant", disabled: true
# fix permissions on synced folder # fix permissions on synced folder
config.vm.provision "fix perms", :type => :shell, :inline => fix_perms 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| config.vm.define "linux" do |b|
b.vm.box = "ubuntu/trusty64" b.vm.box = "ubuntu/trusty64"
b.vm.provision "packages linux", :type => :shell, :inline => packages_linux b.vm.provision "packages linux", :type => :shell, :inline => packages_linux

View File

@ -1,7 +1,7 @@
clone_folder: c:\gopath\src\github.com\restic\restic clone_folder: c:\restic
environment: environment:
GOPATH: c:\gopath;c:\gopath\src\github.com\restic\restic\Godeps\_workspace GOPATH: c:\gopath
init: init:
- ps: >- - ps: >-
@ -13,8 +13,8 @@ init:
install: install:
- rmdir c:\go /s /q - rmdir c:\go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.5.3.windows-amd64.msi - appveyor DownloadFile https://storage.googleapis.com/golang/go1.6.windows-amd64.msi
- msiexec /i go1.5.3.windows-amd64.msi /q - msiexec /i go1.6.windows-amd64.msi /q
- go version - go version
- go env - go env
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip - appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip

View File

@ -30,7 +30,11 @@ func specialDir(name string) bool {
} }
base := filepath.Base(name) 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. // 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. // 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...) args = append([]string{"build"}, args...)
cmd := exec.Command("go", args...) cmd := exec.Command("go", args...)
cmd.Env = append(cleanEnv(), "GOPATH="+gopath) cmd.Env = append(cleanEnv(), "GOPATH="+gopath)
cmd.Dir = cwd
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
verbosePrintf("go %s\n", args) 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. // 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...) args = append([]string{"test"}, args...)
cmd := exec.Command("go", args...) cmd := exec.Command("go", args...)
cmd.Env = append(cleanEnv(), "GOPATH="+gopath) cmd.Env = append(cleanEnv(), "GOPATH="+gopath)
cmd.Dir = cwd
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
verbosePrintf("go %s\n", args) verbosePrintf("go %s\n", args)
@ -293,6 +299,7 @@ func main() {
runTests = true runTests = true
case "-h": case "-h":
showUsage(os.Stdout) showUsage(os.Stdout)
return
default: default:
fmt.Fprintf(os.Stderr, "Error: unknown option %q\n\n", arg) fmt.Fprintf(os.Stderr, "Error: unknown option %q\n\n", arg)
showUsage(os.Stderr) showUsage(os.Stderr)
@ -322,11 +329,11 @@ func main() {
} }
verbosePrintf("create GOPATH at %v\n", gopath) 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) 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 { if err = updateGopath(gopath, vendor, ""); err != nil {
die("copying files from %v to %v failed: %v\n", root, gopath, err) 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" { 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() version := getVersion()
compileTime := time.Now().Format(timeFormat) compileTime := time.Now().Format(timeFormat)
constants := Constants{`main.compiledAt`: compileTime} constants := Constants{`main.compiledAt`: compileTime}
@ -358,10 +372,10 @@ func main() {
args := []string{ args := []string{
"-tags", strings.Join(buildTags, " "), "-tags", strings.Join(buildTags, " "),
"-ldflags", ldflags, "-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 { if err != nil {
die("build failed: %v\n", err) die("build failed: %v\n", err)
} }
@ -369,7 +383,7 @@ func main() {
if runTests { if runTests {
verbosePrintf("running tests\n") verbosePrintf("running tests\n")
err = test(gopath, "github.com/restic/restic/...") err = test(filepath.Join(gopath, "src"), gopath, "restic/...")
if err != nil { if err != nil {
die("running tests failed: %v\n", err) die("running tests failed: %v\n", err)
} }

View File

@ -154,27 +154,31 @@ func (env *TravisEnvironment) RunTests() {
os.Setenv("RESTIC_TEST_FUSE", "0") 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 { if *runCrossCompile {
// compile for all target architectures with tags // compile for all target architectures with tags
for _, tags := range []string{"release", "debug"} { for _, tags := range []string{"release", "debug"} {
run("gox", "-verbose", runWithEnv(envWithGOPATH, "gox", "-verbose",
"-os", strings.Join(env.goxOS, " "), "-os", strings.Join(env.goxOS, " "),
"-arch", strings.Join(env.goxArch, " "), "-arch", strings.Join(env.goxArch, " "),
"-tags", tags, "-tags", tags,
"-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}", "-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}",
"./cmd/restic") "restic/cmd/restic")
} }
} }
// run the build script // run the build script
run("go", "run", "build.go") run("go", "run", "build.go")
var ( var srv *MinioServer
testEnv map[string]string
srv *MinioServer
err error
)
if env.minio != "" { if env.minio != "" {
srv, err = NewMinioServer(env.minio) srv, err = NewMinioServer(env.minio)
if err != nil { if err != nil {
@ -182,11 +186,13 @@ func (env *TravisEnvironment) RunTests() {
os.Exit(8) os.Exit(8)
} }
testEnv = minioEnv for k, v := range minioEnv {
envWithGOPATH[k] = v
}
} }
// run the tests and gather coverage information // run the tests and gather coverage information
runWithEnv(testEnv, "gotestcover", "-coverprofile", "all.cov", "./...") runWithEnv(envWithGOPATH, "gotestcover", "-coverprofile", "all.cov", "restic/...")
runGofmt() runGofmt()
@ -206,7 +212,7 @@ func (env *AppveyorEnvironment) RunTests() {
// findGoFiles returns a list of go source code file names below dir. // findGoFiles returns a list of go source code file names below dir.
func findGoFiles(dir string) (list []string, err error) { func findGoFiles(dir string) (list []string, err error) {
err = filepath.Walk(dir, func(name string, fi os.FileInfo, err error) 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 return filepath.SkipDir
} }

View File

@ -12,11 +12,11 @@ import (
"time" "time"
"github.com/restic/chunker" "github.com/restic/chunker"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/pipe" "restic/pipe"
"github.com/restic/restic/repository" "restic/repository"
"github.com/juju/errors" "github.com/juju/errors"
) )

View File

@ -10,10 +10,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
) )
const parallelSaves = 50 const parallelSaves = 50

View File

@ -4,7 +4,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/restic/restic/pipe" "restic/pipe"
) )
var treeJobs = []string{ var treeJobs = []string{

View File

@ -8,13 +8,13 @@ import (
"time" "time"
"github.com/restic/chunker" "github.com/restic/chunker"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/checker" "restic/checker"
"github.com/restic/restic/crypto" "restic/crypto"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
. "github.com/restic/restic/test" . "restic/test"
) )
var testPol = chunker.Pol(0x3DA3358B4DC173) var testPol = chunker.Pol(0x3DA3358B4DC173)

View File

@ -3,8 +3,8 @@ package backend_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
. "github.com/restic/restic/test" . "restic/test"
) )
type mockBackend struct { type mockBackend struct {

View File

@ -3,8 +3,8 @@ package backend_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
. "github.com/restic/restic/test" . "restic/test"
) )
var TestStrings = []struct { var TestStrings = []struct {

View File

@ -4,8 +4,8 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
. "github.com/restic/restic/test" . "restic/test"
) )
var uniqTests = []struct { var uniqTests = []struct {

View File

@ -3,8 +3,8 @@ package backend_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
. "github.com/restic/restic/test" . "restic/test"
) )
var idsetTests = []struct { var idsetTests = []struct {

View File

@ -4,7 +4,7 @@ package local_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -8,8 +8,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
) )
// Local is a backend in a local directory. // Local is a backend in a local directory.

View File

@ -5,9 +5,9 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/local" "restic/backend/local"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var tempBackendDir string var tempBackendDir string

View File

@ -4,7 +4,7 @@ package mem_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -5,8 +5,8 @@ import (
"io" "io"
"sync" "sync"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
) )
type entry struct { type entry struct {

View File

@ -3,9 +3,9 @@ package mem_test
import ( import (
"errors" "errors"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/mem" "restic/backend/mem"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var be backend.Backend var be backend.Backend

View File

@ -4,7 +4,7 @@ package s3_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -8,8 +8,8 @@ import (
"github.com/minio/minio-go" "github.com/minio/minio-go"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
) )
const connLimit = 10 const connLimit = 10

View File

@ -6,10 +6,10 @@ import (
"net/url" "net/url"
"os" "os"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/s3" "restic/backend/s3"
"github.com/restic/restic/backend/test" "restic/backend/test"
. "github.com/restic/restic/test" . "restic/test"
) )
//go:generate go run ../test/generate_backend_tests.go //go:generate go run ../test/generate_backend_tests.go

View File

@ -4,7 +4,7 @@ package sftp_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -13,8 +13,8 @@ import (
"github.com/juju/errors" "github.com/juju/errors"
"github.com/pkg/sftp" "github.com/pkg/sftp"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
) )
const ( const (

View File

@ -7,11 +7,11 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/sftp" "restic/backend/sftp"
"github.com/restic/restic/backend/test" "restic/backend/test"
. "github.com/restic/restic/test" . "restic/test"
) )
var tempBackendDir string var tempBackendDir string

View File

@ -4,7 +4,7 @@ package test_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -30,7 +30,7 @@ package {{ .Package }}
import ( import (
"testing" "testing"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var SkipMessage string var SkipMessage string

View File

@ -10,8 +10,8 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
. "github.com/restic/restic/test" . "restic/test"
) )
// CreateFn is a function that creates a temporary repository for the tests. // CreateFn is a function that creates a temporary repository for the tests.

View File

@ -3,9 +3,9 @@ package test_test
import ( import (
"errors" "errors"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/mem" "restic/backend/mem"
"github.com/restic/restic/backend/test" "restic/backend/test"
) )
var be backend.Backend var be backend.Backend

View File

@ -5,9 +5,9 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/mem" "restic/backend/mem"
. "github.com/restic/restic/test" . "restic/test"
) )
const KiB = 1 << 10 const KiB = 1 << 10

View File

@ -9,9 +9,9 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/repository" "restic/repository"
) )
// Cache is used to locally cache items from a repository. // Cache is used to locally cache items from a repository.

View File

@ -3,8 +3,8 @@ package restic_test
import ( import (
"testing" "testing"
"github.com/restic/restic" "restic"
. "github.com/restic/restic/test" . "restic/test"
) )
func TestCache(t *testing.T) { func TestCache(t *testing.T) {

View File

@ -6,12 +6,12 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/crypto" "restic/crypto"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
) )
// Checker runs various checks on a repository. It is advisable to create an // Checker runs various checks on a repository. It is advisable to create an

View File

@ -7,12 +7,12 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/backend/mem" "restic/backend/mem"
"github.com/restic/restic/checker" "restic/checker"
"github.com/restic/restic/repository" "restic/repository"
. "github.com/restic/restic/test" . "restic/test"
) )
var checkerTestData = filepath.Join("testdata", "checker-test-repo.tar.gz") var checkerTestData = filepath.Join("testdata", "checker-test-repo.tar.gz")

View File

@ -3,9 +3,9 @@ package checker
import ( import (
"errors" "errors"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/repository" "restic/repository"
) )
// Repacker extracts still used blobs from packs with unused blobs and creates // Repacker extracts still used blobs from packs with unused blobs and creates

View File

@ -3,10 +3,10 @@ package checker_test
import ( import (
"testing" "testing"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/checker" "restic/checker"
. "github.com/restic/restic/test" . "restic/test"
) )
var findPackTests = []struct { var findPackTests = []struct {

View File

@ -7,7 +7,7 @@ import (
"sync" "sync"
"syscall" "syscall"
"github.com/restic/restic/debug" "restic/debug"
) )
var cleanupHandlers struct { var cleanupHandlers struct {

View File

@ -8,12 +8,12 @@ import (
"strings" "strings"
"time" "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" "golang.org/x/crypto/ssh/terminal"
"restic"
"restic/backend"
"restic/debug"
"restic/filter"
"restic/repository"
) )
type CmdBackup struct { type CmdBackup struct {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/restic/restic" "restic"
) )
type CmdCache struct { type CmdCache struct {

View File

@ -6,11 +6,11 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdCat struct { type CmdCat struct {

View File

@ -8,8 +8,8 @@ import (
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
"github.com/restic/restic" "restic"
"github.com/restic/restic/checker" "restic/checker"
) )
type CmdCheck struct { type CmdCheck struct {

View File

@ -9,10 +9,10 @@ import (
"os" "os"
"github.com/juju/errors" "github.com/juju/errors"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdDump struct { type CmdDump struct {

View File

@ -5,10 +5,10 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/repository" "restic/repository"
) )
type findResult struct { type findResult struct {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"errors" "errors"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdInit struct { type CmdInit struct {

View File

@ -4,8 +4,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdKey struct { type CmdKey struct {

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/restic/restic/backend" "restic/backend"
) )
type CmdList struct { type CmdList struct {

View File

@ -5,9 +5,9 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdLs struct { type CmdLs struct {

View File

@ -7,7 +7,7 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/restic/restic/fuse" "restic/fuse"
systemFuse "bazil.org/fuse" systemFuse "bazil.org/fuse"
"bazil.org/fuse/fs" "bazil.org/fuse/fs"

View File

@ -4,8 +4,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/checker" "restic/checker"
) )
type CmdOptimize struct { type CmdOptimize struct {

View File

@ -4,10 +4,10 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/pack" "restic/pack"
"github.com/restic/restic/repository" "restic/repository"
) )
type CmdRebuildIndex struct { type CmdRebuildIndex struct {

View File

@ -4,9 +4,9 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/restic/restic" "restic"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/filter" "restic/filter"
) )
type CmdRestore struct { type CmdRestore struct {

View File

@ -8,8 +8,8 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
) )
type Table struct { type Table struct {

View File

@ -1,6 +1,6 @@
package main package main
import "github.com/restic/restic" import "restic"
type CmdUnlock struct { type CmdUnlock struct {
RemoveAll bool `long:"remove-all" description:"Remove all locks, even stale ones"` RemoveAll bool `long:"remove-all" description:"Remove all locks, even stale ones"`

View File

@ -9,14 +9,14 @@ import (
"syscall" "syscall"
"github.com/jessevdk/go-flags" "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" "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" var version = "compiled manually"

View File

@ -11,10 +11,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/restic/restic" "restic"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/repository" "restic/repository"
. "github.com/restic/restic/test" . "restic/test"
) )
const ( const (

View File

@ -8,7 +8,7 @@ import (
"runtime" "runtime"
"testing" "testing"
. "github.com/restic/restic/test" . "restic/test"
) )
type dirEntry struct { type dirEntry struct {

View File

@ -15,11 +15,11 @@ import (
"testing" "testing"
"time" "time"
"github.com/restic/restic/backend" "restic/backend"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/filter" "restic/filter"
"github.com/restic/restic/repository" "restic/repository"
. "github.com/restic/restic/test" . "restic/test"
) )
func parseIDsFromReader(t testing.TB, rd io.Reader) backend.IDs { func parseIDsFromReader(t testing.TB, rd io.Reader) backend.IDs {

View File

@ -6,9 +6,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/restic/restic" "restic"
"github.com/restic/restic/debug" "restic/debug"
"github.com/restic/restic/repository" "restic/repository"
) )
var globalLocks struct { var globalLocks struct {

View File

@ -6,8 +6,8 @@ import (
"runtime" "runtime"
"github.com/jessevdk/go-flags" "github.com/jessevdk/go-flags"
"github.com/restic/restic" "restic"
"github.com/restic/restic/debug" "restic/debug"
) )
func init() { func init() {

Some files were not shown because too many files have changed in this diff Show More