packages feed

filestore 0.5.0.1 → 0.6

raw patch · 4 files changed

+23/−11 lines, 4 filesdep ~DiffPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: Diff

API changes (from Hackage documentation)

- Data.FileStore.Generic: B :: DI
- Data.FileStore.Generic: F :: DI
- Data.FileStore.Generic: S :: DI
- Data.FileStore.Generic: data DI :: *
+ Data.FileStore.Generic: Both :: a -> a -> Diff a
+ Data.FileStore.Generic: First :: a -> Diff a
+ Data.FileStore.Generic: Second :: a -> Diff a
+ Data.FileStore.Generic: data Diff a :: * -> *
- Data.FileStore.Generic: diff :: FileStore -> FilePath -> Maybe RevisionId -> Maybe RevisionId -> IO [(DI, [String])]
+ Data.FileStore.Generic: diff :: FileStore -> FilePath -> Maybe RevisionId -> Maybe RevisionId -> IO [Diff [String]]

Files

CHANGES view
@@ -1,3 +1,13 @@+Version 0.6 released 31 Dec 2012++* Updated to use Diff 0.2.  This involves an API change:+  diff now returns [Diff [String]] rather than [(DI, String)].+  Thanks to markwright for the patch.++* Test revDescription more thoroughly (Ben Millwood).++* Fixed error handling in withVerifyDir.+ Version 0.5.0.1 released 21 Oct 2012  * Bumped version limits on dependencies.
Data/FileStore/Generic.hs view
@@ -14,7 +14,7 @@ module Data.FileStore.Generic            ( modify            , create-           , DI(..)+           , Diff(..)            , diff            , searchRevisions            , smartRetrieve@@ -27,7 +27,7 @@ import Control.Exception (throwIO, catch, SomeException, try) import Data.FileStore.Utils import Data.List (isInfixOf)-import Data.Algorithm.Diff (DI(..), getGroupedDiff)+import Data.Algorithm.Diff (Diff(..), getGroupedDiff) import System.FilePath ((</>)) import Prelude hiding (catch) @@ -73,7 +73,7 @@        return $ Left (MergeInfo latestRev conflicts mergedText)  -- | Return a unified diff of two revisions of a named resource.--- Format of the diff is a list @[(DI, [String])]@, where+-- Format of the diff is a list @[(Diff, [String])]@, where -- @DI@ is @F@ (in first document only), @S@ (in second only), -- or @B@ (in both), and the list is a list of lines (without -- newlines at the end).@@ -81,10 +81,10 @@      -> FilePath      -- ^ Resource name to get diff for.      -> Maybe RevisionId  -- ^ @Just@ old revision ID, or @Nothing@ for empty.      -> Maybe RevisionId  -- ^ @Just@ oew revision ID, or @Nothing@ for latest.-     -> IO [(DI, [String])]+     -> IO [Diff [String]] diff fs name Nothing id2 = do   contents2 <- retrieve fs name id2-  return [(S, lines contents2)]   -- no need to run getGroupedDiff here - diff vs empty document +  return [Second (lines contents2) ]   -- no need to run getGroupedDiff here - diff vs empty document  diff fs name id1 id2 = do   contents1 <- retrieve fs name id1   contents2 <- retrieve fs name id2
filestore.cabal view
@@ -1,5 +1,5 @@ Name:                filestore-Version:             0.5.0.1+Version:             0.6 Cabal-version:       >= 1.8 Build-type:          Custom Synopsis:            Interface for versioning file stores.@@ -43,7 +43,7 @@                          time >= 1.1 && < 1.5,                          xml >= 1.3 && < 1.4,                          split >= 0.1 && < 0.3,-                         Diff >= 0.1.2 && < 0.2,+                         Diff >= 0.2 && < 0.3,                          old-locale >= 1.0 && < 1.1      Exposed-modules:     Data.FileStore, Data.FileStore.Types, Data.FileStore.Git, Data.FileStore.Darcs, Data.FileStore.Mercurial,
tests/Tests.lhs view
@@ -12,7 +12,7 @@ > import Data.Time > import Data.Maybe (mapMaybe) > import System.FilePath-> import Data.Algorithm.Diff (DI(..))+> import Data.Algorithm.Diff (Diff(..))  > main = do >   testFileStore (gitFileStore "tmp/gitfs") "Data.FileStore.Git"@@ -306,6 +306,8 @@ *** Test history and revision  > historyTest fs = TestCase $ do+>   let testDescription = "history test message"+>   save fs testTitle testAuthor testDescription testContents      Get history for three files @@ -316,7 +318,7 @@ >   assertBool "history contains latest revision" (rev `elem` hist) >   assertEqual "revAuthor" testAuthor (revAuthor rev) >   assertBool "revId non-null" (not (null (revId rev)))->   assertBool "revDescription non-null" (not (null (revDescription rev)))+>   assertEqual "revDescription" testDescription (revDescription rev) >   assertEqual "revChanges" [Modified testTitle] (revChanges rev) >   let revtime = revDateTime rev >   histNow <- history fs [testTitle] (TimeRange (Just $ addUTCTime (60 * 60 * 24) now) Nothing) Nothing@@ -336,13 +338,13 @@  >   [secondrev, firstrev] <- history fs [diffTitle] (TimeRange Nothing Nothing) Nothing >   diff' <- diff fs diffTitle (Just $ revId firstrev) (Just $ revId secondrev)->   let subtracted' = mapMaybe (\(d,s) -> if d == F then Just s else Nothing) diff'+>   let subtracted' = [s | First s <- diff'] >   assertEqual "subtracted lines" [[last (lines testContents)]] subtracted'      Diff from Nothing should be diff from empty document.  >   diff'' <- diff fs diffTitle Nothing (Just $ revId firstrev)->   let added'' = mapMaybe (\(d,s) -> if d == S then Just s else Nothing) diff''+>   let added'' = [s | Second s <- diff'] >   assertEqual "added lines from empty document to first revision" [lines testContents] added''      Diff to Nothing should be diff to latest.