diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-02-24 18:51:57 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-02-24 18:59:12 -0400 |
commit | 1630f299751d4e8b186cd176c8219f11257586d8 (patch) | |
tree | cb283de1b365a7ba7ac14b6de4eb0c7b9116fdd1 /Types/Transfer.hs | |
parent | 4e8d9714a31987f879b4cad5c2b394386d02a829 (diff) |
fix up Read instance incompatability caused by recent commit
2f868db90c7ba16eee901b9b1472b1e1a889dd93 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, 2f868db90c7ba16eee901b9b1472b1e1a889dd93 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 'Types/Transfer.hs')
-rw-r--r-- | Types/Transfer.hs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Types/Transfer.hs b/Types/Transfer.hs index 1920bc73b..349eccf4b 100644 --- a/Types/Transfer.hs +++ b/Types/Transfer.hs @@ -16,8 +16,7 @@ import Control.Concurrent import Control.Applicative import Prelude -{- Enough information to uniquely identify a transfer, used as the filename - - of the transfer information file. -} +{- Enough information to uniquely identify a transfer. -} data Transfer = Transfer { transferDirection :: Direction , transferUUID :: UUID @@ -46,7 +45,16 @@ stubTransferInfo :: TransferInfo stubTransferInfo = TransferInfo Nothing Nothing Nothing Nothing Nothing Nothing False data Direction = Upload | Download - deriving (Eq, Ord, Read, Show) + deriving (Eq, Ord, Show, Read) + +formatDirection :: Direction -> String +formatDirection Upload = "upload" +formatDirection Download = "download" + +parseDirection :: String -> Maybe Direction +parseDirection "upload" = Just Upload +parseDirection "download" = Just Download +parseDirection _ = Nothing instance Arbitrary TransferInfo where arbitrary = TransferInfo |