diff options
author | 2011-03-15 21:34:13 -0400 | |
---|---|---|
committer | 2011-03-15 21:34:13 -0400 | |
commit | 9d49fe2c172b135a1a3735827df014b5f45d99a2 (patch) | |
tree | 32caea71926c1b05d9b1921a16f364f57fc3e62f /Locations.hs | |
parent | 675ee89749ba2272d37b763078020b6e5f4cd380 (diff) |
first pass at using new keys
It compiles. It sorta works. Several subcommands are FIXME marked and
broken, because things that used to accept separate --backend and --key
params need to be changed to accept just a --key that encodes all the key
info, now that there is metadata in keys.
Diffstat (limited to 'Locations.hs')
-rw-r--r-- | Locations.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Locations.hs b/Locations.hs index 91a61ddd7..6cff91088 100644 --- a/Locations.hs +++ b/Locations.hs @@ -31,6 +31,7 @@ import Word import Data.Hash.MD5 import Types +import Key import qualified GitRepo as Git {- Conventions: @@ -123,14 +124,14 @@ keyFile key = replace "/" "%" $ replace "%" "&s" $ replace "&" "&a" $ show key {- Reverses keyFile, converting a filename fragment (ie, the basename of - the symlink target) into a key. -} -fileKey :: FilePath -> Key -fileKey file = read $ +fileKey :: FilePath -> Maybe Key +fileKey file = readKey $ replace "&a" "&" $ replace "&s" "%" $ replace "%" "/" file {- for quickcheck -} prop_idempotent_fileKey :: String -> Bool -prop_idempotent_fileKey s = k == fileKey (keyFile k) - where k = read $ "test:" ++ s +prop_idempotent_fileKey s = Just k == fileKey (keyFile k) + where k = stubKey { keyName = s, keyBackendName = "test" } {- Given a filename, generates a short directory name to put it in, - to do hashing to protect against filesystems that dislike having |