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

Safe Haskell | None
Language | Haskell2010

Darcs.UI.SelectChanges

Contents

- Working with changes
- Interactive selection utils
  - Navigating the patchset
  - Decisions
  - Prompts and queries

Synopsis

- data WhichChanges
  - = Last
  - | LastReversed
  - | First
  - | FirstReversed
- viewChanges :: (Patchy p, ShowPatch p, ApplyState p ~ Tree) => PatchSelectionOptions -> [Sealed2 p] -> IO ()
- withSelectedPatchFromRepo :: forall rt p wR wU wT. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> PatchSelectionOptions -> (forall wA. (FL (PatchInfoAnd rt p) :> PatchInfoAnd rt p) wA wR -> IO ()) -> IO ()
- runSelection :: forall p wX wY. (Patchy p, PatchInspect p, ShowPatch p, ApplyState p ~ Tree) => FL p wX wY -> PatchSelectionContext p -> IO ((FL p :> FL p) wX wY)
- selectionContextPrim :: PrimPatch prim => WhichChanges -> String -> PatchSelectionOptions -> Maybe (Splitter prim) -> Maybe [FilePath] -> Maybe (Tree IO) -> PatchSelectionContext prim
- selectionContextGeneric :: (IsRepoType rt, RepoPatch p, Invert q) => (forall wX wY. q wX wY -> Sealed2 (PatchInfoAnd rt p)) -> WhichChanges -> String -> PatchSelectionOptions -> Maybe [FilePath] -> PatchSelectionContext q
- selectionContext :: (IsRepoType rt, RepoPatch p) => WhichChanges -> String -> PatchSelectionOptions -> Maybe (Splitter (PatchInfoAnd rt p)) -> Maybe [FilePath] -> PatchSelectionContext (PatchInfoAnd rt p)
- data PatchSelectionContext p
- printSummary :: forall p wX wY. ShowPatch p => p wX wY -> IO ()
- data PatchSelectionOptions = PatchSelectionOptions {
  - verbosity :: Verbosity
  - matchFlags :: [MatchFlag]
  - interactive :: Bool
  - selectDeps :: SelectDeps
  - summary :: Summary
  - withContext :: WithContext
  }
- type InteractiveSelectionM p wX wY a = StateT (InteractiveSelectionContext p wX wY) (PatchSelectionM p IO) a
- data InteractiveSelectionContext p wX wY = ISC {
  - total :: Int
  - current :: Int
  - lps :: FZipper (LabelledPatch p) wX wY
  - choices :: PatchChoices p wX wY
  }
- currentPatch :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY (Maybe (Sealed2 (LabelledPatch p)))
- skipMundane :: (Patchy p, ShowPatch p) => InteractiveSelectionM p wX wY ()
- skipOne :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY ()
- backOne :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY ()
- backAll :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY ()
- showCur :: forall p wX wY. (Patchy p, ShowPatch p, ApplyState p ~ Tree) => InteractiveSelectionM p wX wY ()
- decide :: forall p wX wY wT wU. Patchy p => Bool -> LabelledPatch p wT wU -> InteractiveSelectionM p wX wY ()
- decideWholeFile :: forall p wX wY. (Patchy p, PatchInspect p) => FilePath -> Bool -> InteractiveSelectionM p wX wY ()
- isSingleFile :: PatchInspect p => p wX wY -> Bool
- currentFile :: forall p wX wY. (Patchy p, PatchInspect p) => InteractiveSelectionM p wX wY (Maybe FilePath)
- promptUser :: forall p wX wY. (Patchy p, ShowPatch p) => Bool -> Char -> InteractiveSelectionM p wX wY Char
- prompt :: (Patchy p, ShowPatch p) => InteractiveSelectionM p wX wY String
- data KeyPress = KeyPress {
  - kp :: Char
  - kpHelp :: String
  }
- keysFor :: [[KeyPress]] -> [Char]
- helpFor :: String -> [[KeyPress]] -> [[KeyPress]] -> String
- askAboutDepends :: forall rt p wR wU wT wY. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> FL (PrimOf p) wT wY -> PatchSelectionOptions -> [PatchInfo] -> IO [PatchInfo]

# Working with changes

data WhichChanges #

When asking about patches, we either ask about them in oldest-first or newest first (with respect to the current ordering of the repository), and we either want an initial segment or a final segment of the poset of patches.

`First`: ask for an initial segment, first patches first (default for all pull-like commands)

`FirstReversed`: ask for an initial segment, last patches first (used to ask about dependencies in record, and for pull-like commands with the `--reverse` flag).

`LastReversed`: ask for a final segment, last patches first. (default for unpull-like commands, except for selecting *primitive* patches in rollback)

