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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Show

Synopsis

- class ShowPatchBasic (p :: Type -> Type -> Type) where
  - showPatch :: ShowPatchFor -> p wX wY -> Doc
- displayPatch :: ShowPatchBasic p => p wX wY -> Doc
- data ShowPatchFor
  - = ForDisplay
  - | ForStorage
- class ShowPatchBasic p => ShowPatch (p :: Type -> Type -> Type) where
  - content :: p wX wY -> Doc
  - description :: p wX wY -> Doc
  - summary :: p wX wY -> Doc
  - summaryFL :: FL p wX wY -> Doc
  - thing :: p wX wY -> String
  - things :: p wX wY -> String
- class ShowPatchBasic p => ShowContextPatch (p :: Type -> Type -> Type) where
  - showPatchWithContextAndApply :: ApplyMonad (ApplyState p) m => ShowPatchFor -> p wX wY -> m Doc
- showPatchWithContext :: (ApplyMonadTrans (ApplyState p) m, ShowContextPatch p) => ShowPatchFor -> ApplyState p m -> p wX wY -> m Doc
- formatFileName :: FileNameFormat -> AnchoredPath -> Doc

# Documentation

class ShowPatchBasic (p :: Type -> Type -> Type) where #

Methods

showPatch :: ShowPatchFor -> p wX wY -> Doc #

#### Instances

Instances details

ShowPatchBasic Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Show Methods showPatch :: ShowPatchFor -> Prim wX wY -> Doc #
ShowPatchBasic RebaseName # |
Instance details Defined in Darcs.Patch.Rebase.Name Methods showPatch :: ShowPatchFor -> RebaseName wX wY -> Doc #
ShowPatchBasic Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods showPatch :: ShowPatchFor -> Prim wX wY -> Doc #
ShowPatchBasic Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods showPatch :: ShowPatchFor -> Prim wX wY -> Doc #
ShowPatchBasic p => ShowPatchBasic (Bracketed p) # |
Instance details Defined in Darcs.Patch.Bracketed Methods showPatch :: ShowPatchFor -> Bracketed p wX wY -> Doc #
ShowPatchBasic p => ShowPatchBasic (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods showPatch :: ShowPatchFor -> Invertible p wX wY -> Doc #
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (Named p) # |
Instance details Defined in Darcs.Patch.Named Methods showPatch :: ShowPatchFor -> Named p wX wY -> Doc #
ShowPatchBasic p => ShowPatchBasic (PatchInfoAndG p) # |
Instance details Defined in Darcs.Patch.PatchInfoAnd Methods showPatch :: ShowPatchFor -> PatchInfoAndG p wX wY -> Doc #
PrimPatch prim => ShowPatchBasic (RebaseChange prim) # |
Instance details Defined in Darcs.Patch.Rebase.Change Methods showPatch :: ShowPatchFor -> RebaseChange prim wX wY -> Doc #
ShowPatchBasic prim => ShowPatchBasic (RebaseFixup prim) # |
Instance details Defined in Darcs.Patch.Rebase.Fixup Methods showPatch :: ShowPatchFor -> RebaseFixup prim wX wY -> Doc #
(PatchListFormat prim, ShowPatchBasic prim) => ShowPatchBasic (Unwound prim) # |
Instance details Defined in Darcs.Patch.Unwind Methods showPatch :: ShowPatchFor -> Unwound prim wX wY -> Doc #
ShowPatchBasic prim => ShowPatchBasic (RepoPatchV1 prim) # |
Instance details Defined in Darcs.Patch.V1.Show Methods showPatch :: ShowPatchFor -> RepoPatchV1 prim wX wY -> Doc #
PrimPatch prim => ShowPatchBasic (RepoPatchV2 prim) # |
Instance details Defined in Darcs.Patch.V2.RepoPatch Methods showPatch :: ShowPatchFor -> RepoPatchV2 prim wX wY -> Doc #
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (FL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods showPatch :: ShowPatchFor -> FL p wX wY -> Doc #
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (RL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods showPatch :: ShowPatchFor -> RL p wX wY -> Doc #
(StorableId name, ShowPatchBasic p) => ShowPatchBasic (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods showPatch :: ShowPatchFor -> PrimWithName name p wX wY -> Doc #
(SignedId name, StorableId name, PrimPatch prim) => ShowPatchBasic (RepoPatchV3 name prim) # |
Instance details Defined in Darcs.Patch.V3.Core Methods showPatch :: ShowPatchFor -> RepoPatchV3 name prim wX wY -> Doc #

displayPatch :: ShowPatchBasic p => p wX wY -> Doc #

data ShowPatchFor #

Constructors

ForDisplay |
ForStorage |

class ShowPatchBasic p => ShowPatch (p :: Type -> Type -> Type) where #

This class is used only for user interaction, not for storage. The default implementations for `description` and `content` are suitable only for `PrimPatch` and `RepoPatch` types. Logically, `description` should default to `mempty` while `content` should default to `displayPatch`. We define them the other way around so that `showFriendly` gives reasonable results for all patch types.

Minimal complete definition

summary

Methods

content :: p wX wY -> Doc #

description :: p wX wY -> Doc #

summary :: p wX wY -> Doc #

summaryFL :: FL p wX wY -> Doc #

thing :: p wX wY -> String #

things :: p wX wY -> String #

#### Instances

Instances details

ShowPatch Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Show Methods content :: Prim wX wY -> Doc # description :: Prim wX wY -> Doc # summary :: Prim wX wY -> Doc # summaryFL :: FL Prim wX wY -> Doc # thing :: Prim wX wY -> String # things :: Prim wX wY -> String #
ShowPatch RebaseName # |
Instance details Defined in Darcs.Patch.Rebase.Name Methods content :: RebaseName wX wY -> Doc # description :: RebaseName wX wY -> Doc # summary :: RebaseName wX wY -> Doc # summaryFL :: FL RebaseName wX wY -> Doc # thing :: RebaseName wX wY -> String # things :: RebaseName wX wY -> String #
ShowPatch Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods content :: Prim wX wY -> Doc # description :: Prim wX wY -> Doc # summary :: Prim wX wY -> Doc # summaryFL :: FL Prim wX wY -> Doc # thing :: Prim wX wY -> String # things :: Prim wX wY -> String #
ShowPatch Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods content :: Prim wX wY -> Doc # description :: Prim wX wY -> Doc # summary :: Prim wX wY -> Doc # summaryFL :: FL Prim wX wY -> Doc # thing :: Prim wX wY -> String # things :: Prim wX wY -> String #
ShowPatch p => ShowPatch (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods content :: Invertible p wX wY -> Doc # description :: Invertible p wX wY -> Doc # summary :: Invertible p wX wY -> Doc # summaryFL :: FL (Invertible p) wX wY -> Doc # thing :: Invertible p wX wY -> String # things :: Invertible p wX wY -> String #
(Summary p, PatchListFormat p, PrimPatchBase p, ShowPatch p) => ShowPatch (Named p) # |
Instance details Defined in Darcs.Patch.Named Methods content :: Named p wX wY -> Doc # description :: Named p wX wY -> Doc # summary :: Named p wX wY -> Doc # summaryFL :: FL (Named p) wX wY -> Doc # thing :: Named p wX wY -> String # things :: Named p wX wY -> String #
(Summary p, PatchListFormat p, ShowPatch p) => ShowPatch (PatchInfoAndG p) # |
Instance details Defined in Darcs.Patch.PatchInfoAnd Methods content :: PatchInfoAndG p wX wY -> Doc # description :: PatchInfoAndG p wX wY -> Doc # summary :: PatchInfoAndG p wX wY -> Doc # summaryFL :: FL (PatchInfoAndG p) wX wY -> Doc # thing :: PatchInfoAndG p wX wY -> String # things :: PatchInfoAndG p wX wY -> String #
PrimPatch prim => ShowPatch (RebaseChange prim) # |
Instance details Defined in Darcs.Patch.Rebase.Change Methods content :: RebaseChange prim wX wY -> Doc # description :: RebaseChange prim wX wY -> Doc # summary :: RebaseChange prim wX wY -> Doc # summaryFL :: FL (RebaseChange prim) wX wY -> Doc # thing :: RebaseChange prim wX wY -> String # things :: RebaseChange prim wX wY -> String #
PrimPatch prim => ShowPatch (RepoPatchV1 prim) # |
Instance details Defined in Darcs.Patch.V1.Viewing Methods content :: RepoPatchV1 prim wX wY -> Doc # description :: RepoPatchV1 prim wX wY -> Doc # summary :: RepoPatchV1 prim wX wY -> Doc # summaryFL :: FL (RepoPatchV1 prim) wX wY -> Doc # thing :: RepoPatchV1 prim wX wY -> String # things :: RepoPatchV1 prim wX wY -> String #
PrimPatch prim => ShowPatch (RepoPatchV2 prim) # |
Instance details Defined in Darcs.Patch.V2.RepoPatch Methods content :: RepoPatchV2 prim wX wY -> Doc # description :: RepoPatchV2 prim wX wY -> Doc # summary :: RepoPatchV2 prim wX wY -> Doc # summaryFL :: FL (RepoPatchV2 prim) wX wY -> Doc # thing :: RepoPatchV2 prim wX wY -> String # things :: RepoPatchV2 prim wX wY -> String #
(PatchListFormat p, ShowPatch p) => ShowPatch (FL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods content :: FL p wX wY -> Doc # description :: FL p wX wY -> Doc # summary :: FL p wX wY -> Doc # summaryFL :: FL (FL p) wX wY -> Doc # thing :: FL p wX wY -> String # things :: FL p wX wY -> String #
(PatchListFormat p, ShowPatch p) => ShowPatch (RL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods content :: RL p wX wY -> Doc # description :: RL p wX wY -> Doc # summary :: RL p wX wY -> Doc # summaryFL :: FL (RL p) wX wY -> Doc # thing :: RL p wX wY -> String # things :: RL p wX wY -> String #
(StorableId name, PrimDetails p, ShowPatchBasic p) => ShowPatch (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods content :: PrimWithName name p wX wY -> Doc # description :: PrimWithName name p wX wY -> Doc # summary :: PrimWithName name p wX wY -> Doc # summaryFL :: FL (PrimWithName name p) wX wY -> Doc # thing :: PrimWithName name p wX wY -> String # things :: PrimWithName name p wX wY -> String #
(SignedId name, StorableId name, PrimPatch prim) => ShowPatch (RepoPatchV3 name prim) # |
Instance details Defined in Darcs.Patch.V3.Core Methods content :: RepoPatchV3 name prim wX wY -> Doc # description :: RepoPatchV3 name prim wX wY -> Doc # summary :: RepoPatchV3 name prim wX wY -> Doc # summaryFL :: FL (RepoPatchV3 name prim) wX wY -> Doc # thing :: RepoPatchV3 name prim wX wY -> String # things :: RepoPatchV3 name prim wX wY -> String #

class ShowPatchBasic p => ShowContextPatch (p :: Type -> Type -> Type) where #

Methods

showPatchWithContextAndApply :: ApplyMonad (ApplyState p) m => ShowPatchFor -> p wX wY -> m Doc #

Show a patch with context lines added, as diff -u does. Thus, it differs from showPatch only for hunks. It is used for instance before putting it into a bundle. As this unified context is not included in patch representation, this requires access to the `ApplyState`.

Note that this applies the patch in the `ApplyMonad` given by the context. This is done in order to simplify showing multiple patches in a series, since each patch may change the context lines for later changes.

For a version that does not apply the patch see `showPatchWithContext`.

#### Instances

Instances details

Apply Prim => ShowContextPatch Prim # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Show Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState Prim) m => ShowPatchFor -> Prim wX wY -> m Doc #
ShowContextPatch Prim # |
Instance details Defined in Darcs.Patch.V1.Prim Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState Prim) m => ShowPatchFor -> Prim wX wY -> m Doc #
ShowContextPatch Prim # |
Instance details Defined in Darcs.Patch.V2.Prim Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState Prim) m => ShowPatchFor -> Prim wX wY -> m Doc #
ShowContextPatch p => ShowContextPatch (Invertible p) # |
Instance details Defined in Darcs.Patch.Invertible Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (Invertible p)) m => ShowPatchFor -> Invertible p wX wY -> m Doc #
(Apply p, IsHunk p, PatchListFormat p, ObjectId (ObjectIdOfPatch p), ShowContextPatch p) => ShowContextPatch (Named p) # |
Instance details Defined in Darcs.Patch.Named Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (Named p)) m => ShowPatchFor -> Named p wX wY -> m Doc #
ShowContextPatch p => ShowContextPatch (PatchInfoAndG p) # |
Instance details Defined in Darcs.Patch.PatchInfoAnd Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (PatchInfoAndG p)) m => ShowPatchFor -> PatchInfoAndG p wX wY -> m Doc #
PrimPatch prim => ShowContextPatch (RebaseChange prim) # |
Instance details Defined in Darcs.Patch.Rebase.Change Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (RebaseChange prim)) m => ShowPatchFor -> RebaseChange prim wX wY -> m Doc #
PrimPatch prim => ShowContextPatch (RepoPatchV1 prim) # |
Instance details Defined in Darcs.Patch.V1.Viewing Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (RepoPatchV1 prim)) m => ShowPatchFor -> RepoPatchV1 prim wX wY -> m Doc #
PrimPatch prim => ShowContextPatch (RepoPatchV2 prim) # |
Instance details Defined in Darcs.Patch.V2.RepoPatch Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (RepoPatchV2 prim)) m => ShowPatchFor -> RepoPatchV2 prim wX wY -> m Doc #
(Apply p, IsHunk p, PatchListFormat p, ShowContextPatch p, ObjectId (ObjectIdOfPatch p)) => ShowContextPatch (FL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (FL p)) m => ShowPatchFor -> FL p wX wY -> m Doc #
(ShowContextPatch p, Apply p, IsHunk p, PatchListFormat p, ObjectId (ObjectIdOfPatch p)) => ShowContextPatch (RL p) # |
Instance details Defined in Darcs.Patch.Viewing Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (RL p)) m => ShowPatchFor -> RL p wX wY -> m Doc #
(StorableId name, ShowContextPatch p) => ShowContextPatch (PrimWithName name p) # |
Instance details Defined in Darcs.Patch.Prim.WithName Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (PrimWithName name p)) m => ShowPatchFor -> PrimWithName name p wX wY -> m Doc #
(SignedId name, StorableId name, PrimPatch prim) => ShowContextPatch (RepoPatchV3 name prim) # |
Instance details Defined in Darcs.Patch.V3.Core Methods showPatchWithContextAndApply :: ApplyMonad (ApplyState (RepoPatchV3 name prim)) m => ShowPatchFor -> RepoPatchV3 name prim wX wY -> m Doc #

showPatchWithContext :: (ApplyMonadTrans (ApplyState p) m, ShowContextPatch p) => ShowPatchFor -> ApplyState p m -> p wX wY -> m Doc #

Like `showPatchWithContextAndApply` but without applying the patch in the monad `m`.

formatFileName :: FileNameFormat -> AnchoredPath -> Doc #

Format a `AnchoredPath` to a `Doc` according to the given `FileNameFormat`.

NOTE: This is not only used for display but also to format patch files. This is why we have to do the white space encoding here. See `writePatchIfNecessary`.

Besides white space encoding, for `FileNameFormatV2` we just pack it into a `Doc`. For `FileNameFormatV1` we must emulate the non-standard darcs-1 encoding of file paths: it is an UTF8 encoding of the raw byte stream, interpreted as code points.

See also `readFileName`.