buildbox 2.1.6.1 → 2.1.7.1
raw patch · 5 files changed
+27/−27 lines, 5 filesdep +textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: text
API changes (from Hackage documentation)
- BuildBox.Data.Log: type Line = ByteString
+ BuildBox.Data.Log: type Line = Text
Files
- BuildBox/Command/Darcs.hs +4/−7
- BuildBox/Command/System.hs +6/−5
- BuildBox/Command/System/Internals.hs +7/−6
- BuildBox/Data/Log.hs +7/−7
- buildbox.cabal +3/−2
BuildBox/Command/Darcs.hs view
@@ -12,7 +12,7 @@ import Data.Time import Data.Maybe import qualified Data.Sequence as Seq-import qualified Data.ByteString.Char8 as B+import qualified Data.Text as Text -- friends import BuildBox.Build@@ -50,14 +50,12 @@ -- -- | Retrieve the last N changes from the repository--- changesN :: Maybe DarcsPath -> Int -> Build [DarcsPatch] changesN repo n = darcs $ "darcs changes --last=" ++ show n ++ " --repo=" ++ fromMaybe "." repo -- | Retrieve all patches submitted to the repository after the given time--- changesAfter :: Maybe DarcsPath -> LocalTime -> Build [DarcsPatch] changesAfter repo time = darcs $ "darcs changes --matches='date \"after " ++ show time ++ "\"'"@@ -66,7 +64,6 @@ -- Execute the given darcs command string and split the stdout into a series of -- patches--- darcs :: String -> Build [DarcsPatch] darcs cmd = do (status, logOut, logErr) <- systemTeeLog False cmd Log.empty@@ -77,11 +74,11 @@ splitPatches :: Log.Log -> [DarcsPatch] splitPatches l | Seq.null l = []- | otherwise = let (h,t) = Seq.breakl B.null l- in patch h : splitPatches (Seq.dropWhileL B.null t)+ | otherwise = let (h,t) = Seq.breakl Text.null l+ in patch h : splitPatches (Seq.dropWhileL Text.null t) where patch p =- let toks = words . B.unpack $ Seq.index p 0+ let toks = words . Text.unpack $ Seq.index p 0 (time,author) = splitAt 6 toks in DarcsPatch
BuildBox/Command/System.hs view
@@ -33,10 +33,11 @@ import Control.Monad.STM import System.Exit import System.IO-import Data.ByteString.Char8 (ByteString)+import Data.ByteString (ByteString) import BuildBox.Data.Log (Log) import System.Process hiding (system) import qualified BuildBox.Data.Log as Log+import qualified Data.Text.Encoding as Text debug :: Bool debug = False@@ -226,8 +227,8 @@ slurpChan :: TChan (Maybe ByteString) -> Log -> IO Log slurpChan !chan !ll- = do mStr <- atomically $ readTChan chan- case mStr of- Nothing -> return ll- Just str -> slurpChan chan (ll Log.|> str)+ = do mBS <- atomically $ readTChan chan+ case mBS of+ Nothing -> return ll+ Just bs -> slurpChan chan (ll Log.|> Text.decodeUtf8 bs)
BuildBox/Command/System/Internals.hs view
@@ -14,7 +14,7 @@ import Data.Word import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Internal as BS-import qualified Data.ByteString.Char8 as BS +import qualified Data.ByteString as BS import GHC.IO.Handle.Internals import GHC.IO.Handle.Types@@ -60,15 +60,16 @@ -- Check whether we got an actual newline character on the -- end of the string. let hasNewLine- | BS.last str == '\n' = True- | otherwise = False+ | BS.last str == (fromIntegral $ ord '\n') + = True+ | otherwise = False -- For string ending in newline characters, we don't want to -- push the newline to the consumer, but we need to remember -- if we've seen one to handle the end-of-file condition properly. let str'- | hasNewLine = BS.init str- | otherwise = str+ | hasNewLine = BS.init str+ | otherwise = str atomically $ writeTChan chan (Just str') streamIn' hasNewLine hRead chan)@@ -182,7 +183,7 @@ -- was no newline character on the input. if r == w then mkBigPS new_len (xs:xss)- else mkBigPS new_len (BS.pack "\n" : xs : xss)+ else mkBigPS new_len (BS.pack [fromIntegral $ ord '\n'] : xs : xss) else do fill h_ buf{ bufL=0, bufR=0 } new_len (xs:xss)
BuildBox/Data/Log.hs view
@@ -14,16 +14,16 @@ , firstLines , lastLines) where-import Data.ByteString.Char8 (ByteString) import Data.Sequence (Seq)-import qualified Data.ByteString.Char8 as BS+import Data.Text (Text)+import qualified Data.Text as Text import qualified Data.Sequence as Seq import qualified Data.Foldable as F import Prelude hiding (null) -- | A sequence of lines, without newline charaters on the end. type Log = Seq Line-type Line = ByteString+type Line = Text -- | O(1) No logs here.@@ -37,16 +37,16 @@ -- | O(n) Convert a `Log` to a `String`. toString :: Log -> String toString ll - = BS.unpack - $ BS.intercalate (BS.pack "\n") + = Text.unpack + $ Text.intercalate (Text.pack "\n") $ F.toList ll -- | O(n) Convert a `String` to a `Log`. fromString :: String -> Log fromString str = Seq.fromList - $ BS.splitWith (== '\n')- $ BS.pack str+ $ Text.lines + $ Text.pack str -- | O(1) Add a `Line` to the start of a `Log`.
buildbox.cabal view
@@ -1,5 +1,5 @@ Name: buildbox-Version: 2.1.6.1+Version: 2.1.7.1 License: BSD3 License-file: LICENSE Author: Ben Lippmeier@@ -31,7 +31,8 @@ process >= 1.2 && < 1.3, random >= 1.0 && < 1.2, pretty >= 1.1 && < 1.2,- stm >= 2.4 && < 2.5+ stm >= 2.4 && < 2.5,+ text >= 1.2 && < 1.3 ghc-options: -Wall