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

Safe HaskellNone
LanguageHaskell2010

Darcs.Patch

Contents

Synopsis

Documentation

data Named p wX wY

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).

class (Apply p, Commute p, Invert p) => Patchy p

Instances

fromPrim :: FromPrim p => PrimOf p wX wY -> p wX wY

fromPrims :: FromPrims p => FL (PrimOf p) wX wY -> p wX wY

rmfile :: PrimConstruct prim => FilePath -> prim wX wY

addfile :: PrimConstruct prim => FilePath -> prim wX wY

rmdir :: PrimConstruct prim => FilePath -> prim wX wY

adddir :: PrimConstruct prim => FilePath -> prim wX wY

move :: PrimConstruct prim => FilePath -> FilePath -> prim wX wY

hunk :: PrimConstruct prim => FilePath -> Int -> [ByteString] -> [ByteString] -> prim wX wY

tokreplace :: PrimConstruct prim => FilePath -> String -> String -> String -> prim wX wY

namepatch :: String -> String -> String -> [String] -> FL p wX wY -> IO (Named p wX wY)

anonymous :: FL p wX wY -> IO (Named p wX wY)

binary :: PrimConstruct prim => FilePath -> ByteString -> ByteString -> prim wX wY

description :: ShowPatch p => p wX wY -> Doc

showContextPatch :: (ShowPatch p, Monad m, ApplyMonadTrans m (ApplyState p), ApplyMonad m (ApplyState p)) => p wX wY -> 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 wX wY -> Doc

showNicely :: ShowPatch p => p wX wY -> Doc

infopatch :: PatchInfo -> FL p wX wY -> Named p wX wY

changepref :: PrimConstruct prim => String -> String -> String -> prim wX wY

thing :: ShowPatch p => p wX wY -> String

things :: ShowPatch p => p wX wY -> String

primIsAddfile :: PrimClassify prim => prim wX wY -> Bool

primIsHunk :: PrimClassify prim => prim wX wY -> Bool

primIsSetpref :: PrimClassify prim => prim wX wY -> Bool

merge :: Merge p => (p :\/: p) wX wY -> (p :/\: p) wX wY

commute :: Commute p => (p :> p) wX wY -> Maybe ((p :> p) wX wY)

hunkMatches :: PatchInspect p => (ByteString -> Bool) -> p wX wY -> Bool

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

forceTokReplace replaces all occurrences of the old token with the new token, throughout the input ByteString.

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

for PatchTest

resolveConflicts :: Conflict p => p wX wY -> [[Sealed (FL (PrimOf p) wY)]]

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.

Minimal complete definition

effect | effectRL

Methods

effect :: p wX wY -> FL (PrimOf p) wX wY

primIsBinary :: PrimClassify prim => prim wX wY -> Bool

primIsAdddir :: PrimClassify prim => prim wX wY -> Bool

invert :: Invert p => p wX wY -> p wY wX

invertFL :: Invert p => FL p wX wY -> RL p wY wX

invertRL :: Invert p => RL p wX wY -> FL p wY wX

commuteFL :: Commute p => (p :> FL p) wX wY -> Maybe ((FL p :> p) wX wY)

commuteFL commutes a single element past a FL.

commuteFLorComplain :: Commute p => (p :> FL p) wX wY -> Either (Sealed2 p) ((FL p :> p) wX wY)

commuteFLorComplain attempts to commute a single element past a FL. If any individual commute fails, then we return the patch that first patch that cannot be commuted past.

commuteRL :: Commute p => (RL p :> p) wX wY -> Maybe ((p :> RL p) wX wY)

commuteRL commutes a RL past a single element.

canonize :: PrimCanonize prim => DiffAlgorithm -> prim wX wY -> FL prim wX wY

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 wX wY -> FL prim wX wY

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

tryToShrink :: PrimCanonize prim => FL prim wX wY -> FL prim wX wY

tryToShrink ps simplifies ps by getting rid of self-cancellations or coalescing patches

Question (Eric Kow): what properties should this have? For example, the prim1 implementation only gets rid of the first self-cancellation it finds (as far as I can tell). Is that OK? Can we try harder?

patchname :: Named p wX wY -> String

patchcontents :: Named p wX wY -> FL p wX wY

apply :: (Apply p, ApplyMonad m (ApplyState p)) => p wX wY -> m ()

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

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

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

summary :: ShowPatch p => p wX wY -> Doc

summaryFL :: ShowPatch p => FL p wX wY -> Doc

plainSummary :: (Conflict e, Effect e, PrimPatchBase e) => e wX wY -> Doc

xmlSummary :: (Effect p, Conflict p, PrimPatchBase p) => p wX wY -> Doc

plainSummaryPrims :: PrimDetails prim => FL prim wX wY -> Doc

adddeps :: Named p wX wY -> [PatchInfo] -> Named p wX wY

getdeps :: Named p wX wY -> [PatchInfo]

isInconsistent :: Check p => p wX wY -> Maybe Doc