This commit is contained in:
Joey Hess 2011-06-02 02:33:31 -04:00
parent 76be8c34ac
commit f2cc87860c
2 changed files with 9 additions and 6 deletions

View file

@ -95,11 +95,11 @@ options = commonOptions ++
"skip files matching the glob pattern" "skip files matching the glob pattern"
, Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber) , Option ['N'] ["numcopies"] (ReqArg setnumcopies paramNumber)
"override default number of copies" "override default number of copies"
, Option [] ["trust"] (ReqArg (settrust Trusted) paramRemote) , Option [] ["trust"] (ReqArg (Remote.forceTrust Trusted) paramRemote)
"override trust setting" "override trust setting"
, Option [] ["semitrust"] (ReqArg (settrust SemiTrusted) paramRemote) , Option [] ["semitrust"] (ReqArg (Remote.forceTrust SemiTrusted) paramRemote)
"override trust setting back to default value" "override trust setting back to default value"
, Option [] ["untrust"] (ReqArg (settrust UnTrusted) paramRemote) , Option [] ["untrust"] (ReqArg (Remote.forceTrust UnTrusted) paramRemote)
"override trust setting to untrusted" "override trust setting to untrusted"
] ]
where where
@ -108,9 +108,6 @@ options = commonOptions ++
addexclude v = Annex.changeState $ \s -> s { Annex.exclude = v:Annex.exclude s } addexclude v = Annex.changeState $ \s -> s { Annex.exclude = v:Annex.exclude s }
setnumcopies v = Annex.changeState $ \s -> s {Annex.forcenumcopies = readMaybe v } setnumcopies v = Annex.changeState $ \s -> s {Annex.forcenumcopies = readMaybe v }
setkey v = Annex.changeState $ \s -> s { Annex.defaultkey = Just v } setkey v = Annex.changeState $ \s -> s { Annex.defaultkey = Just v }
settrust t v = do
r <- Remote.nameToUUID v
Annex.changeState $ \s -> s { Annex.forcetrust = (r, t):Annex.forcetrust s }
header :: String header :: String
header = "Usage: git-annex command [option ..]" header = "Usage: git-annex command [option ..]"

View file

@ -15,6 +15,7 @@ module Remote (
hasKey, hasKey,
hasKeyCheap, hasKeyCheap,
keyPossibilities, keyPossibilities,
forceTrust,
remoteTypes, remoteTypes,
genList, genList,
@ -137,6 +138,11 @@ keyPossibilities key = do
return (sort validremotes, validtrusteduuids) return (sort validremotes, validtrusteduuids)
forceTrust :: TrustLevel -> String -> Annex ()
forceTrust level remotename = do
r <- Remote.nameToUUID remotename
Annex.changeState $ \s ->
s { Annex.forcetrust = (r, level):Annex.forcetrust s }
{- Filename of remote.log. -} {- Filename of remote.log. -}
remoteLog :: Annex FilePath remoteLog :: Annex FilePath