hit 0.6.0 → 0.6.1
raw patch · 7 files changed
+38/−15 lines, 7 filesdep ~basedep ~hourglassPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, hourglass
API changes (from Hackage documentation)
- Data.Git: type GitTime = LocalTime Elapsed
- Data.Git.Types: type GitTime = LocalTime Elapsed
+ Data.Git: data Git
+ Data.Git: data GitTime
+ Data.Git.Types: GitTime :: Elapsed -> TimezoneOffset -> GitTime
+ Data.Git.Types: data GitTime
+ Data.Git.Types: gitTimeTimezone :: GitTime -> TimezoneOffset
+ Data.Git.Types: gitTimeToLocal :: GitTime -> LocalTime Elapsed
+ Data.Git.Types: gitTimeUTC :: GitTime -> Elapsed
+ Data.Git.Types: instance Eq GitTime
+ Data.Git.Types: instance Show GitTime
+ Data.Git.Types: instance Time GitTime
+ Data.Git.Types: instance Timeable GitTime
Files
- Data/Git.hs +1/−0
- Data/Git/Diff.hs +1/−1
- Data/Git/Storage.hs +1/−1
- Data/Git/Storage/Object.hs +1/−2
- Data/Git/Types.hs +29/−6
- Tests/Tests.hs +2/−2
- hit.cabal +3/−3
Data/Git.hs view
@@ -34,6 +34,7 @@ , resolvePath -- * repo context+ , Git , withCurrentRepo , withRepo , findRepo
Data/Git/Diff.hs view
@@ -183,7 +183,7 @@ -- | This is a proposed diff records for a given file. -- It contains useful information: -- * the filename (with its path in the root project)--- * a file diff (with the Data.Algorythm.Patience method)+-- * a file diff (with the Data.Algorithm.Patience method) -- * the file's mode (i.e. the file priviledge) -- * the file's ref data HitDiff = HitDiff
Data/Git/Storage.hs view
@@ -149,7 +149,7 @@ isRepo path = do dir <- isDirectory path subDirs <- mapM (isDirectory . (path </>))- [ "branches", "hooks", "info"+ [ "hooks", "info" , "logs", "objects", "refs" , "refs"</> "heads", "refs"</> "tags"] return $ and ([dir] ++ subDirs)
Data/Git/Storage/Object.hs view
@@ -57,7 +57,6 @@ import Data.List (intersperse) import Data.Monoid import Data.Word-import Data.Hourglass import Text.Printf #if MIN_VERSION_bytestring(0,10,0)@@ -343,4 +342,4 @@ -- used for objectWrite for commit and tag writeName label (Person name email locTime) = B.concat [label, " ", name, " <", email, "> ", BC.pack timeStr]- where timeStr = timePrint ("EPOCH TZHM" :: String) locTime+ where timeStr = show locTime
Data/Git/Types.hs view
@@ -24,8 +24,9 @@ , getPermission , getFiletype -- * time type- , GitTime+ , GitTime(..) , gitTime+ , gitTimeToLocal -- * Pack delta types , DeltaOfs(..) , DeltaRef(..)@@ -41,10 +42,12 @@ import Data.Git.Ref import Data.Git.Delta-import Data.Hourglass (Elapsed, LocalTime(..), TimezoneOffset(..))+import Data.Hourglass (Elapsed, TimezoneOffset(..)+ , timePrint, timeConvert+ , Time(..), Timeable(..)+ , LocalTime, localTimeSetTimezone, localTimeFromGlobal) import Data.Data - -- | type of a git object. data ObjectType = TypeTree@@ -55,12 +58,32 @@ | TypeDeltaRef deriving (Show,Eq,Data,Typeable) --- | Git time is number of seconds since unix epoch with a timezone-type GitTime = LocalTime Elapsed+-- | Git time is number of seconds since unix epoch in the UTC zone with+-- the current timezone associated+data GitTime = GitTime+ { gitTimeUTC :: Elapsed+ , gitTimeTimezone :: TimezoneOffset+ } deriving (Eq) +instance Timeable GitTime where+ timeGetNanoSeconds _ = 0+ timeGetElapsedP (GitTime t _) = timeConvert t+ timeGetElapsed (GitTime t _) = t+instance Time GitTime where+ timeFromElapsedP e = GitTime (timeGetElapsed e) (TimezoneOffset 0)+ timeFromElapsed e = GitTime e (TimezoneOffset 0)++instance Show GitTime where+ show (GitTime t tz) =+ timePrint "EPOCH" t ++ " " ++ show tz+ gitTime :: Integer -> Int -> GitTime gitTime seconds tzMins =- LocalTime (fromIntegral seconds) (TimezoneOffset tzMins)+ GitTime (fromIntegral seconds) (TimezoneOffset tzMins)++gitTimeToLocal :: GitTime -> LocalTime Elapsed+gitTimeToLocal (GitTime t tz) =+ localTimeSetTimezone tz (localTimeFromGlobal t) -- | the enum instance is useful when marshalling to pack file. instance Enum ObjectType where
Tests/Tests.hs view
@@ -47,8 +47,8 @@ arbitrary = TimezoneOffset <$> choose (-11*60, 12*60) instance Arbitrary Elapsed where arbitrary = Elapsed . Seconds <$> choose (0,2^32-1)-instance Arbitrary t => Arbitrary (LocalTime t) where- arbitrary = LocalTime <$> arbitrary <*> arbitrary+instance Arbitrary GitTime where+ arbitrary = GitTime <$> arbitrary <*> arbitrary instance Arbitrary ModePerm where arbitrary = ModePerm <$> elements [ 0o644, 0o664, 0o755, 0 ]
hit.cabal view
@@ -1,5 +1,5 @@ Name: hit-Version: 0.6.0+Version: 0.6.1 Synopsis: Git operations in haskell Description: .@@ -46,7 +46,7 @@ , random , zlib , zlib-bindings >= 0.1 && < 0.2- , hourglass+ , hourglass >= 0.2 , unix , patience Exposed-modules: Data.Git@@ -75,7 +75,7 @@ hs-source-dirs: Hit ghc-options: -Wall -fno-warn-orphans -fno-warn-missing-signatures if flag(debug)- ghc-options: -rtsops -auto-all -caf-all+ ghc-options: -rtsopts -auto-all -caf-all if flag(executable) Build-depends: base >= 4 && < 5 , mtl