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

Safe Haskell | None

Darcs.Patch

Contents

- for PatchTest

Synopsis

- class (Patchy p, Merge p, Effect p, IsHunk p, FromPrim p, Conflict p, CommuteNoConflicts p, Check p, RepairToFL p, PatchListFormat p, PrimPatchBase p, Patchy (PrimOf p), IsHunk (PrimOf p)) => RepoPatch p
- data Named p x y
- class (MyEq p, Apply p, Commute p, PatchInspect p, ShowPatch p, ReadPatch p, Invert p) => Patchy p
- joinPatches :: FromPrims p => FL p x y -> p x y
- fromPrim :: FromPrim p => PrimOf p x y -> p x y
- fromPrims :: FromPrims p => FL (PrimOf p) x y -> p x y
- rmfile :: PrimConstruct prim => FilePath -> prim x y
- addfile :: PrimConstruct prim => FilePath -> prim x y
- rmdir :: PrimConstruct prim => FilePath -> prim x y
- adddir :: PrimConstruct prim => FilePath -> prim x y
- move :: PrimConstruct prim => FilePath -> FilePath -> prim x y
- hunk :: PrimConstruct prim => FilePath -> Int -> [ByteString] -> [ByteString] -> prim x y
- tokreplace :: PrimConstruct prim => FilePath -> String -> String -> String -> prim x y
- namepatch :: Patchy p => String -> String -> String -> [String] -> FL p x y -> IO (Named p x y)
- anonymous :: Patchy p => FL p x y -> IO (Named p x y)
- binary :: PrimConstruct prim => FilePath -> ByteString -> ByteString -> prim x y
- description :: ShowPatch p => p x y -> Doc
- showContextPatch :: (ShowPatch p, Monad m, ApplyMonadTrans m (ApplyState p), ApplyMonad m (ApplyState p)) => p x y -> m Doc
- showPatch :: ShowPatchBasic p => p x y -> Doc
- showNicely :: ShowPatch p => p x y -> Doc
- infopatch :: Patchy p => PatchInfo -> FL p x y -> Named p x y
- changepref :: PrimConstruct prim => String -> String -> String -> prim x y
- thing :: ShowPatch p => p x y -> String
- things :: ShowPatch p => p x y -> String
- primIsAddfile :: PrimClassify prim => prim x y -> Bool
- primIsHunk :: PrimClassify prim => prim x y -> Bool
- primIsSetpref :: PrimClassify prim => prim x y -> Bool
- merge :: Merge p => (p :\/: p) x y -> (p :/\: p) x y
- commute :: Commute p => (p :> p) x y -> Maybe ((p :> p) x y)
- listTouchedFiles :: PatchInspect p => p x y -> [FilePath]
- hunkMatches :: PatchInspect p => (ByteString -> Bool) -> p x y -> Bool
- forceTokReplace :: String -> String -> String -> ByteString -> Maybe ByteString
- class (Patchy prim, PatchListFormat prim, IsHunk prim, RepairToFL prim, PrimConstruct prim, PrimCanonize prim, PrimClassify prim, PrimDetails prim, PrimShow prim, PrimRead prim, PrimApply prim) => PrimPatch prim
- resolveConflicts :: Conflict p => p x y -> [[Sealed (FL (PrimOf p) y)]]
- class Effect p where
  - effect :: p x y -> FL (PrimOf p) x y
- primIsBinary :: PrimClassify prim => prim x y -> Bool
- gzWritePatch :: ShowPatchBasic p => FilePath -> p x y -> IO ()
- writePatch :: ShowPatchBasic p => FilePath -> p x y -> IO ()
- primIsAdddir :: PrimClassify prim => prim x y -> Bool
- invert :: Invert p => p x y -> p y x
- invertFL :: Invert p => FL p x y -> RL p y x
- invertRL :: Invert p => RL p x y -> FL p y x
- commuteFLorComplain :: Commute p => (p :> FL p) x y -> Either (Sealed2 p) ((FL p :> p) x y)
- commuteRL :: Commute p => (RL p :> p) x y -> Maybe ((p :> RL p) x y)
- readPatch :: ReadPatch p => ByteString -> Maybe (Sealed (p x))
- readPatchPartial :: ReadPatch p => ByteString -> Maybe (Sealed (p x), ByteString)
- canonize :: PrimCanonize prim => prim x y -> FL prim x y
- sortCoalesceFL :: PrimCanonize prim => FL prim x y -> FL prim x y
- tryToShrink :: PrimCanonize prim => FL prim x y -> FL prim x y
- patchname :: Named p x y -> String
- patchcontents :: Named p x y -> FL p x y
- applyToFilePaths :: (Apply p, ApplyState p ~ Tree) => p x y -> Maybe [(FilePath, FilePath)] -> [FilePath] -> ([FilePath], [FilePath], [(FilePath, FilePath)])
- apply :: (Apply p, ApplyMonad m (ApplyState p)) => p x y -> m ()
- applyToTree :: (Apply p, Functor m, Monad m, ApplyState p ~ Tree) => p x y -> Tree m -> m (Tree m)
- effectOnFilePaths :: (Apply p, ApplyState p ~ Tree) => p x y -> [FilePath] -> [FilePath]
- patch2patchinfo :: Named p x y -> PatchInfo
- summary :: ShowPatch p => p x y -> Doc
- summaryFL :: ShowPatch p => FL p x y -> Doc
- plainSummary :: (Conflict e, Effect e, PrimPatchBase e) => e x y -> Doc
- xmlSummary :: (Effect p, Conflict p, PrimPatchBase p) => p x y -> Doc
- plainSummaryPrims :: PrimDetails prim => FL prim x y -> Doc
- adddeps :: Named p x y -> [PatchInfo] -> Named p x y
- getdeps :: Named p x y -> [PatchInfo]
- listConflictedFiles :: Conflict p => p x y -> [FilePath]
- isInconsistent :: Check p => p x y -> Maybe Doc

# Documentation

class (Patchy p, Merge p, Effect p, IsHunk p, FromPrim p, Conflict p, CommuteNoConflicts p, Check p, RepairToFL p, PatchListFormat p, PrimPatchBase p, Patchy (PrimOf p), IsHunk (PrimOf p)) => RepoPatch p

Instances

PrimPatch prim => RepoPatch (Patch prim) |
PrimPatch prim => RepoPatch (RealPatch prim) |

data Named p x y

The `Named` type adds a patch info about a patch, that is a name.

`NamedP info deps p` represents patch `p` with name `info`. `deps` is a list of dependencies added at the named patch level, compared with the unnamed level (ie, dependencies added with `darcs record --ask-deps`).

Instances

(PatchListFormat p, ShowPatch p) => Show2 (Named p) |
PatchListFormat (Named p) |
(Commute p, MyEq p) => MyEq (Named p) |
Commute p => Commute (Named p) |
(Commute p, Invert p) => Invert (Named p) |
Merge p => Merge (Named p) |
PatchInspect p => PatchInspect (Named p) |
(ReadPatch p, PatchListFormat p) => ReadPatch (Named p) |
Apply p => Apply (Named p) |
RepairToFL p => Repair (Named p) |
Check p => Check (Named p) |
(Apply p, CommuteNoConflicts p, Conflict p, IsHunk p, PatchListFormat p, PrimPatchBase p, ShowPatch p) => ShowPatch (Named p) |
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (Named p) |
(CommuteNoConflicts p, Conflict p, IsHunk p, PatchListFormat p, PrimPatchBase p, Patchy p, ~ ((* -> *) -> *) (ApplyState p) Tree) => Patchy (Named p) |
IsHunk (Named p) |
PrimPatchBase p => PrimPatchBase (Named p) |
Effect p => Effect (Named p) |
(CommuteNoConflicts p, Conflict p) => Conflict (Named p) |
(PatchListFormat p, ShowPatch p) => Show1 (Named p x) |
(PatchListFormat p, ShowPatch p) => Show (Named p x y) |

class (MyEq p, Apply p, Commute p, PatchInspect p, ShowPatch p, ReadPatch p, Invert p) => Patchy p

Instances

Patchy Prim |
Patchy Prim |
Patchy DummyPatch |
(IsHunk p, PatchListFormat p, Patchy p) => Patchy (RL p) |
(IsHunk p, PatchListFormat p, Patchy p) => Patchy (FL p) |
PrimPatch prim => Patchy (Patch prim) |
(CommuteNoConflicts p, Conflict p, IsHunk p, PatchListFormat p, PrimPatchBase p, Patchy p, ~ ((* -> *) -> *) (ApplyState p) Tree) => Patchy (Named p) |
(RepoPatch p, ~ ((* -> *) -> *) (ApplyState p) Tree) => Patchy (PatchInfoAnd p) |
PrimPatch prim => Patchy (RealPatch prim) |

joinPatches :: FromPrims p => FL p x y -> p x y

fromPrim :: FromPrim p => PrimOf p x y -> p x y

fromPrims :: FromPrims p => FL (PrimOf p) x y -> p x y

rmfile :: PrimConstruct prim => FilePath -> prim x y

addfile :: PrimConstruct prim => FilePath -> prim x y

rmdir :: PrimConstruct prim => FilePath -> prim x y

adddir :: PrimConstruct prim => FilePath -> prim x y

move :: PrimConstruct prim => FilePath -> FilePath -> prim x y

hunk :: PrimConstruct prim => FilePath -> Int -> [ByteString] -> [ByteString] -> prim x y

tokreplace :: PrimConstruct prim => FilePath -> String -> String -> String -> prim x y

namepatch :: Patchy p => String -> String -> String -> [String] -> FL p x y -> IO (Named p x y)

anonymous :: Patchy p => FL p x y -> IO (Named p x y)

binary :: PrimConstruct prim => FilePath -> ByteString -> ByteString -> prim x y

description :: ShowPatch p => p x y -> Doc

showContextPatch :: (ShowPatch p, Monad m, ApplyMonadTrans m (ApplyState p), ApplyMonad m (ApplyState p)) => p x y -> m Doc

