factor out common imports
no code changes
This commit is contained in:
parent
003a604a6e
commit
8ef2095fa0
83 changed files with 264 additions and 619 deletions
|
@ -9,25 +9,14 @@ module Remote.Directory (remote) where
|
|||
|
||||
import qualified Data.ByteString.Lazy.Char8 as L
|
||||
import System.IO.Error
|
||||
import Control.Exception.Extensible (IOException)
|
||||
import qualified Data.Map as M
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.State (liftIO)
|
||||
import System.Directory hiding (copyFile)
|
||||
import System.FilePath
|
||||
import Data.Maybe
|
||||
|
||||
import Types
|
||||
import AnnexCommon
|
||||
import Utility.CopyFile
|
||||
import Types.Remote
|
||||
import qualified Git
|
||||
import qualified Annex
|
||||
import UUID
|
||||
import Locations
|
||||
import Utility.CopyFile
|
||||
import Config
|
||||
import Utility
|
||||
import Utility.Conditional
|
||||
import Utility.Path
|
||||
import Utility.FileMode
|
||||
import Remote.Helper.Special
|
||||
import Remote.Helper.Encryptable
|
||||
|
@ -82,14 +71,14 @@ dirKey d k = d </> hashDirMixed k </> f </> f
|
|||
|
||||
store :: FilePath -> Key -> Annex Bool
|
||||
store d k = do
|
||||
g <- Annex.gitRepo
|
||||
g <- gitRepo
|
||||
let src = gitAnnexLocation g k
|
||||
let dest = dirKey d k
|
||||
liftIO $ catchBool $ storeHelper dest $ copyFile src dest
|
||||
liftIO $ catchBool $ storeHelper dest $ copyFileExternal src dest
|
||||
|
||||
storeEncrypted :: FilePath -> (Cipher, Key) -> Key -> Annex Bool
|
||||
storeEncrypted d (cipher, enck) k = do
|
||||
g <- Annex.gitRepo
|
||||
g <- gitRepo
|
||||
let src = gitAnnexLocation g k
|
||||
let dest = dirKey d enck
|
||||
liftIO $ catchBool $ storeHelper dest $ encrypt src dest
|
||||
|
@ -110,7 +99,7 @@ storeHelper dest a = do
|
|||
return ok
|
||||
|
||||
retrieve :: FilePath -> Key -> FilePath -> Annex Bool
|
||||
retrieve d k f = liftIO $ copyFile (dirKey d k) f
|
||||
retrieve d k f = liftIO $ copyFileExternal (dirKey d k) f
|
||||
|
||||
retrieveEncrypted :: FilePath -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted d (cipher, enck) f =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue