darcs-2.12.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.Tree.Hashed

Contents

- Obtaining Trees.
- Writing trees.
- Interact with hashed tree
- Other

Description

A few darcs-specific utility functions. These are used for reading and writing darcs and darcs-compatible hashed trees.

Synopsis

- readDarcsHashed :: FilePath -> (Maybe Int, Hash) -> IO (Tree IO)
- writeDarcsHashed :: Tree IO -> FilePath -> IO Hash
- hashedTreeIO :: TreeIO a -> Tree IO -> FilePath -> IO (a, Tree IO)
- readDarcsHashedDir :: FilePath -> (Maybe Int, Hash) -> IO [(ItemType, Name, Maybe Int, Hash)]
- readDarcsHashedNosize :: FilePath -> Hash -> IO (Tree IO)
- darcsAddMissingHashes :: (Monad m, Functor m) => Tree m -> m (Tree m)
- darcsLocation :: FilePath -> (Maybe Int, Hash) -> FileSegment
- darcsTreeHash :: Tree m -> Hash
- decodeDarcsHash :: ByteString -> Hash
- decodeDarcsSize :: ByteString -> Maybe Int
- darcsUpdateHashes :: (Monad m, Functor m) => Tree m -> m (Tree m)

# Obtaining Trees.

Please note that Trees obtained this way will contain Stub items. These need to be executed (they are IO actions) in order to be accessed. Use `expand` to do this. However, many operations are perfectly fine to be used on a stubbed Tree (and it is often more efficient to do everything that can be done before expanding a Tree).

readDarcsHashed :: FilePath -> (Maybe Int, Hash) -> IO (Tree IO) #

# Writing trees.

writeDarcsHashed :: Tree IO -> FilePath -> IO Hash #

Write a Tree into a darcs-style hashed directory.

# Interact with hashed tree

hashedTreeIO #

Arguments

:: TreeIO a | action
-> Tree IO | initial
-> FilePath | directory
-> IO (a, Tree IO) |

Run a `TreeIO` `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.

# Other

readDarcsHashedDir :: FilePath -> (Maybe Int, Hash) -> IO [(ItemType, Name, Maybe Int, Hash)] #

Read and parse a darcs-style hashed directory listing from a given `dir` and with a given `hash`.

readDarcsHashedNosize :: FilePath -> Hash -> IO (Tree IO) #

darcsAddMissingHashes :: (Monad m, Functor m) => Tree m -> m (Tree m) #

darcsLocation :: FilePath -> (Maybe Int, Hash) -> FileSegment #

darcsTreeHash :: Tree m -> Hash #

Compute a darcs-compatible hash value for a tree-like structure.

decodeDarcsHash :: ByteString -> Hash #

decodeDarcsSize :: ByteString -> Maybe Int #

darcsUpdateHashes :: (Monad m, Functor m) => Tree m -> m (Tree m) #