readpresentkey: New plumbing command for checking location log.
This commit is contained in:
parent
101302f7fc
commit
50ef4105e3
4 changed files with 47 additions and 1 deletions
|
@ -29,6 +29,7 @@ import qualified Command.DropKey
|
|||
import qualified Command.TransferKey
|
||||
import qualified Command.TransferKeys
|
||||
import qualified Command.SetPresentKey
|
||||
import qualified Command.ReadPresentKey
|
||||
import qualified Command.ReKey
|
||||
import qualified Command.MetaData
|
||||
import qualified Command.View
|
||||
|
@ -156,6 +157,7 @@ cmds = concat
|
|||
, Command.TransferKey.cmd
|
||||
, Command.TransferKeys.cmd
|
||||
, Command.SetPresentKey.cmd
|
||||
, Command.ReadPresentKey.cmd
|
||||
, Command.ReKey.cmd
|
||||
, Command.MetaData.cmd
|
||||
, Command.View.cmd
|
||||
|
|
30
Command/ReadPresentKey.hs
Normal file
30
Command/ReadPresentKey.hs
Normal file
|
@ -0,0 +1,30 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2015 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Command.ReadPresentKey where
|
||||
|
||||
import Common.Annex
|
||||
import Command
|
||||
import Logs.Location
|
||||
import Types.Key
|
||||
|
||||
cmd :: [Command]
|
||||
cmd = [noCommit $ command "readpresentkey" (paramPair paramKey paramUUID) seek
|
||||
SectionPlumbing "read records of where key is present"]
|
||||
|
||||
seek :: CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
start (ks:us:[]) = do
|
||||
ls <- loggedLocations k
|
||||
if toUUID us `elem` ls
|
||||
then liftIO exitSuccess
|
||||
else liftIO exitFailure
|
||||
where
|
||||
k = fromMaybe (error "bad key") (file2key ks)
|
||||
start _ = error "Wrong number of parameters"
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
|||
git-annex (5.20150318) UNRELEASED; urgency=medium
|
||||
|
||||
* readpresentkey: New plumbing command for checking location log.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
|
||||
|
||||
git-annex (5.20150317) unstable; urgency=medium
|
||||
|
||||
* fsck: Incremental fsck uses sqlite to store its records, instead
|
||||
|
|
|
@ -1000,7 +1000,15 @@ subdirectories).
|
|||
* `setpresentkey key uuid [1|0]`
|
||||
|
||||
This plumbing-level command changes git-annex's records about whether
|
||||
the specified key is present in a remote with the specified uuid.
|
||||
the specified key's content is present in a remote with the specified uuid.
|
||||
|
||||
* `readpresentkey key uuid`
|
||||
|
||||
This plumbing-level command reads git-annex's records about whether
|
||||
the specified key's content is present in the remote with the speficied
|
||||
uuid.
|
||||
|
||||
It exits 0 if the key is recorded to be present and 1 if not.
|
||||
|
||||
* `rekey [file key ...]`
|
||||
|
||||
|
|
Loading…
Reference in a new issue