darcs-2.18.2: a distributed, interactive, smart revision control system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.Patch.Prim

Synopsis

Documentation

class PrimApply prim where Source #

Methods

applyPrimFL :: ApplyMonad (ApplyState prim) m => FL prim wX wY -> m () Source #

Instances

Instances details
PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Apply

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Apply

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

applyPrimFL :: ApplyMonad (ApplyState Prim) m => FL Prim wX wY -> m () Source #

PrimApply p => PrimApply (PrimWithName name p) Source # 
Instance details

Defined in Darcs.Patch.Prim.WithName

Methods

applyPrimFL :: ApplyMonad (ApplyState (PrimWithName name p)) m => FL (PrimWithName name p) wX wY -> m () Source #

class (Commute prim, Eq2 prim, Invert prim) => PrimCoalesce prim where Source #

Methods

tryToShrink :: FL prim wX wY -> Maybe (FL prim wX wY) Source #

Try to shrink the input sequence by getting rid of self-cancellations and identity patches or by coalescing patches. Also sort patches according to some internally defined order (specific to the patch type) as far as possible while respecting dependencies. A result of Nothing means that we could not shrink the input.

This method is included in the class for optimization. Instances are free to use defaultTryToShrink.

sortCoalesceFL :: FL prim wX wY -> FL prim wX wY Source #

This is similar to tryToShrink but always gives back a result: if the sequence could not be shrunk we merely give back a sorted version.

This method is included in the class for optimization. Instances are free to use defaultSortCoalesceFL.

primCoalesce :: prim wX wY -> prim wY wZ -> Maybe (prim wX wZ) Source #

Coalesce adjacent patches to one with the same effect.

apply (primCoalesce p q) == apply p >> apply q

isIdentity :: prim wX wY -> EqCheck wX wY Source #

Whether prim patch has no effect at all and thus can be eliminated as far as coalescing is concerned.

comparePrim :: prim wA wB -> prim wC wD -> Ordering Source #

Provide a total order between arbitrary patches that is consistent with Eq2:

unsafeCompare p q == IsEq  <=>  comparePrim p q == EQ

Instances

Instances details
PrimCoalesce Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Coalesce

Methods

tryToShrink :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

primCoalesce :: Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ) Source #

isIdentity :: Prim wX wY -> EqCheck wX wY Source #

comparePrim :: Prim wA wB -> Prim wC wD -> Ordering Source #

PrimCoalesce Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Coalesce

Methods

tryToShrink :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

primCoalesce :: Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ) Source #

isIdentity :: Prim wX wY -> EqCheck wX wY Source #

comparePrim :: Prim wA wB -> Prim wC wD -> Ordering Source #

PrimCoalesce Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

tryToShrink :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

primCoalesce :: Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ) Source #

isIdentity :: Prim wX wY -> EqCheck wX wY Source #

comparePrim :: Prim wA wB -> Prim wC wD -> Ordering Source #

PrimCoalesce Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

tryToShrink :: FL Prim wX wY -> Maybe (FL Prim wX wY) Source #

sortCoalesceFL :: FL Prim wX wY -> FL Prim wX wY Source #

primCoalesce :: Prim wX wY -> Prim wY wZ -> Maybe (Prim wX wZ) Source #

isIdentity :: Prim wX wY -> EqCheck wX wY Source #

comparePrim :: Prim wA wB -> Prim wC wD -> Ordering Source #

class PrimConstruct prim where Source #

Methods

addfile :: AnchoredPath -> prim wX wY Source #

rmfile :: AnchoredPath -> prim wX wY Source #

adddir :: AnchoredPath -> prim wX wY Source #

rmdir :: AnchoredPath -> prim wX wY Source #

move :: AnchoredPath -> AnchoredPath -> prim wX wY Source #

changepref :: String -> String -> String -> prim wX wY Source #

hunk :: AnchoredPath -> Int -> [ByteString] -> [ByteString] -> prim wX wY Source #

tokreplace :: AnchoredPath -> String -> String -> String -> prim wX wY Source #

binary :: AnchoredPath -> ByteString -> ByteString -> prim wX wY Source #

primFromHunk :: FileHunk (ObjectIdOfPatch prim) wX wY -> prim wX wY Source #

Instances

Instances details
PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Core

ObjectIdOf (ApplyState Prim) ~ AnchoredPath => PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Core

PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

PrimConstruct Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

class PrimDetails prim where Source #

Methods

summarizePrim :: prim wX wY -> [SummDetail] Source #

Instances

Instances details
PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Details

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Details

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

summarizePrim :: Prim wX wY -> [SummDetail] Source #

PrimDetails p => PrimDetails (PrimWithName name p) Source # 
Instance details

Defined in Darcs.Patch.Prim.WithName

Methods

summarizePrim :: PrimWithName name p wX wY -> [SummDetail] Source #

class PrimMangleUnravelled prim where Source #

Methods

mangleUnravelled :: Unravelled prim wX -> Maybe (Mangled prim wX) Source #

Mangle conflicting alternatives if possible.

type PrimPatch prim = (Annotate prim, Apply prim, CleanMerge prim, Commute prim, Invert prim, Eq2 prim, IsHunk prim, PatchInspect prim, RepairToFL prim, Show2 prim, PrimConstruct prim, PrimCoalesce prim, PrimDetails prim, PrimApply prim, PrimSift prim, PrimMangleUnravelled prim, ReadPatch prim, ShowPatch prim, ShowContextPatch prim, PatchListFormat prim) Source #

class PrimRead prim where Source #

Methods

readPrim :: FileNameFormat -> Parser (Sealed (prim wX)) Source #

Instances

Instances details
PrimRead Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Read

PrimRead Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Read

class PrimSift prim where Source #

Prim patches that support "sifting". This is the process of eliminating changes from a sequence of prims that can be recovered by comparing states (normally the pristine and working states), except those that other changes depend on. In other words, changes to the content of (tracked) files. The implementation is allowed and expected to shrink and coalesce changes in the process.

Methods

primIsSiftable :: prim wX wY -> Bool Source #

Whether a prim is a candidate for sifting

Instances

Instances details
PrimSift Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Coalesce

Methods

primIsSiftable :: Prim wX wY -> Bool Source #

PrimSift Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Core

Methods

primIsSiftable :: Prim wX wY -> Bool Source #

PrimSift Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

Methods

primIsSiftable :: Prim wX wY -> Bool Source #

PrimSift Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

Methods

primIsSiftable :: Prim wX wY -> Bool Source #

type Mangled prim wX = Sealed (FL prim wX) Source #

Result of mangling a single Unravelled.

type Unravelled prim wX = [Sealed (FL prim wX)] Source #

A list of conflicting alternatives. They form a connected component of the conflict graph i.e. one transitive conflict.

canonizeFL :: (IsHunk prim, PrimCoalesce prim, PrimConstruct prim) => DiffAlgorithm -> FL prim wX wY -> FL prim wX wY Source #

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

XXX Why not? How does it differ? The implementation for Prim.V1 does sortCoalesceFL and then invokes the diff algorithm for each hunk. How can that be any different to applying the sequence and then taking the diff? Is this merely because diff does not sort by file path?

Besides, diff and apply must be inverses in the sense that for any two states {start, end}, we have

diff start (apply (diff start end)) == end

coalesce :: PrimCoalesce prim => (prim :> prim) wX wY -> Maybe (Maybe2 prim wX wY) Source #

Either primCoalesce or cancel inverses.

primCoalesce (p :> q) == Just r => apply r = apply p >> apply q