This commit is contained in:
Joey Hess 2014-02-20 15:12:35 -04:00
parent 73ed2f8ec1
commit ae1e9f921b
4 changed files with 27 additions and 69 deletions

View file

@ -7,34 +7,13 @@
module Command.Dead where module Command.Dead where
import Common.Annex
import Command import Command
import qualified Remote import Types.TrustLevel
import Logs.Trust import Command.Trust (trustCommand)
import Logs.Group
import qualified Data.Set as S
def :: [Command] def :: [Command]
def = [command "dead" (paramRepeating paramRemote) seek def = [command "dead" (paramRepeating paramRemote) seek
SectionSetup "hide a lost repository"] SectionSetup "hide a lost repository"]
seek :: CommandSeek seek :: CommandSeek
seek = withWords start seek = trustCommand "dead" DeadTrusted
start :: [String] -> CommandStart
start ws = do
let name = unwords ws
showStart "dead" name
u <- Remote.nameToUUID name
next $ perform u
perform :: UUID -> CommandPerform
perform uuid = do
markDead uuid
next $ return True
markDead :: UUID -> Annex ()
markDead uuid = do
trustSet uuid DeadTrusted
groupSet uuid S.empty

View file

@ -7,26 +7,13 @@
module Command.Semitrust where module Command.Semitrust where
import Common.Annex
import Command import Command
import qualified Remote import Types.TrustLevel
import Logs.Trust import Command.Trust (trustCommand)
def :: [Command] def :: [Command]
def = [command "semitrust" (paramRepeating paramRemote) seek def = [command "semitrust" (paramRepeating paramRemote) seek
SectionSetup "return repository to default trust level"] SectionSetup "return repository to default trust level"]
seek :: CommandSeek seek :: CommandSeek
seek = withWords start seek = trustCommand "semitrust" SemiTrusted
start :: [String] -> CommandStart
start ws = do
let name = unwords ws
showStart "semitrust" name
u <- Remote.nameToUUID name
next $ perform u
perform :: UUID -> CommandPerform
perform uuid = do
trustSet uuid SemiTrusted
next $ return True

View file

@ -1,6 +1,6 @@
{- git-annex command {- git-annex command
- -
- Copyright 2010 Joey Hess <joey@kitenet.net> - Copyright 2010, 2014 Joey Hess <joey@kitenet.net>
- -
- Licensed under the GNU GPL version 3 or higher. - Licensed under the GNU GPL version 3 or higher.
-} -}
@ -11,22 +11,27 @@ import Common.Annex
import Command import Command
import qualified Remote import qualified Remote
import Logs.Trust import Logs.Trust
import Logs.Group
import qualified Data.Set as S
def :: [Command] def :: [Command]
def = [command "trust" (paramRepeating paramRemote) seek def = [command "trust" (paramRepeating paramRemote) seek
SectionSetup "trust a repository"] SectionSetup "trust a repository"]
seek :: CommandSeek seek :: CommandSeek
seek = withWords start seek = trustCommand "trust" Trusted
start :: [String] -> CommandStart trustCommand :: String -> TrustLevel -> CommandSeek
start ws = do trustCommand cmd level = withWords start
let name = unwords ws where
showStart "trust" name start ws = do
u <- Remote.nameToUUID name let name = unwords ws
next $ perform u showStart cmd name
u <- Remote.nameToUUID name
perform :: UUID -> CommandPerform next $ perform u
perform uuid = do perform uuid = do
trustSet uuid Trusted trustSet uuid level
next $ return True when (level == DeadTrusted) $
groupSet uuid S.empty
next $ return True

View file

@ -7,26 +7,13 @@
module Command.Untrust where module Command.Untrust where
import Common.Annex
import Command import Command
import qualified Remote import Types.TrustLevel
import Logs.Trust import Command.Trust (trustCommand)
def :: [Command] def :: [Command]
def = [command "untrust" (paramRepeating paramRemote) seek def = [command "untrust" (paramRepeating paramRemote) seek
SectionSetup "do not trust a repository"] SectionSetup "do not trust a repository"]
seek :: CommandSeek seek :: CommandSeek
seek = withWords start seek = trustCommand "untrust" UnTrusted
start :: [String] -> CommandStart
start ws = do
let name = unwords ws
showStart "untrust" name
u <- Remote.nameToUUID name
next $ perform u
perform :: UUID -> CommandPerform
perform uuid = do
trustSet uuid UnTrusted
next $ return True