diff options
author | 2010-12-02 16:55:21 -0400 | |
---|---|---|
committer | 2010-12-02 16:55:21 -0400 | |
commit | 37941184f99896a459fd889071e47ed2fa5ceaa6 (patch) | |
tree | 94912fc9a9e25469cdcd1b7e306da5158d91d202 | |
parent | ade43d8fab2b42846a06201f03e4a03255ef8fce (diff) |
Rsync will now be used to resume interrupted/failed partial file transfers from a remote.
-rw-r--r-- | Remotes.hs | 20 | ||||
-rw-r--r-- | configure.hs | 11 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | doc/install.mdwn | 1 | ||||
-rw-r--r-- | doc/todo/rsync.mdwn | 2 |
6 files changed, 35 insertions, 10 deletions
diff --git a/Remotes.hs b/Remotes.hs index cb8081d74..6bb67216b 100644 --- a/Remotes.hs +++ b/Remotes.hs @@ -36,6 +36,7 @@ import Utility import qualified Core import Messages import CopyFile +import qualified SysConfig {- Human visible list of remotes. -} list :: [Git.Repo] -> String @@ -199,9 +200,13 @@ copyFromRemote r key file | Git.repoIsSsh r = getssh | otherwise = error "copying from non-ssh repo not supported" where - getlocal = liftIO $ copyFile keyloc file - getssh = scp r [sshLocation r keyloc, file] keyloc = annexLocation r key + getlocal = liftIO $ copyFile keyloc file + getssh = do + exists <- liftIO $ doesFileExist file + if exists && SysConfig.rsync + then rsync r [sshLocation r keyloc, file] + else scp r [sshLocation r keyloc, file] {- Tries to copy a key's content to a file on a remote. -} copyToRemote :: Git.Repo -> Key -> FilePath -> Annex Bool @@ -224,9 +229,18 @@ sshLocation r file = Git.urlHost r ++ ":" ++ shellEscape file scp :: Git.Repo -> [String] -> Annex Bool scp r params = do scpoptions <- repoConfig r "scp-options" "" - showProgress -- make way for scp progress bar + showProgress -- make way for progress bar liftIO $ boolSystem "scp" $ "-p":(words scpoptions) ++ params +{- Runs rsync against a specified remote, resuming any interrupted file + - transfer. (Honors annex-rsync-options.) -} +rsync :: Git.Repo -> [String] -> Annex Bool +rsync r params = do + rsyncoptions <- repoConfig r "rsync-options" "" + showProgress -- make way for progress bar + liftIO $ boolSystem "rsync" $ ["--progress", "-a", "--inplace"] ++ + words rsyncoptions ++ params + {- Runs a command in a remote, using ssh if necessary. - (Honors annex-ssh-options.) -} runCmd :: Git.Repo -> String -> [String] -> Annex Bool diff --git a/configure.hs b/configure.hs index 92a051c80..2334385a3 100644 --- a/configure.hs +++ b/configure.hs @@ -20,8 +20,9 @@ tests = [ TestCase "cp -a" "cp_a" $ testCp "-a" , TestCase "cp -p" "cp_p" $ testCp "-p" , TestCase "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto" - , TestCase "uuid" "uuid" $ requireCommand "uuid" "uuid" - , TestCase "xargs -0" "xargs_0" $ requireCommand "xargs -0" "xargs -0 </dev/null" + , TestCase "uuid" "uuid" $ requireCmd "uuid" "uuid" + , TestCase "xargs -0" "xargs_0" $ requireCmd "xargs -0" "xargs -0 </dev/null" + , TestCase "rsync" "rsync" $ testCmd "rsync --version >/dev/null" ] tmpDir :: String @@ -33,14 +34,14 @@ testFile = tmpDir ++ "/testfile" quiet :: String -> String quiet s = s ++ " >/dev/null 2>&1" -requireCommand :: String -> String -> Test -requireCommand command cmdline = do +requireCmd :: String -> String -> Test +requireCmd c cmdline = do ret <- testCmd $ quiet cmdline if ret then return True else do testEnd False - error $ "** the " ++ command ++ " command is required to use git-annex" + error $ "** the " ++ c ++ " command is required to use git-annex" testCp :: String -> Test testCp option = testCmd $ quiet $ "cp " ++ option ++ " " ++ testFile ++ diff --git a/debian/changelog b/debian/changelog index b87f835b8..0bdfbf76a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (0.11) UNRELEASED; urgency=low + + * Rsync will now be used to resume interrupted/failed partial file + transfers from a remote. + + -- Joey Hess <joeyh@debian.org> Thu, 02 Dec 2010 16:54:12 -0400 + git-annex (0.10) unstable; urgency=low * In .gitattributes, the annex.numcopies attribute can be used diff --git a/debian/control b/debian/control index 0318dafa4..88dcab9a3 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: git-annex Section: utils Priority: optional -Build-Depends: debhelper (>= 7.0.50), ghc6, libghc6-missingh-dev, libghc6-testpack-dev, ikiwiki, uuid +Build-Depends: debhelper (>= 7.0.50), ghc6, libghc6-missingh-dev, libghc6-testpack-dev, ikiwiki, uuid, rsync Maintainer: Joey Hess <joeyh@debian.org> Standards-Version: 3.9.1 Vcs-Git: git://git.kitenet.net/git-annex @@ -10,7 +10,7 @@ Homepage: http://git-annex.branchable.com/ Package: git-annex Architecture: any Section: utils -Depends: ${misc:Depends}, ${shlibs:Depends}, git | git-core, uuid, openssh-client +Depends: ${misc:Depends}, ${shlibs:Depends}, git | git-core, uuid, openssh-client, rsync Description: manage files with git, without checking their contents into git git-annex allows managing files with git, without checking the file contents into git. While that may seem paradoxical, it is useful when diff --git a/doc/install.mdwn b/doc/install.mdwn index ec9ea92c7..bca6eb019 100644 --- a/doc/install.mdwn +++ b/doc/install.mdwn @@ -5,6 +5,7 @@ To build and use git-annex, you will need: * MissingH: <http://github.com/jgoerzen/missingh/wiki> * `uuid`: <http://www.ossp.org/pkg/lib/uuid/> * `xargs`: <http://savannah.gnu.org/projects/findutils/> +* `rsync` (optional but recommended) * Then just [[download]] git-annex and run: `make; make install` ([Ikiwiki](http://ikiwiki.info) is needed to build the documentation, diff --git a/doc/todo/rsync.mdwn b/doc/todo/rsync.mdwn index 75e0175c8..3353f19c4 100644 --- a/doc/todo/rsync.mdwn +++ b/doc/todo/rsync.mdwn @@ -1,2 +1,4 @@ Transferring a file from a ssh:// remote should use rsync to allow resuming of a prior transfer. + +[[done]] |