`Last`: ask for a final segment, first patches first. (used for selecting primitive patches in rollback, and for unpull-like commands with the `--reverse` flag

Constructors

Last |
LastReversed |
First |
FirstReversed |

Instances

Eq WhichChanges # |
Methods (==) :: WhichChanges -> WhichChanges -> Bool # (/=) :: WhichChanges -> WhichChanges -> Bool #
Show WhichChanges # |
Methods showsPrec :: Int -> WhichChanges -> ShowS # show :: WhichChanges -> String # showList :: [WhichChanges] -> ShowS #

viewChanges :: (Patchy p, ShowPatch p, ApplyState p ~ Tree) => PatchSelectionOptions -> [Sealed2 p] -> IO () #

The equivalent of `runSelection` for the `darcs log` command

withSelectedPatchFromRepo :: forall rt p wR wU wT. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> PatchSelectionOptions -> (forall wA. (FL (PatchInfoAnd rt p) :> PatchInfoAnd rt p) wA wR -> IO ()) -> IO () #

The function for selecting a patch to amend record. Read at your own risks.

runSelection :: forall p wX wY. (Patchy p, PatchInspect p, ShowPatch p, ApplyState p ~ Tree) => FL p wX wY -> PatchSelectionContext p -> IO ((FL p :> FL p) wX wY) #

runs a `PatchSelection` action in the given `PatchSelectionContext`.

selectionContextPrim :: PrimPatch prim => WhichChanges -> String -> PatchSelectionOptions -> Maybe (Splitter prim) -> Maybe [FilePath] -> Maybe (Tree IO) -> PatchSelectionContext prim #

A `PatchSelectionContext` for selecting `Prim` patches.

selectionContextGeneric :: (IsRepoType rt, RepoPatch p, Invert q) => (forall wX wY. q wX wY -> Sealed2 (PatchInfoAnd rt p)) -> WhichChanges -> String -> PatchSelectionOptions -> Maybe [FilePath] -> PatchSelectionContext q #

A generic `PatchSelectionContext`.

selectionContext :: (IsRepoType rt, RepoPatch p) => WhichChanges -> String -> PatchSelectionOptions -> Maybe (Splitter (PatchInfoAnd rt p)) -> Maybe [FilePath] -> PatchSelectionContext (PatchInfoAnd rt p) #

A `PatchSelectionContext` for selecting full patches (`PatchInfoAnd` patches)

data PatchSelectionContext p #

A `PatchSelectionContext` contains all the static settings for selecting patches. See PatchSelectionM

printSummary :: forall p wX wY. ShowPatch p => p wX wY -> IO () #

# Interactive selection utils

data PatchSelectionOptions #

Constructors

PatchSelectionOptions |
Fields verbosity :: Verbosity matchFlags :: [MatchFlag] interactive :: Bool selectDeps :: SelectDeps summary :: Summary withContext :: WithContext

type InteractiveSelectionM p wX wY a = StateT (InteractiveSelectionContext p wX wY) (PatchSelectionM p IO) a #

data InteractiveSelectionContext p wX wY #

The dynamic parameters for interactive selection of patches.

Constructors

ISC |
Fields total :: Int total number of patches current :: Int number of already-seen patches lps :: FZipper (LabelledPatch p) wX wY the patches we offer choices :: PatchChoices p wX wY the user's choices

## Navigating the patchset

currentPatch :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY (Maybe (Sealed2 (LabelledPatch p))) #

Returns a `Sealed2` version of the patch we are asking the user about.

skipMundane :: (Patchy p, ShowPatch p) => InteractiveSelectionM p wX wY () #

Skips patches we should not ask the user about

skipOne :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY () #

Focus the next patch.

backOne :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY () #

Focus the previous patch.

backAll :: forall p wX wY. Patchy p => InteractiveSelectionM p wX wY () #

showCur :: forall p wX wY. (Patchy p, ShowPatch p, ApplyState p ~ Tree) => InteractiveSelectionM p wX wY () #

Shows the current patch as it should be seen by the user.

## Decisions

decide :: forall p wX wY wT wU. Patchy p => Bool -> LabelledPatch p wT wU -> InteractiveSelectionM p wX wY () #

`decide True` selects the current patch, and `decide False` deselects it.

decideWholeFile :: forall p wX wY. (Patchy p, PatchInspect p) => FilePath -> Bool -> InteractiveSelectionM p wX wY () #

like `decide`, but for all patches touching `file`

## Prompts and queries

isSingleFile :: PatchInspect p => p wX wY -> Bool #

currentFile :: forall p wX wY. (Patchy p, PatchInspect p) => InteractiveSelectionM p wX wY (Maybe FilePath) #

returns `Just f` if the `currentPatch` only modifies `f`, `Nothing` otherwise.

promptUser :: forall p wX wY. (Patchy p, ShowPatch p) => Bool -> Char -> InteractiveSelectionM p wX wY Char #

Asks the user about one patch, returns their answer.

prompt :: (Patchy p, ShowPatch p) => InteractiveSelectionM p wX wY String #

The question to ask about one patch.

data KeyPress #

The type of the answers to a "shall I [wiggle] that [foo]?" question They are found in a [[KeyPress]] bunch, each list representing a set of answers which belong together

Constructors

KeyPress |
Fields kp :: Char kpHelp :: String

keysFor :: [[KeyPress]] -> [Char] #

The keys used by a list of `keyPress` groups.

helpFor :: String -> [[KeyPress]] -> [[KeyPress]] -> String #

Generates the help for a set of basic and advanced `KeyPress` groups.

askAboutDepends :: forall rt p wR wU wT wY. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> FL (PrimOf p) wT wY -> PatchSelectionOptions -> [PatchInfo] -> IO [PatchInfo] #