showContextPatch is used to add context to a patch, 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 tree.

showPatch :: ShowPatchBasic p => p x y -> Doc

showNicely :: ShowPatch p => p x y -> Doc

infopatch :: Patchy p => PatchInfo -> FL p x y -> Named p x y

changepref :: PrimConstruct prim => String -> String -> String -> prim x y

thing :: ShowPatch p => p x y -> String

things :: ShowPatch p => p x y -> String

primIsAddfile :: PrimClassify prim => prim x y -> Bool

primIsHunk :: PrimClassify prim => prim x y -> Bool

primIsSetpref :: PrimClassify prim => prim x y -> Bool

merge :: Merge p => (p :\/: p) x y -> (p :/\: p) x y

commute :: Commute p => (p :> p) x y -> Maybe ((p :> p) x y)

listTouchedFiles :: PatchInspect p => p x y -> [FilePath]

hunkMatches :: PatchInspect p => (ByteString -> Bool) -> p x y -> Bool

forceTokReplace :: String -> String -> String -> ByteString -> Maybe ByteString

class (Patchy prim, PatchListFormat prim, IsHunk prim, RepairToFL prim, PrimConstruct prim, PrimCanonize prim, PrimClassify prim, PrimDetails prim, PrimShow prim, PrimRead prim, PrimApply prim) => PrimPatch prim

Instances

PrimPatch Prim |
PrimPatch Prim |

# for PatchTest

resolveConflicts :: Conflict p => p x y -> [[Sealed (FL (PrimOf p) y)]]

class Effect p where

Patches whose concrete effect which can be expressed as a list of primitive patches.

A minimal definition would be either of `effect` or `effectRL`.

Methods

effect :: p x y -> FL (PrimOf p) x y

Instances

Effect p => Effect (RL p) |
Effect p => Effect (FL p) |
PrimPatch prim => Effect (Patch prim) |
Effect p => Effect (Named p) |
Effect p => Effect (PatchInfoAnd p) |
PrimPatch prim => Effect (RealPatch prim) |

primIsBinary :: PrimClassify prim => prim x y -> Bool

gzWritePatch :: ShowPatchBasic p => FilePath -> p x y -> IO ()

writePatch :: ShowPatchBasic p => FilePath -> p x y -> IO ()

primIsAdddir :: PrimClassify prim => prim x y -> Bool

invert :: Invert p => p x y -> p y x

invertFL :: Invert p => FL p x y -> RL p y x

invertRL :: Invert p => RL p x y -> FL p y x

commuteFLorComplain :: Commute p => (p :> FL p) x y -> Either (Sealed2 p) ((FL p :> p) x y)

commuteRL :: Commute p => (RL p :> p) x y -> Maybe ((p :> RL p) x y)

readPatch :: ReadPatch p => ByteString -> Maybe (Sealed (p x))

readPatchPartial :: ReadPatch p => ByteString -> Maybe (Sealed (p x), ByteString)

canonize :: PrimCanonize prim => prim x y -> FL prim x y

It can sometimes be handy to have a canonical representation of a given patch. We achieve this by defining a canonical form for each patch type, and a function `canonize` which takes a patch and puts it into canonical form. This routine is used by the diff function to create an optimal patch (based on an LCS algorithm) from a simple hunk describing the old and new version of a file.

sortCoalesceFL :: PrimCanonize prim => FL prim x y -> FL prim x y

`sortCoalesceFL` `ps` coalesces as many patches in `ps` as possible, sorting the results in some standard order.

tryToShrink :: PrimCanonize prim => FL prim x y -> FL prim x y

patchname :: Named p x y -> String

patchcontents :: Named p x y -> FL p x y

applyToFilePaths :: (Apply p, ApplyState p ~ Tree) => p x y -> Maybe [(FilePath, FilePath)] -> [FilePath] -> ([FilePath], [FilePath], [(FilePath, FilePath)])

apply :: (Apply p, ApplyMonad m (ApplyState p)) => p x y -> m ()

applyToTree :: (Apply p, Functor m, Monad m, ApplyState p ~ Tree) => p x y -> Tree m -> m (Tree m)

Apply a patch to a `Tree`, yielding a new `Tree`.

effectOnFilePaths :: (Apply p, ApplyState p ~ Tree) => p x y -> [FilePath] -> [FilePath]

patch2patchinfo :: Named p x y -> PatchInfo

summary :: ShowPatch p => p x y -> Doc

summaryFL :: ShowPatch p => FL p x y -> Doc

plainSummary :: (Conflict e, Effect e, PrimPatchBase e) => e x y -> Doc

xmlSummary :: (Effect p, Conflict p, PrimPatchBase p) => p x y -> Doc

plainSummaryPrims :: PrimDetails prim => FL prim x y -> Doc

adddeps :: Named p x y -> [PatchInfo] -> Named p x y

getdeps :: Named p x y -> [PatchInfo]

listConflictedFiles :: Conflict p => p x y -> [FilePath]

isInconsistent :: Check p => p x y -> Maybe Doc