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

Safe Haskell | None

Darcs.Patch.Info

Synopsis

- data PatchInfo = PatchInfo {
  - _piDate :: !ByteString
  - _piName :: !ByteString
  - _piAuthor :: !ByteString
  - _piLog :: ![ByteString]
  - isInverted :: !Bool
  }
- patchinfo :: String -> String -> String -> [String] -> IO PatchInfo
- invertName :: PatchInfo -> PatchInfo
- idpatchinfo :: PatchInfo
- addJunk :: PatchInfo -> IO PatchInfo
- makePatchname :: PatchInfo -> String
- makeFilename :: PatchInfo -> String
- makeAltFilename :: PatchInfo -> String
- readPatchInfo :: ParserM m => m PatchInfo
- justName :: PatchInfo -> String
- justAuthor :: PatchInfo -> String
- justLog :: PatchInfo -> String
- repopatchinfo :: String -> PatchInfo -> RepoPatchInfo
- data RepoPatchInfo
- humanFriendly :: PatchInfo -> Doc
- toXml :: PatchInfo -> Doc
- piDate :: PatchInfo -> CalendarTime
- setPiDate :: String -> PatchInfo -> PatchInfo
- piDateString :: PatchInfo -> String
- piDateBytestring :: PatchInfo -> ByteString
- piName :: PatchInfo -> String
- piRename :: PatchInfo -> String -> PatchInfo
- piAuthor :: PatchInfo -> String
- piTag :: PatchInfo -> Maybe String
- piLog :: PatchInfo -> [String]
- showPatchInfo :: PatchInfo -> Doc
- isTag :: PatchInfo -> Bool
- readPatchInfos :: ByteString -> [PatchInfo]
- escapeXML :: String -> Doc

# Documentation

data PatchInfo

A PatchInfo value contains the metadata of a patch. The date, name, author and log fields are UTF-8 encoded text in darcs 2.4 and later, and just sequences of bytes (decoded with whatever is the locale when displayed) in earlier darcs.

The members with names that start with '_' are not supposed to be used directly in code that does not care how the patch info is stored.

Constructors

PatchInfo |

Fields

_piDate :: !ByteString
_piName :: !ByteString
_piAuthor :: !ByteString
_piLog :: ![ByteString]
isInverted :: !Bool

Instances

Eq PatchInfo |
Ord PatchInfo |
Show PatchInfo |

patchinfo :: String -> String -> String -> [String] -> IO PatchInfo

invertName :: PatchInfo -> PatchInfo

idpatchinfo :: PatchInfo

addJunk :: PatchInfo -> IO PatchInfo

addJunk adds a line that contains a random number to make the patch unique.

makePatchname :: PatchInfo -> String

makeFilename :: PatchInfo -> String

This makes darcs-1 (non-hashed repos) filenames, and is also generally used in both in hashed and non-hashed repo code for making patch hashes.

The name consists of three segments:

- timestamp (ISO8601-compatible yyyymmmddHHMMSS, UTC)
- SHA1 hash of the author
- SHA1 hash of the patch name, author, date, log, and "inverted" flag.

makeAltFilename :: PatchInfo -> String

readPatchInfo :: ParserM m => m PatchInfo

Parser for `PatchInfo` as stored in patch bundles and inventory files, for example:

     [Document the foo interface
     John Doe <john.doe@example.com>**20110615084241
      Ignore-this: 85b94f67d377c4ab671101266ef9c229
      Nobody knows what a 'foo' is, so describe it.
     ]

See `showPatchInfo` for the inverse operation.

justName :: PatchInfo -> String

Get the name, including an UNDO: prefix if the patch is inverted.

justAuthor :: PatchInfo -> String

Returns the author of a patch.

justLog :: PatchInfo -> String

repopatchinfo :: String -> PatchInfo -> RepoPatchInfo

data RepoPatchInfo

Instances

HTML RepoPatchInfo |

humanFriendly :: PatchInfo -> Doc

toXml :: PatchInfo -> Doc

piDate :: PatchInfo -> CalendarTime

setPiDate :: String -> PatchInfo -> PatchInfo

piDateString :: PatchInfo -> String

piDateBytestring :: PatchInfo -> ByteString

piName :: PatchInfo -> String

Returns the name of the patch. Unlike `justName`, it does not preprend UNDO: to the name if the patch is inverted.

piRename :: PatchInfo -> String -> PatchInfo

piAuthor :: PatchInfo -> String

Returns the author of a patch.

piTag :: PatchInfo -> Maybe String

Get the tag name, if the patch is a tag patch.

piLog :: PatchInfo -> [String]

Get the log message of a patch.

showPatchInfo :: PatchInfo -> Doc

Patch is stored between square brackets.

     [ <patch name>
     <patch author>*<patch date>
      <patch log (may be empty)> (indented one)
      <can have multiple lines in patch log,>
      <as long as they're preceded by a space>
      <and don't end with a square bracket.>
     ]

note that below I assume the name has no newline in it. See `readPatchInfo` for the inverse operation.

isTag :: PatchInfo -> Bool

readPatchInfos :: ByteString -> [PatchInfo]

escapeXML :: String -> Doc