diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-28 22:20:22 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-28 22:20:22 -0400 |
commit | 25b13673f0574ad2cc7baa055d08c13da134821a (patch) | |
tree | 6efdb6be57b087fcb0962671ec48b1f18ce5ef6a | |
parent | fdead6b9bb0883dd982e72e955fc58dee844f2ca (diff) |
improve unused command's output
Display the name of the remote being checked, with "." for the current
remote, echoing the way describe takes that to change its description.
-rw-r--r-- | Command/Unused.hs | 27 | ||||
-rw-r--r-- | doc/special_remotes.mdwn | 2 | ||||
-rw-r--r-- | doc/walkthrough/fsck:_verifying_your_data.mdwn | 2 | ||||
-rw-r--r-- | doc/walkthrough/unused_data.mdwn | 2 |
4 files changed, 18 insertions, 15 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs index 1482f057e..7e5549c09 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -36,21 +36,22 @@ seek = [withNothing start] {- Finds unused content in the annex. -} start :: CommandStartNothing start = notBareRepo $ do - showStart "unused" "" - next perform - -perform :: CommandPerform -perform = do - maybe checkUnused checkRemoteUnused =<< Annex.getState Annex.fromremote - next $ return True + from <- Annex.getState Annex.fromremote + case from of + Nothing -> pass "." checkUnused + Just n -> pass n $ checkRemoteUnused n + where + pass n a = do + showStart "unused" n + next a -checkUnused :: Annex () +checkUnused :: CommandPerform checkUnused = do (unused, stalebad, staletmp) <- unusedKeys n <- list "" unusedMsg unused 0 n' <- list "bad" staleBadMsg stalebad n _ <- list "tmp" staleTmpMsg staletmp n' - return () + next $ return True where list file msg l c = do let unusedlist = number c l @@ -58,13 +59,15 @@ checkUnused = do writeUnusedFile file unusedlist return $ length l -checkRemoteUnused :: String -> Annex () -checkRemoteUnused name = checkRemoteUnused' =<< Remote.byName name +checkRemoteUnused :: String -> CommandPerform +checkRemoteUnused name = do + checkRemoteUnused' =<< Remote.byName name + next $ return True checkRemoteUnused' :: Remote.Remote Annex -> Annex () checkRemoteUnused' r = do + showNote $ "checking for unused data..." g <- Annex.gitRepo - showNote $ "checking for unused data on " ++ Remote.name r ++ "..." referenced <- getKeysReferenced logged <- liftIO $ loggedKeys g remotehas <- filterM isthere logged diff --git a/doc/special_remotes.mdwn b/doc/special_remotes.mdwn index dcb6b5063..12e0aedb1 100644 --- a/doc/special_remotes.mdwn +++ b/doc/special_remotes.mdwn @@ -21,7 +21,7 @@ repository is found by running `git annex unused`. To detect unused content on special remotes, instead use `git annex unused --from`. Example: $ git annex unused --from mys3 - unused (checking for unused data on mys3...) + unused mys3 (checking for unused data...) Some annexed data on mys3 is not used by any files in this repository. NUMBER KEY 1 WORM-s3-m1301674316--foo diff --git a/doc/walkthrough/fsck:_verifying_your_data.mdwn b/doc/walkthrough/fsck:_verifying_your_data.mdwn index cd3a47a8a..7e05469a1 100644 --- a/doc/walkthrough/fsck:_verifying_your_data.mdwn +++ b/doc/walkthrough/fsck:_verifying_your_data.mdwn @@ -5,7 +5,7 @@ the checksums of your files are good. Fsck also checks that the annex.numcopies setting is satisfied for all files. # git annex fsck - unused (checking for unused data...) ok + fsck some_file (checksum...) ok fsck my_cool_big_file (checksum...) ok ... diff --git a/doc/walkthrough/unused_data.mdwn b/doc/walkthrough/unused_data.mdwn index 2f8edcd38..fb8419303 100644 --- a/doc/walkthrough/unused_data.mdwn +++ b/doc/walkthrough/unused_data.mdwn @@ -9,7 +9,7 @@ preserving it. So from time to time, you may want to check for such data and eliminate it to save space. # git annex unused - unused (checking for unused data...) + unused . (checking for unused data...) Some annexed data is no longer used by any files in the repository. NUMBER KEY 1 WORM-s3-m1289672605--file |