summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-02-24 18:51:57 -0400
committerJoey Hess <joeyh@joeyh.name>2017-02-24 18:59:12 -0400
commit27eca014beb6ebbe9f6ea12b189377375e31a5ad (patch)
tree215c3a7afcad8cdefcb216e9ac68b02fe445f365 /Logs
parent634a485b500513634743f7ef0ed51e85b8dc5ac9 (diff)
fix up Read instance incompatability caused by recent commit
9c4650358ca85a298b747bb897dbf4f8f891fa22 changed the Read instance for Key. I've checked all uses of that instance (by removing it and seeing what breaks), and they're all limited to the webapp, except one. That is GitAnnexDistribution's Read instance. So, 9c4650358ca85a298b747bb897dbf4f8f891fa22 would have broken upgrades of git-annex from downloads.kitenet.net. Once the .info files there got updated for a new release, old releases would have failed to parse them and never upgraded. To fix this, I found a way to make the .info files that contain GitAnnexDistribution values be readable by the old version of git-annex. This commit was sponsored by Ewen McNeill.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Transfer.hs15
1 files changed, 3 insertions, 12 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index 903db96fe4..ce2a7d299f 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -23,15 +23,6 @@ import Data.Time.Clock
import Data.Time.Clock.POSIX
import Control.Concurrent
-showLcDirection :: Direction -> String
-showLcDirection Upload = "upload"
-showLcDirection Download = "download"
-
-readLcDirection :: String -> Maybe Direction
-readLcDirection "upload" = Just Upload
-readLcDirection "download" = Just Download
-readLcDirection _ = Nothing
-
describeTransfer :: Transfer -> TransferInfo -> String
describeTransfer t info = unwords
[ show $ transferDirection t
@@ -212,7 +203,7 @@ parseTransferFile file
| "lck." `isPrefixOf` takeFileName file = Nothing
| otherwise = case drop (length bits - 3) bits of
[direction, u, key] -> Transfer
- <$> readLcDirection direction
+ <$> parseDirection direction
<*> pure (toUUID u)
<*> fileKey key
_ -> Nothing
@@ -279,14 +270,14 @@ readTransferInfo mpid s = TransferInfo
{- The directory holding transfer information files for a given Direction. -}
transferDir :: Direction -> Git.Repo -> FilePath
-transferDir direction r = gitAnnexTransferDir r </> showLcDirection direction
+transferDir direction r = gitAnnexTransferDir r </> formatDirection direction
{- The directory holding failed transfer information files for a given
- Direction and UUID -}
failedTransferDir :: UUID -> Direction -> Git.Repo -> FilePath
failedTransferDir u direction r = gitAnnexTransferDir r
</> "failed"
- </> showLcDirection direction
+ </> formatDirection direction
</> filter (/= '/') (fromUUID u)
prop_read_write_transferinfo :: TransferInfo -> Bool