refactoring, no code changes really
This commit is contained in:
parent
02a21d7f27
commit
070e8530c1
19 changed files with 105 additions and 74 deletions
|
@ -19,6 +19,7 @@ import qualified Backend
|
|||
import LocationLog
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- The add subcommand annexes a file, storing it in a backend, and then
|
||||
- moving it into the annex directory and setting up the symlink pointing
|
||||
|
|
|
@ -17,6 +17,7 @@ import qualified Backend
|
|||
import LocationLog
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Indicates a file's content is not wanted anymore, and should be removed
|
||||
- if it's safe to do so. -}
|
||||
|
|
|
@ -17,6 +17,7 @@ import qualified Backend
|
|||
import LocationLog
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Drops cached content for a key. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -15,6 +15,7 @@ import Command
|
|||
import qualified Annex
|
||||
import Utility
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Fixes the symlink to an annexed file. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -18,6 +18,7 @@ import Utility
|
|||
import qualified Backend
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Adds a file pointing at a manually-specified key -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -8,19 +8,11 @@
|
|||
module Command.Fsck where
|
||||
|
||||
import qualified Data.Map as M
|
||||
import System.Directory
|
||||
import System.Posix.Files
|
||||
import Monad (filterM)
|
||||
import Control.Monad.State (liftIO)
|
||||
import Data.Maybe
|
||||
|
||||
import Command
|
||||
import Types
|
||||
import Core
|
||||
import Locations
|
||||
import qualified Annex
|
||||
import qualified GitRepo as Git
|
||||
import qualified Backend
|
||||
import Messages
|
||||
|
||||
{- Checks the whole annex for problems. -}
|
||||
start :: SubCmdStart
|
||||
|
@ -71,22 +63,3 @@ unusedKeys = do
|
|||
|
||||
existsMap :: Ord k => [k] -> M.Map k Int
|
||||
existsMap l = M.fromList $ map (\k -> (k, 1)) l
|
||||
|
||||
getKeysPresent :: Annex [Key]
|
||||
getKeysPresent = do
|
||||
g <- Annex.gitRepo
|
||||
let top = annexDir g
|
||||
contents <- liftIO $ getDirectoryContents top
|
||||
files <- liftIO $ filterM (isreg top) contents
|
||||
return $ map fileKey files
|
||||
where
|
||||
isreg top f = do
|
||||
s <- getFileStatus $ top ++ "/" ++ f
|
||||
return $ isRegularFile s
|
||||
|
||||
getKeysReferenced :: Annex [Key]
|
||||
getKeysReferenced = do
|
||||
g <- Annex.gitRepo
|
||||
files <- liftIO $ Git.inRepo g $ Git.workTree g
|
||||
keypairs <- mapM Backend.lookupFile files
|
||||
return $ map fst $ catMaybes keypairs
|
||||
|
|
|
@ -11,6 +11,7 @@ import Command
|
|||
import qualified Backend
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Gets an annexed file from one of the backends. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -15,6 +15,7 @@ import qualified Annex
|
|||
import Core
|
||||
import qualified GitRepo as Git
|
||||
import UUID
|
||||
import Messages
|
||||
|
||||
{- Stores description for the repository etc. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -20,6 +20,7 @@ import Core
|
|||
import qualified GitRepo as Git
|
||||
import qualified Remotes
|
||||
import UUID
|
||||
import Messages
|
||||
|
||||
{- Move a file either --to or --from a repository.
|
||||
-
|
||||
|
@ -64,7 +65,7 @@ moveToPerform key = do
|
|||
showNote $ show err
|
||||
return Nothing
|
||||
Right False -> do
|
||||
Core.showNote $ "moving to " ++ (Git.repoDescribe remote) ++ "..."
|
||||
showNote $ "moving to " ++ (Git.repoDescribe remote) ++ "..."
|
||||
let tmpfile = (annexTmpLocation remote) ++ (keyFile key)
|
||||
ok <- Remotes.copyToRemote remote key tmpfile
|
||||
if (ok)
|
||||
|
@ -112,7 +113,7 @@ moveFromPerform key = do
|
|||
if (ishere)
|
||||
then return $ Just $ moveFromCleanup remote key
|
||||
else do
|
||||
Core.showNote $ "moving from " ++ (Git.repoDescribe remote) ++ "..."
|
||||
showNote $ "moving from " ++ (Git.repoDescribe remote) ++ "..."
|
||||
ok <- getViaTmp key (Remotes.copyFromRemote remote key)
|
||||
if (ok)
|
||||
then return $ Just $ moveFromCleanup remote key
|
||||
|
|
|
@ -18,6 +18,7 @@ import qualified Backend
|
|||
import LocationLog
|
||||
import Types
|
||||
import Core
|
||||
import Messages
|
||||
|
||||
{- Sets cached content for a key. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
|
@ -19,6 +19,7 @@ import LocationLog
|
|||
import Types
|
||||
import Core
|
||||
import qualified GitRepo as Git
|
||||
import Messages
|
||||
|
||||
{- The unannex subcommand undoes an add. -}
|
||||
start :: SubCmdStartString
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue