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

Darcs.Patch.Split

Synopsis

- data Splitter p = Splitter {
  - applySplitter :: p -> Maybe (ByteString, ByteString -> Maybe (FL p))
  - canonizeSplit :: FL p -> FL p
  }
- rawSplitter :: (ShowPatch p, ReadPatch p, Invert p) => Splitter p
- noSplitter :: Splitter p
- primSplitter :: Splitter Prim

# Documentation

data Splitter p

A splitter is something that can take a patch and (possibly) render it as text in some format of its own choosing. This text can then be presented to the user for editing, and the result given to the splitter for parsing. If the parse succeeds, the result is a list of patches that could replace the original patch in any context. Typically this list will contain the changed version of the patch, along with fixup pieces to ensure that the overall effect of the list is the same as the original patch. The individual elements of the list can then be offered separately to the user, allowing them to accept some and reject others.

There's no immediate application for a splitter for anything other than Prim (you shouldn't go editing named patches, you'll break them!) However you might want to compose splitters for FilePatchType to make splitters for Prim etc, and the generality doesn't cost anything.

Constructors

Splitter |

Fields

applySplitter :: p -> Maybe (ByteString, ByteString -> Maybe (FL p))
canonizeSplit :: FL p -> FL p

rawSplitter :: (ShowPatch p, ReadPatch p, Invert p) => Splitter p

This generic splitter just lets the user edit the printed representation of the patch Should not be used expect for testing and experimentation.

noSplitter :: Splitter p

Never splits. In other code we normally pass around Maybe Splitter instead of using this as the default, because it saves clients that don't care about splitting from having to import this module just to get noSplitter.

primSplitter :: Splitter Prim

Split a primitive hunk patch up by allowing the user to edit both the before and after lines, then insert fixup patches to clean up the mess.