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

Safe HaskellNone

Darcs.Patch.Prim.Class

Documentation

class PrimConstruct prim where

Methods

addfile :: FilePath -> prim x y

rmfile :: FilePath -> prim x y

adddir :: FilePath -> prim x y

rmdir :: FilePath -> prim x y

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

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

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

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

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

primFromHunk :: FileHunk x y -> prim x y

anIdentity :: prim x x

class PrimCanonize prim where

Methods

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

tryShrinkingInverse :: FL prim x y -> Maybe (FL prim x y)

sortCoalesceFL :: 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.

canonize :: 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.

canonizeFL :: FL prim x y -> FL prim x y

canonizeFL ps puts a sequence of primitive patches into canonical form. Even if the patches are just hunk patches, this is not necessarily the same set of results as you would get if you applied the sequence to a specific tree and recalculated a diff.

Note that this process does not preserve the commutation behaviour of the patches and is therefore not appropriate for use when working with already recorded patches (unless doing amend-record or the like).

join :: (prim :> prim) x y -> Maybe (FL prim x y)

class PrimClassify prim where

Methods

primIsAddfile :: prim x y -> Bool

primIsRmfile :: prim x y -> Bool

primIsAdddir :: prim x y -> Bool

primIsRmdir :: prim x y -> Bool

primIsMove :: prim x y -> Bool

primIsHunk :: prim x y -> Bool

primIsTokReplace :: prim x y -> Bool

primIsBinary :: prim x y -> Bool

primIsSetpref :: prim x y -> Bool

is_filepatch :: prim x y -> Maybe FileName

class PrimDetails prim where

Methods

summarizePrim :: prim x y -> [SummDetail]

class PrimShow prim where

Methods

showPrim :: FileNameFormat -> prim a b -> Doc

showPrimFL :: PrimShow prim => FileNameFormat -> FL prim a b -> Doc

class PrimRead prim where

Methods

readPrim :: ParserM m => FileNameFormat -> m (Sealed (prim x))

class PrimApply prim where

Methods

applyPrimFL :: ApplyMonad m (ApplyState prim) => FL prim x y -> m ()

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

class FromPrim p where

Methods

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

Instances

class FromPrims p where

Methods

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

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

Instances

FromPrim p => FromPrims (RL p) 
FromPrim p => FromPrims (FL p) 

class FromPrim p => ToFromPrim p where

Methods

toPrim :: p x y -> Maybe (PrimOf p x y)

Instances