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

Safe Haskell | None
Language | Haskell2010

Darcs.UI.PatchHeader

Synopsis

- getLog :: forall prim wX wY. (Patchy prim, PrimPatch prim) => Maybe String -> Bool -> Logfile -> Maybe AskLongComment -> Maybe (String, [String]) -> FL prim wX wY -> IO (String, [String], Maybe String)
- getAuthor :: String -> Bool -> Maybe String -> PatchInfo -> HijackT IO String
- updatePatchHeader :: forall rt p wX wY wR wU wT. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> AskAboutDeps rt p wR wU wT -> PatchSelectionOptions -> DiffAlgorithm -> Bool -> Bool -> Maybe String -> Maybe String -> Maybe AskLongComment -> PatchInfoAnd rt p wT wX -> FL (PrimOf p) wX wY -> HijackT IO (Maybe String, PatchInfoAnd rt p wT wY)
- data AskAboutDeps rt p wR wU wT
  - = AskAboutDeps (Repository rt p wR wU wT)
  - | NoAskAboutDeps
- type HijackT = StateT HijackOptions
- data HijackOptions
  - = IgnoreHijack
  - | RequestHijackPermission
  - | AlwaysRequestHijackPermission
- runHijackT :: Monad m => HijackOptions -> HijackT m a -> m a

# Documentation

getLog #

Arguments

:: (Patchy prim, PrimPatch prim) |
=> Maybe String | patchname option
-> Bool | pipe option
-> Logfile | logfile option
-> Maybe AskLongComment | askLongComment option
-> Maybe (String, [String]) | possibly an existing patch name and long description
-> FL prim wX wY | changes to record
-> IO (String, [String], Maybe String) | patch name, long description and possibly the path to the temporary file that should be removed later

Get the patch name and long description from one of

- the configuration (flags, defaults, hard-coded)
- an existing log file
- stdin (e.g. a pipe)
- a text editor

It ensures the patch name is not empty nor starts with the prefix TAG.

The last result component is a possible path to a temporary file that should be removed later.

getAuthor #

Arguments

:: String | verb: command name
-> Bool | select: prompt for new auhor
-> Maybe String | new author: explict new author
-> PatchInfo | patch to update
-> HijackT IO String |

`getAuthor` tries to return the updated author for the patch. There are two different scenarios:

- [explicit] Either we want to override the patch author, be it by prompting the user (`select`) or having them pass it in from the UI (`new_author`), or
- [implicit] We want to keep the original author, in which case we also double-check that we are not inadvertently "hijacking" somebody else's patch (if the patch author is not the same as the repository author, we give them a chance to abort the whole operation)

updatePatchHeader #

Arguments

:: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) |
=> String | verb: command name
-> AskAboutDeps rt p wR wU wT |
-> PatchSelectionOptions |
-> DiffAlgorithm |
-> Bool |
-> Bool |
-> Maybe String |
-> Maybe String |
-> Maybe AskLongComment |
-> PatchInfoAnd rt p wT wX |
-> FL (PrimOf p) wX wY |
-> HijackT IO (Maybe String, PatchInfoAnd rt p wT wY) |

Update the metadata for a patch. This potentially involves a bit of interactivity, so we may return `Nothing` if there is cause to abort what we're doing along the way

data AskAboutDeps rt p wR wU wT #

specify whether to ask about dependencies with respect to a particular repository, or not

Constructors

AskAboutDeps (Repository rt p wR wU wT) |
NoAskAboutDeps |

type HijackT = StateT HijackOptions #

Transformer for interactions with a hijack warning state that we need to thread through

data HijackOptions #

Options for how to deal with the situation where we are somehow modifying a patch that is not our own

Constructors

IgnoreHijack | accept all hijack requests
RequestHijackPermission | prompt once, accepting subsequent hijacks if yes
AlwaysRequestHijackPermission | always prompt

runHijackT :: Monad m => HijackOptions -> HijackT m a -> m a #

Run a job that involves a hijack confirmation prompt.

See `RequestHijackPermission` for initial values