packages feed

filestore 0.3.4.3 → 0.4.0.1

raw patch · 6 files changed

+38/−22 lines, 6 filesdep −datetimedep ~Diffdep ~bytestringdep ~directory

Dependencies removed: datetime

Dependency ranges changed: Diff, bytestring, directory, filepath, old-locale, parsec, process, split, time, utf8-string, xml

Files

Data/FileStore/Darcs.hs view
@@ -16,7 +16,8 @@  import Control.Exception (throwIO) import Control.Monad (when)-import Data.DateTime (toSqlString)+import Data.Time (formatTime)+import System.Locale (defaultTimeLocale) import Data.List (sort, isPrefixOf) #ifdef USE_MAXCOUNT import Data.List (isInfixOf)@@ -127,7 +128,7 @@             Just parsed -> return parsed         else throwIO $ UnknownError $ "darcs changes returned error status.\n" ++ err     where-        timeOpts :: Maybe DateTime -> Maybe DateTime ->[String]+        timeOpts :: Maybe UTCTime -> Maybe UTCTime ->[String]         timeOpts b e = case (b,e) of                 (Nothing,Nothing) -> []                 (Just b', Just e') -> from b' ++ to e'@@ -136,6 +137,7 @@                 where from z = ["--match=date \"after " ++ undate z ++ "\""]                       to z = ["--to-match=date \"before " ++ undate z ++ "\""]                       undate = toSqlString+                      toSqlString = formatTime defaultTimeLocale "%FT%X"  -- | Get revision information for a particular revision ID, or latest revision. darcsGetRevision :: FilePath -> RevisionId -> IO Revision
Data/FileStore/DarcsXml.hs view
@@ -2,7 +2,8 @@  import Data.Maybe (catMaybes, fromMaybe) import Data.Char (isSpace)-import Data.DateTime (parseDateTime)+import Data.Time.Format (parseTime)+import System.Locale (defaultTimeLocale) import Data.Time.Clock.POSIX (posixSecondsToUTCTime) import Text.XML.Light @@ -28,7 +29,7 @@         -- This at least makes it easy for someone to filter out bad dates, as obviously no real DVCSs         -- were in operation then. :)         -- date :: Element -> UTCTime-        date = fromMaybe (posixSecondsToUTCTime $ realToFrac (0::Int)) . parseDateTime "%c" . dateXML+        date = fromMaybe (posixSecondsToUTCTime $ realToFrac (0::Int)) . parseTime defaultTimeLocale "%c" . dateXML  authorXML, dateXML, descriptionXML, emailXML, hashXML :: Element -> String authorXML = snd . splitEmailAuthor . fromMaybe "" . findAttr (QName "author" Nothing Nothing)@@ -56,7 +57,8 @@            | x == "added_lines"               || x == "modify_file"               || x == "removed_lines"-              || x == "replaced_tokens" = Just (Modified b)+              || x == "replaced_tokens"+              || x == "move" = Just (Modified b)            | otherwise = Nothing              where  x = qName . elName $ a                     b = takeWhile (/='\n') $ dropWhile isSpace $ strContent a@@ -69,4 +71,5 @@                                 || x == "modify_file"                                 || x == "added_lines"                                 || x == "removed_lines"-                                || x == "replaced_tokens")+                                || x == "replaced_tokens"+                                || x == "move")
Data/FileStore/Mercurial.hs view
@@ -30,8 +30,7 @@ import System.Directory (createDirectoryIfMissing, doesDirectoryExist) import Control.Exception (throwIO) import System.Locale (defaultTimeLocale)-import Data.Time (parseTime)-import Data.Time.Clock (UTCTime)+import Data.Time (parseTime, formatTime)  -- | Return a filestore implemented using the mercurial distributed revision control system -- (<http://mercurial.selenic.com/>).@@ -217,9 +216,11 @@                 Right parsed -> return parsed      else throwIO $ UnknownError $ "mercurial log returned error status.\n" ++ err  where revOpts Nothing Nothing   = []-       revOpts Nothing (Just u)  = ["-d", "<" ++ show u]-       revOpts (Just s) Nothing  = ["-d", ">" ++ show s]-       revOpts (Just s) (Just u) = ["-d", show s ++ " to " ++ show u]+       revOpts Nothing (Just u)  = ["-d", "<" ++ showTime u]+       revOpts (Just s) Nothing  = ["-d", ">" ++ showTime s]+       revOpts (Just s) (Just u) = ["-d", showTime s ++ " to " ++ showTime u]+       showTime = formatTime defaultTimeLocale "%F %X"+  -- -- Parsers to parse mercurial log into Revisions.
Data/FileStore/Types.hs view
@@ -25,14 +25,14 @@            , SearchMatch(..)            , SearchQuery(..)            , defaultSearchQuery-           , DateTime+           , UTCTime            , FileStore (..) )  where import Data.ByteString.Lazy (ByteString) import Data.Typeable import Data.ByteString.Lazy.UTF8 (toString, fromString)-import Data.DateTime (DateTime)+import Data.Time (UTCTime) import Control.Exception (Exception) import Prelude hiding (catch) @@ -59,7 +59,7 @@ data Revision =   Revision {     revId          :: RevisionId-  , revDateTime    :: DateTime+  , revDateTime    :: UTCTime   , revAuthor      :: Author   , revDescription :: Description   , revChanges     :: [Change]@@ -79,8 +79,8 @@  data TimeRange =   TimeRange {-    timeFrom :: Maybe DateTime  -- ^ @Nothing@ means no lower bound-  , timeTo   :: Maybe DateTime  -- ^ @Nothing@ means no upper bound+    timeFrom :: Maybe UTCTime  -- ^ @Nothing@ means no lower bound+  , timeTo   :: Maybe UTCTime  -- ^ @Nothing@ means no upper bound   } deriving (Show, Read, Eq, Typeable)  data MergeInfo =@@ -180,7 +180,7 @@      -- | Get history for a list of named resources in a (possibly openended)     -- time range. If the list is empty, history for all resources will-    -- be returned.+    -- be returned. If the TimeRange is 2 Nothings, history for all dates will be returned.   , history        :: [FilePath]        -- List of resources to get history for                                         -- or @[]@ for all.                    -> TimeRange         -- Time range in which to get history.
Tests.lhs view
@@ -12,7 +12,7 @@ > import Control.Monad (forM) > import Prelude hiding (catch) > import Control.Exception (catch)-> import Data.DateTime+> import Data.Time > import Data.Maybe (mapMaybe) > import System.FilePath > import System.Process@@ -313,7 +313,7 @@ >   assertBool "revDescription non-null" (not (null (revDescription rev))) >   assertEqual "revChanges" [Modified testTitle] (revChanges rev) >   let revtime = revDateTime rev->   histNow <- history fs [testTitle] (TimeRange (Just $ addMinutes (60 * 24) now) Nothing)+>   histNow <- history fs [testTitle] (TimeRange (Just $ addUTCTime (60 * 60 * 24) now) Nothing) >   assertBool "history from now + 1 day onwards is empty" (null histNow)  *** Test diff
filestore.cabal view
@@ -1,5 +1,5 @@ Name:                filestore-Version:             0.3.4.3+Version:             0.4.0.1 Cabal-version:       >= 1.2 Build-type:          Custom Tested-with:         GHC==6.10.1@@ -31,8 +31,18 @@                  older version of Darcs, or 'latest' will raise an error.  Library-    Build-depends:       base >= 4 && < 5, bytestring, utf8-string, filepath, directory, datetime,-                         parsec >= 2 && < 3, process, time, datetime, xml, split, Diff, old-locale+    Build-depends:       base >= 4 && < 5,+                         bytestring >= 0.9 && < 1.0,+                         utf8-string >= 0.3 && < 0.4,+                         filepath >= 1.1 && < 1.2,+                         directory >= 1.0 && < 1.1,+                         parsec >= 2 && < 3.2,+                         process >= 1.0 && < 1.1,+                         time >= 1.1 && < 1.2,+                         xml >= 1.3 && < 1.4,+                         split >= 0.1 && < 0.2,+                         Diff >= 0.1.2 && < 0.2,+                         old-locale >= 1.0 && < 1.1      Exposed-modules:     Data.FileStore, Data.FileStore.Types, Data.FileStore.Git, Data.FileStore.Darcs, Data.FileStore.Mercurial,                          -- Data.FileStore.Sqlite3,