Compare commits

...
9 Commits
Author SHA1 Message Date
Nick Craig-Wood 37b2274e10 Version 1.01 2014-07-04 21:15:27 +01:00
Nick Craig-Wood 91cfbd4146 drive: fix transfer of big files using up lots of memory - fixes #5
This was done by making a seekWrapper which wraps an io.Reader with a
basic Seek for code.google.com/p/google-api-go-client/googleapi to
detect the length.  Without this the getReaderSize function reads the
entire file into memory to find its length.
2014-07-04 17:17:21 +01:00
Nick Craig-Wood d4817399ff Fix release procedure 2014-07-03 22:01:25 +01:00
Nick Craig-Wood 48d259da68 Version 1.00 2014-07-03 21:56:54 +01:00
Nick Craig-Wood f86fa6a062 Fix make tag 2014-07-03 21:43:14 +01:00
Nick Craig-Wood 93cb0a47e4 drive: fix whole second dates - fixes #4 2014-07-03 21:32:01 +01:00
Nick Craig-Wood a12760c038 Travis build correction - fixes #2 2014-06-26 19:05:48 +01:00
Nick Craig-Wood fdcd6a3a4c Add travis build file 2014-06-26 18:23:54 +01:00
Nick Craig-Wood cb7891f4ff Fix retag 2014-06-26 17:57:32 +01:00
9 changed files with 82 additions and 38 deletions

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
language: go
go:
- 1.1.2
- 1.2.2
- 1.3
- tip
script:
- go get ./...
- go test -v ./...
+3 -4
View File
@@ -1,6 +1,6 @@
TAG := $(shell git describe --tags)
LAST_TAG := $(shell git describe --tags --abbrev=0)
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = "v" . $$_')
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')
rclone: *.go */*.go
@go version
@@ -50,12 +50,11 @@ tag:
perl -lpe 's/VERSION/${NEW_TAG}/g; s/DATE/'`date -I`'/g;' docs/content/downloads.md.in > docs/content/downloads.md
git tag $(NEW_TAG)
@echo "Add this to changelog in README.md"
@echo " * $(NEW_TAG) - " `date -I`
@echo " * $(NEW_TAG) -" `date -I`
@git log $(LAST_TAG)..$(NEW_TAG) --oneline
@echo "Then commit the changes"
@echo git commit -m "Version $(NEW_TAG)" -a -v
@echo "And finally run make retag before make cross etc"
retag:
echo git tag -f $(LAST_TAG)
git tag -f $(LAST_TAG)
+5 -1
View File
@@ -1,6 +1,6 @@
% rclone(1) User Manual
% Nick Craig-Wood
% Apr 24, 2014
% Jul 7, 2014
Rclone
======
@@ -214,6 +214,10 @@ Bugs
Changelog
---------
* v1.01 - 2014-07-04
* drive: fix transfer of big files using up lots of memory
* v1.00 - 2014-07-03
* drive: fix whole second dates
* v0.99 - 2014-06-26
* Fix --dry-run not working
* Make compatible with go 1.1
+18 -18
View File
@@ -2,34 +2,34 @@
title: "Rclone downloads"
description: "Download rclone binaries for your OS."
type: page
date: "2014-06-26"
date: "2014-07-04"
---
Rclone Download v0.99
Rclone Download v1.01
=====================
* Windows
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-windows-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-windows-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-windows-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-windows-amd64.zip)
* OSX
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-osx-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-osx-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-osx-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-osx-amd64.zip)
* Linux
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-linux-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-linux-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v0.99-linux-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-linux-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-linux-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.01-linux-arm.zip)
* FreeBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-freebsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-freebsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v0.99-freebsd-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-freebsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-freebsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.01-freebsd-arm.zip)
* NetBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-netbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-netbsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v0.99-netbsd-arm.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-netbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-netbsd-amd64.zip)
* [ARM - 32 Bit](http://downloads.rclone.org/rclone-v1.01-netbsd-arm.zip)
* OpenBSD
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-openbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v0.99-openbsd-amd64.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-openbsd-386.zip)
* [AMD64 - 64 Bit](http://downloads.rclone.org/rclone-v1.01-openbsd-amd64.zip)
* Plan 9
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v0.99-plan9-386.zip)
* [386 - 32 Bit](http://downloads.rclone.org/rclone-v1.01-plan9-386.zip)
Older downloads can be found [here](http://downloads.rclone.org/)
+34 -5
View File
@@ -22,6 +22,7 @@ import (
"log"
"mime"
"net/http"
"os"
"path"
"strings"
"sync"
@@ -38,6 +39,8 @@ const (
rcloneClientId = "202264815644.apps.googleusercontent.com"
rcloneClientSecret = "X4Z3ca8xfWDb1Voo-F9a7ZxJ"
driveFolderType = "application/vnd.google-apps.folder"
RFC3339In = time.RFC3339
RFC3339Out = "2006-01-02T15:04:05.000000000Z07:00"
)
// Globals
@@ -674,7 +677,7 @@ func (f *FsDrive) ListDir() fs.DirChan {
Bytes: -1,
Count: -1,
}
dir.When, _ = time.Parse(time.RFC3339, item.ModifiedDate)
dir.When, _ = time.Parse(RFC3339In, item.ModifiedDate)
out <- dir
return false
})
@@ -687,6 +690,30 @@ func (f *FsDrive) ListDir() fs.DirChan {
return out
}
// seekWrapper wraps an io.Reader with a basic Seek for
// code.google.com/p/google-api-go-client/googleapi
// to detect the length (see getReaderSize function)
type seekWrapper struct {
in io.Reader
size int64
}
// Read bytes from the object - see io.Reader
func (file *seekWrapper) Read(p []byte) (n int, err error) {
return file.in.Read(p)
}
// Seek - minimal implementation for Google Drive's length detection
func (file *seekWrapper) Seek(offset int64, whence int) (int64, error) {
switch whence {
case os.SEEK_CUR:
return 0, nil
case os.SEEK_END:
return file.size, nil
}
return 0, nil
}
// Put the object
//
// This assumes that the object doesn't not already exists - if you
@@ -711,7 +738,7 @@ func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64
if mimeType == "" {
mimeType = "application/octet-stream"
}
modifiedDate := modTime.Format(time.RFC3339Nano)
modifiedDate := modTime.Format(RFC3339Out)
// Define the metadata for the file we are going to create.
info := &drive.File{
@@ -723,6 +750,7 @@ func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64
}
// Make the API request to upload metadata and file data.
in = &seekWrapper{in: in, size: size}
info, err = f.svc.Files.Insert(info).Media(in).Do()
if err != nil {
return o, fmt.Errorf("Upload failed: %s", err)
@@ -864,7 +892,7 @@ func (o *FsObjectDrive) ModTime() time.Time {
fs.Log(o, "Failed to read metadata: %s", err)
return time.Now()
}
modTime, err := time.Parse(time.RFC3339, o.modifiedDate)
modTime, err := time.Parse(RFC3339In, o.modifiedDate)
if err != nil {
fs.Log(o, "Failed to read mtime from object: %s", err)
return time.Now()
@@ -882,7 +910,7 @@ func (o *FsObjectDrive) SetModTime(modTime time.Time) {
}
// New metadata
info := &drive.File{
ModifiedDate: modTime.Format(time.RFC3339Nano),
ModifiedDate: modTime.Format(RFC3339Out),
}
// Set modified date
_, err = o.drive.svc.Files.Update(o.id, info).SetModifiedDate(true).Do()
@@ -920,10 +948,11 @@ func (o *FsObjectDrive) Open() (in io.ReadCloser, err error) {
func (o *FsObjectDrive) Update(in io.Reader, modTime time.Time, size int64) error {
info := &drive.File{
Id: o.id,
ModifiedDate: modTime.Format(time.RFC3339Nano),
ModifiedDate: modTime.Format(RFC3339Out),
}
// Make the API request to upload metadata and file data.
in = &seekWrapper{in: in, size: size}
info, err := o.drive.svc.Files.Update(info.Id, info).SetModifiedDate(true).Media(in).Do()
if err != nil {
return fmt.Errorf("Update failed: %s", err)
+2 -2
View File
@@ -54,11 +54,11 @@ Making a release
* ./rclonetest /tmp/z
* cd ..
* make tag
* edit README.md Changelog
* edit README.md
* git commit version.go rclonetest/version.go README.md docs/content/downloads.md
* make retag
* . ~/bin/go-cross
* make cross
* make upload
* make upload_website
* git push --tags
* git push --tags origin master
+7 -6
View File
@@ -145,8 +145,9 @@ func TestMkdir(flocal, fremote fs.Fs) {
CheckListing(fremote, items)
}
var t1 = Time("2001-02-03T04:05:06.999999999Z")
var t1 = Time("2001-02-03T04:05:06.499999999Z")
var t2 = Time("2011-12-25T12:59:59.123456789Z")
var t3 = Time("2011-12-30T12:59:59.000000000Z")
func TestCopy(flocal, fremote fs.Fs) {
WriteFile("empty space", "", t1)
@@ -198,14 +199,14 @@ func TestSync(flocal, fremote fs.Fs) {
// ------------------------------------------------------------
log.Printf("Sync after adding a file")
WriteFile("potato", "------------------------------------------------------------", t1)
WriteFile("potato", "------------------------------------------------------------", t3)
err = fs.Sync(fremote, flocal, true)
if err != nil {
log.Fatalf("Sync failed: %v", err)
}
items = []Item{
{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},
{Path: "potato", Size: 60, ModTime: t1, Md5sum: "d6548b156ea68a4e003e786df99eee76"},
{Path: "potato", Size: 60, ModTime: t3, Md5sum: "d6548b156ea68a4e003e786df99eee76"},
}
CheckListing(flocal, items)
CheckListing(fremote, items)
@@ -213,14 +214,14 @@ func TestSync(flocal, fremote fs.Fs) {
// ------------------------------------------------------------
log.Printf("Sync after changing a file's size only")
WriteFile("potato", "smaller but same date", t1)
WriteFile("potato", "smaller but same date", t3)
err = fs.Sync(fremote, flocal, true)
if err != nil {
log.Fatalf("Sync failed: %v", err)
}
items = []Item{
{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},
{Path: "potato", Size: 21, ModTime: t1, Md5sum: "100defcf18c42a1e0dc42a789b107cd2"},
{Path: "potato", Size: 21, ModTime: t3, Md5sum: "100defcf18c42a1e0dc42a789b107cd2"},
}
CheckListing(flocal, items)
CheckListing(fremote, items)
@@ -242,7 +243,7 @@ func TestSync(flocal, fremote fs.Fs) {
before := []Item{
{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},
{Path: "potato", Size: 21, ModTime: t1, Md5sum: "100defcf18c42a1e0dc42a789b107cd2"},
{Path: "potato", Size: 21, ModTime: t3, Md5sum: "100defcf18c42a1e0dc42a789b107cd2"},
}
items = []Item{
{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},
+1 -1
View File
@@ -1,3 +1,3 @@
package main
const Version = "v0.99"
const Version = "v1.01"
+1 -1
View File
@@ -1,3 +1,3 @@
package main
const Version = "v0.99"
const Version = "v1.01"