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

Safe HaskellNone
LanguageHaskell98

Darcs.Patch.Prim.Class

Documentation

class PrimConstruct prim where Source

Methods

addfile :: FilePath -> prim x y Source

rmfile :: FilePath -> prim x y Source

adddir :: FilePath -> prim x y Source

rmdir :: FilePath -> prim x y Source

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

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

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

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

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

primFromHunk :: FileHunk x y -> prim x y Source

anIdentity :: prim x x Source

class PrimCanonize prim where Source

Methods

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

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

sortCoalesceFL :: FL prim x y -> FL prim x y Source

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 Source

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 Source

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

class PrimClassify prim where Source

Methods

primIsAddfile :: prim x y -> Bool Source

primIsRmfile :: prim x y -> Bool Source

primIsAdddir :: prim x y -> Bool Source

primIsRmdir :: prim x y -> Bool Source

primIsMove :: prim x y -> Bool Source

primIsHunk :: prim x y -> Bool Source

primIsTokReplace :: prim x y -> Bool Source

primIsBinary :: prim x y -> Bool Source

primIsSetpref :: prim x y -> Bool Source

is_filepatch :: prim x y -> Maybe FileName Source

class PrimDetails prim where Source

Methods

summarizePrim :: prim x y -> [SummDetail] Source

class PrimShow prim where Source

Methods

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

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

class PrimRead prim where Source

Methods

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

class PrimApply prim where Source

Methods

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

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 Source

class FromPrim p where Source

Methods

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

Instances

class FromPrims p where Source

Methods

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

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

Instances

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

class FromPrim p => ToFromPrim p where Source

Methods

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

Instances