hit 0.2.0 → 0.2.1
raw patch · 6 files changed
+32/−16 lines, 6 filesdep −patiencedep ~attoparsec
Dependencies removed: patience
Dependency ranges changed: attoparsec
Files
- Data/Git/Delta.hs +1/−1
- Data/Git/FileReader.hs +1/−1
- Data/Git/Object.hs +1/−1
- README.md +2/−2
- Tests.hs +24/−7
- hit.cabal +3/−4
Data/Git/Delta.hs view
@@ -22,7 +22,7 @@ import Data.Bits import Data.Word -import Control.Applicative ((<$>))+import Control.Applicative ((<$>), many) -- | a delta is a source size, a destination size and a list of delta cmd data Delta = Delta Word64 Word64 [DeltaCmd]
Data/Git/FileReader.hs view
@@ -27,7 +27,7 @@ import Control.Exception (bracket, throwIO) import Control.Monad -import Data.Attoparsec (parseWith, Parser, Result(..))+import Data.Attoparsec (parseWith, Parser, IResult(..)) import qualified Data.Attoparsec as A import Data.Bits import Data.ByteString (ByteString)
Data/Git/Object.hs view
@@ -57,7 +57,7 @@ import Data.Attoparsec.Lazy import qualified Data.Attoparsec.Lazy as P import qualified Data.Attoparsec.Char8 as PC-import Control.Applicative ((<$>))+import Control.Applicative ((<$>), many) import Control.Monad import Data.Word
README.md view
@@ -1,5 +1,5 @@- Hit- ===+Hit+=== Hit is a reimplementation of some git operations in pure haskell.
Tests.hs view
@@ -5,7 +5,7 @@ import qualified Data.ByteString.Lazy as L import qualified Data.ByteString as B -import Control.Applicative ((<$>))+import Control.Applicative import Control.Monad import Data.Git.Object@@ -14,10 +14,10 @@ -- for arbitrary instance to generate only data that are writable -- to disk. i.e. no deltas.-data ObjNoDelta = ObjNoDelta Object+--data ObjNoDelta = ObjNoDelta Object -instance Show ObjNoDelta where- show (ObjNoDelta o) = show o+--instance Show ObjNoDelta where+-- show (ObjNoDelta o) = show o arbitraryBS size = B.pack . map fromIntegral <$> replicateM size (choose (0,255) :: Gen Int) arbitraryBSno0 size = B.pack . map fromIntegral <$> replicateM size (choose (1,255) :: Gen Int)@@ -44,15 +44,32 @@ arbitraryObjTypeNoDelta = oneof [return TypeTree,return TypeBlob,return TypeCommit,return TypeTag] +instance Arbitrary Commit where+ arbitrary = Commit <$> arbitrary <*> arbitraryRefList <*> arbitraryName <*> arbitraryName <*> arbitraryMsg++instance Arbitrary Tree where+ arbitrary = Tree <$> arbitraryEnts++instance Arbitrary Blob where+ arbitrary = Blob <$> arbitraryLazy++instance Arbitrary Tag where+ arbitrary = Tag <$> arbitrary <*> arbitraryObjTypeNoDelta <*> arbitraryBSascii 20 <*> arbitraryName <*> arbitraryMsg++{-+instance Arbitrary Object where+ arbitrary = undefined+ instance Arbitrary ObjNoDelta where arbitrary = ObjNoDelta <$> oneof [ liftM5 Commit arbitrary arbitraryRefList arbitraryName arbitraryName arbitraryMsg , liftM Tree arbitraryEnts , liftM Blob arbitraryLazy- , liftM5 Tag arbitrary arbitraryObjTypeNoDelta (arbitraryBSascii 20) arbitraryName arbitraryMsg+ , liftM5 Tag ]+-} -prop_object_marshalling_id (ObjNoDelta obj) = obj == (looseUnmarshall $ looseMarshall obj)+--prop_object_marshalling_id (ObjNoDelta obj) = obj == (looseUnmarshall $ looseMarshall obj) refTests = [ testProperty "hexadecimal" (marshEqual (fromHex . toHex))@@ -62,7 +79,7 @@ marshEqual t ref = ref == t ref objTests =- [ testProperty "unmarshall.marshall==id" prop_object_marshalling_id+ [ -- testProperty "unmarshall.marshall==id" prop_object_marshalling_id ] main = defaultMain
hit.cabal view
@@ -1,5 +1,5 @@ Name: hit-Version: 0.2.0+Version: 0.2.1 Synopsis: Git operations Description: Provides low level git operations License: BSD3@@ -30,7 +30,7 @@ Build-Depends: base >= 4 && < 5 , mtl , bytestring- , attoparsec+ , attoparsec >= 0.10.1 , parsec >= 3 , filepath , directory@@ -39,7 +39,6 @@ , random , zlib , zlib-bindings >= 0.0.1- , patience , bytedump , unix Exposed-modules: Data.Git.Index@@ -69,7 +68,7 @@ , hashable , hashtables , bytestring- , attoparsec+ , attoparsec >= 0.10.1 , filepath , directory , zlib