hashed-storage-0.3.8: Hashed file storage support code.Source codeContentsIndex
Storage.Hashed.Darcs
Description
A few darcs-specific utility functions. These are used for reading and writing darcs and darcs-compatible hashed trees.
Synopsis
darcsFormatSize :: Num a => a -> ByteString
darcsFormatHash :: Hash -> ByteString
darcsDecodeWhite :: String -> FilePath
darcsEncodeWhite :: FilePath -> String
darcsFormatDir :: Tree -> ByteString
darcsParseDir :: ByteString -> [(ItemType, Name, Hash)]
darcsTreeHash :: Tree -> Hash
Documentation
darcsFormatSize :: Num a => a -> ByteStringSource
darcsFormatHash :: Hash -> ByteStringSource
darcsDecodeWhite :: String -> FilePathSource

decode_white interprets the Darcs-specific "encoded" filenames produced by darcsEncodeWhite

 darcsDecodeWhite "hello\32\there" == "hello there"
 darcsDecodeWhite "hello\92\there" == "hello\there"
 darcsDecodeWhite "hello\there"    == error "malformed filename"
darcsEncodeWhite :: FilePath -> StringSource

encode_white translates whitespace in filenames to a darcs-specific format (backslash followed by numerical representation according to ord). 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"
darcsFormatDir :: Tree -> ByteStringSource
darcsParseDir :: ByteString -> [(ItemType, Name, Hash)]Source
darcsTreeHash :: Tree -> HashSource
Compute a darcs-compatible hash value for a tree-like structure.
Produced by Haddock version 2.4.2