filestore-0.1: Interface for versioning file stores.Source codeContentsIndex
MaintainerJohn MacFarlane <>
Utility functions for running external processes.
runShellCommand :: FilePath -> Maybe [(String, String)] -> String -> [String] -> IO (ExitCode, ByteString, ByteString)
mergeContents :: (String, ByteString) -> (String, ByteString) -> (String, ByteString) -> IO (Bool, String)
hashsMatch :: Eq a => [a] -> [a] -> Bool
isInsideRepo :: FilePath -> FilePath -> IO Bool
escapeRegexSpecialChars :: String -> String
parseMatchLine :: String -> SearchMatch
:: FilePathWorking directory
-> Maybe [(String, String)]Environment
-> StringCommand
-> [String]Arguments
-> IO (ExitCode, ByteString, ByteString)
Run shell command and return error status, standard output, and error output. Assumes UTF-8 locale. Note that this does not actuall go through /bin/sh!
:: (String, ByteString)(label, contents) of edited version
-> (String, ByteString)(label, contents) of original revision
-> (String, ByteString)(label, contents) of latest version
-> IO (Bool, String)(were there conflicts?, merged contents)
Do a three way merge, using either git merge-file or RCS merge. Assumes that either git or merge is in the system path. Assumes UTF-8 locale.
hashsMatch :: Eq a => [a] -> [a] -> BoolSource
A number of VCS systems uniquely identify a particular revision or change via a cryptographic hash of some sort. These hashs can be very long, and so systems like Git and Darcs don't require the entire hash - a *unique prefix*. Thus a definition of hash equality is ==, certainly, but also simply whether either is a prefix of the other. If both are reasonably long, then the likelihood the shorter one is not a unique prefix of the longer (that is, clashes with another hash) is small. The burden of proof is on the caller to not pass a uselessly short short-hash like '1', however.
isInsideRepo :: FilePath -> FilePath -> IO BoolSource
Inquire of a certain repository whether another file lies within its ambit. This is basically asking whether the file is above the repository in the filesystems's directory tree. Useful for checking the legality of a filename.
escapeRegexSpecialChars :: String -> StringSource
parseMatchLine :: String -> SearchMatchSource

A parser function. This is intended for use on strings which are output by grep programs or programs which mimic the standard grep output - which uses colons as delimiters and has 3 fields: the filename, the line number, and then the matching line itself. Note that this is for use on only strings meeting that format - if it goes file:match, this will throw a pattern-match exception.

 parseMatchLine "foo:10:bar baz quux" ~> 
 SearchMatch {matchResourceName = "foo", matchLineNumber = 10, matchLine = "bar baz quux"}
Produced by Haddock version 2.6.0