filestore 0.3.4.1 → 0.3.4.2
raw patch · 5 files changed
+32/−19 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES +12/−0
- Data/FileStore/Git.hs +6/−2
- Data/FileStore/Types.hs +0/−1
- Data/FileStore/Utils.hs +9/−13
- filestore.cabal +5/−3
CHANGES view
@@ -1,3 +1,15 @@+Version 0.3.4.2 released 03 Aug 2010++* gitInit: Set up repository to allow push to the current+ branch. This is needed for recent versions of git,+ which don't allow a push to the master branch. Resolves+ Issue #104.++* New version of runShellCommand that does not require+ temp files, using runInteractiveProcess.++* Suppress "unused do bind" warnings in build.+ Version 0.3.4.1 released 22 Jan 2010 * Rewrote splitEmailAuthor with list fns not regexes.
Data/FileStore/Git.hs view
@@ -37,7 +37,7 @@ gitFileStore :: FilePath -> FileStore gitFileStore repo = FileStore { initialize = gitInit repo- , save = gitSave repo + , save = gitSave repo , retrieve = gitRetrieve repo , delete = gitDelete repo , rename = gitMove repo@@ -75,7 +75,11 @@ B.writeFile postupdate postupdatecontents perms <- getPermissions postupdate setPermissions postupdate (perms {executable = True})- return ()+ -- Set up repo to allow push to current branch+ (status', err', _) <- runGitCommand repo "config" ["receive.denyCurrentBranch","ignore"]+ if status' == ExitSuccess+ then return ()+ else throwIO $ UnknownError $ "git config failed:\n" ++ err' else throwIO $ UnknownError $ "git-init failed:\n" ++ err -- | Commit changes to a resource. Raise 'Unchanged' exception if there were
Data/FileStore/Types.hs view
@@ -35,7 +35,6 @@ import Data.DateTime (DateTime) import Control.Exception (Exception) import Prelude hiding (catch)-import System.FilePath (FilePath) type RevisionId = String
Data/FileStore/Utils.hs view
@@ -37,28 +37,24 @@ import System.Exit (ExitCode(..)) import System.FilePath ((</>), takeDirectory) import System.IO (openTempFile, hClose)-import System.Process (runProcess, waitForProcess)+import System.Process (runInteractiveProcess, waitForProcess) import qualified Data.ByteString.Lazy as B import Data.FileStore.Types (SearchMatch(..), FileStoreError(IllegalResourceName, NotFound, UnknownError), SearchQuery(..)) --- | Run shell command and return error status, standard output, and error output. Assumes--- UTF-8 locale. Note that this does not actually go through \/bin\/sh!+-- | Run shell command and return error status, standard output, and error+-- output. Assumes UTF-8 locale. Note that this does not go through \/bin\/sh! runShellCommand :: FilePath -- ^ Working directory -> Maybe [(String, String)] -- ^ Environment -> String -- ^ Command -> [String] -- ^ Arguments -> IO (ExitCode, B.ByteString, B.ByteString)-runShellCommand workingDir environment command optionList = do- tempPath <- catch getTemporaryDirectory (\_ -> return ".")- (outputPath, hOut) <- openTempFile tempPath "out"- (errorPath, hErr) <- openTempFile tempPath "err"- hProcess <- runProcess (encodeString command) (map encodeString optionList) (Just workingDir) environment Nothing (Just hOut) (Just hErr)- status <- waitForProcess hProcess- errorOutput <- B.readFile errorPath- output <- B.readFile outputPath- removeFile errorPath- removeFile outputPath+runShellCommand wd env cmd args = do+ (hInp, hOut, hErr, ph) <- runInteractiveProcess (encodeString cmd) (map encodeString args) (Just wd) env+ hClose hInp+ output <- B.hGetContents hOut+ errorOutput <- B.hGetContents hErr+ status <- waitForProcess ph return (status, errorOutput, output) -- | Do a three way merge, using either git merge-file or RCS merge. Assumes
filestore.cabal view
@@ -1,5 +1,5 @@ Name: filestore-Version: 0.3.4.1+Version: 0.3.4.2 Cabal-version: >= 1.2 Build-type: Custom Tested-with: GHC==6.10.1@@ -42,6 +42,8 @@ if flag(maxcount) cpp-options: -DUSE_MAXCOUNT extensions: CPP-- Ghc-Options: -Wall+ if impl(ghc >= 6.12)+ Ghc-Options: -Wall -fno-warn-unused-do-bind+ else+ Ghc-Options: -Wall Ghc-Prof-Options: -auto-all