A few darcs-specific utility functions. These are used for reading and writing darcs and darcs-compatible hashed trees.
- darcsDecodeWhite :: String -> FilePath
- darcsEncodeWhite :: FilePath -> String
- darcsEncodeWhiteBS :: ByteString -> ByteString
- decodeDarcsHash :: ByteString -> Hash
- decodeDarcsSize :: ByteString -> Maybe Int
- darcsLocation :: FilePath -> (Maybe Int, Hash) -> FileSegment
- darcsFormatDir :: Tree m -> Maybe ByteString
- darcsParseDir :: ByteString -> [(ItemType, Name, Maybe Int, Hash)]
- darcsTreeHash :: Tree m -> Hash
- darcsUpdateDirHashes :: Tree m -> Tree m
- darcsUpdateHashes :: (Monad m, Functor m) => Tree m -> m (Tree m)
- darcsAddMissingHashes :: (Monad m, Functor m) => Tree m -> m (Tree m)
- readDarcsHashedDir :: FilePath -> (Maybe Int, Hash) -> IO [(ItemType, Name, Maybe Int, Hash)]
- readDarcsHashed :: FilePath -> (Maybe Int, Hash) -> IO (Tree IO)
- writeDarcsHashed :: Tree IO -> FilePath -> IO Hash
- fsCreateHashedFile :: FilePath -> ByteString -> TreeIO ()
- hashedTreeIO :: TreeIO a -> Tree IO -> FilePath -> IO (a, Tree IO)
- readPackedDarcsPristine :: OS -> Hash -> IO (Tree IO)
- writePackedDarcsPristine :: Tree IO -> OS -> IO (OS, Hash)
- storePackedDarcsPristine :: Tree IO -> OS -> IO (OS, Hash)
- darcsPristineRefs :: FileSegment -> IO [Hash]
darcsEncodeWhite translates whitespace in filenames to a darcs-specific
format (backslash followed by numerical representation according to
Note that backslashes are also escaped since they are used in the encoding.
darcsEncodeWhite "hello there" == "hello\32\there" darcsEncodeWhite "hello\there" == "hello\92\there"
Compute a darcs-compatible hash value for a tree-like structure.
Read and parse a darcs-style hashed directory listing from a given
and with a given
Read in a darcs-style hashed tree. This is mainly useful for reading "pristine.hashed". You need to provide the root hash you are interested in (found in _darcs/hashed_inventory).
Write a Tree into a darcs-style hashed directory.
Create a hashed file from a
FilePath and content. In case the file exists
it is kept untouched and is assumed to have the right content. XXX Corrupt
files should be probably renamed out of the way automatically or something
(probably when they are being read though).
action in a hashed setting. The
initial tree is assumed
to be fully available from the
directory, and any changes will be written
out to same. Please note that actual filesystem files are never removed.
XXX This somehow manages to leak memory, in some usege scenarios (apparently not even all). The only reproducer known so far is "gorsvet pull".
Read a Tree in the darcs hashed format from an object storage. This is basically the same as readDarcsHashed from Storage.Hashed, but uses an object storage instead of traditional darcs filesystem layout. Requires the tree root hash as a starting point.
Write a Tree into an object storage, using the darcs-style directory formatting (and therefore darcs-style hashes). Gives back the object storage and the root hash of the stored Tree. NB. The function expects that the Tree comes equipped with darcs-style hashes already!