darcs-2.16.4: a distributed, interactive, smart revision control system
Safe HaskellNone
LanguageHaskell2010

Darcs.Patch

Synopsis

Documentation

data RepoType Source #

This type is intended to be used as a phantom type via the DataKinds extension. It tracks different types of repositories, e.g. to indicate when a rebase is in progress.

class IsRepoType (rt :: RepoType) Source #

Minimal complete definition

singletonRepoType

Instances

Instances details
IsRebaseType rebaseType => IsRepoType ('RepoType rebaseType) Source # 
Instance details

Defined in Darcs.Patch.RepoType

Methods

singletonRepoType :: SRepoType ('RepoType rebaseType) Source #

class PrimPatch (PrimOf p) => PrimPatchBase p Source #

Associated Types

type PrimOf (p :: * -> * -> *) :: * -> * -> * Source #

Instances

Instances details
PrimPatchBase p => PrimPatchBase (RL p) Source # 
Instance details

Defined in Darcs.Patch.FromPrim

Associated Types

type PrimOf (RL p) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (FL p) Source # 
Instance details

Defined in Darcs.Patch.FromPrim

Associated Types

type PrimOf (FL p) :: Type -> Type -> Type Source #

PrimPatch prim => PrimPatchBase (RepoPatchV1 prim) Source # 
Instance details

Defined in Darcs.Patch.V1.Core

Associated Types

type PrimOf (RepoPatchV1 prim) :: Type -> Type -> Type Source #

PrimPatch prim => PrimPatchBase (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

Associated Types

type PrimOf (RepoPatchV2 prim) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Associated Types

type PrimOf (Named p) :: Type -> Type -> Type Source #

PrimPatch prim => PrimPatchBase (RebaseFixup prim) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Fixup

Associated Types

type PrimOf (RebaseFixup prim) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (WithDroppedDeps p) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Change

Associated Types

type PrimOf (WithDroppedDeps p) :: Type -> Type -> Type Source #

PrimPatch prim => PrimPatchBase (RebaseChange prim) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Change

Associated Types

type PrimOf (RebaseChange prim) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (Invertible p) Source # 
Instance details

Defined in Darcs.Patch.Invertible

Associated Types

type PrimOf (Invertible p) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (PatchInfoAndG rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Associated Types

type PrimOf (PatchInfoAndG rt p) :: Type -> Type -> Type Source #

PrimPatchBase p => PrimPatchBase (WrappedNamed rt p) Source # 
Instance details

Defined in Darcs.Patch.Named.Wrapped

Associated Types

type PrimOf (WrappedNamed rt p) :: Type -> Type -> Type Source #

PrimPatch prim => PrimPatchBase (RepoPatchV3 name prim) Source # 
Instance details

Defined in Darcs.Patch.V3.Core

Associated Types

type PrimOf (RepoPatchV3 name prim) :: Type -> Type -> Type Source #

data Named p wX wY Source #

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

Instances details
Eq2 (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

unsafeCompare :: Named p wA wB -> Named p wC wD -> Bool Source #

(=\/=) :: Named p wA wB -> Named p wA wC -> EqCheck wB wC Source #

(=/\=) :: Named p wA wC -> Named p wB wC -> EqCheck wA wB Source #

PatchListFormat (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Show2 p => Show2 (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

showDict2 :: ShowDict (Named p wX wY) Source #

PatchDebug p => PatchDebug (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

patchDebugDummy :: Named p wX wY -> () Source #

Commute p => Commute (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

commute :: (Named p :> Named p) wX wY -> Maybe ((Named p :> Named p) wX wY) Source #

Merge p => Merge (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

merge :: (Named p :\/: Named p) wX wY -> (Named p :/\: Named p) wX wY Source #

CleanMerge p => CleanMerge (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

cleanMerge :: (Named p :\/: Named p) wX wY -> Maybe ((Named p :/\: Named p) wX wY) Source #

PatchInspect p => PatchInspect (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

listTouchedFiles :: Named p wX wY -> [AnchoredPath] Source #

hunkMatches :: (ByteString -> Bool) -> Named p wX wY -> Bool Source #

Apply p => Apply (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Associated Types

type ApplyState (Named p) :: (Type -> Type) -> Type Source #

Methods

apply :: ApplyMonad (ApplyState (Named p)) m => Named p wX wY -> m () Source #

unapply :: ApplyMonad (ApplyState (Named p)) m => Named p wX wY -> m () Source #

(Summary p, PatchListFormat p, PrimPatchBase p, ShowPatch p) => ShowPatch (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

content :: Named p wX wY -> Doc Source #

description :: Named p wX wY -> Doc Source #

summary :: Named p wX wY -> Doc Source #

summaryFL :: FL (Named p) wX wY -> Doc Source #

thing :: Named p wX wY -> String Source #

things :: Named p wX wY -> String Source #

(Apply p, IsHunk p, PatchListFormat p, ShowContextPatch p) => ShowContextPatch (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

showPatch :: ShowPatchFor -> Named p wX wY -> Doc Source #

IdEq2 (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

(=\^/=) :: Named p wA wB -> Named p wA wC -> EqCheck wB wC Source #

(=/^\=) :: Named p wA wC -> Named p wB wC -> EqCheck wA wB Source #

Ident (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

ident :: Named p wX wY -> PatchId (Named p) Source #

IsHunk (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

isHunk :: Named p wX wY -> Maybe (FileHunk wX wY) Source #

(ReadPatch p, PatchListFormat p) => ReadPatch (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

readPatch' :: Parser (Sealed (Named p wX)) Source #

RepairToFL p => Repair (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

applyAndTryToFix :: ApplyMonad (ApplyState (Named p)) m => Named p wX wY -> m (Maybe (String, Named p wX wY)) Source #

Check p => Check (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

isInconsistent :: Named p wX wY -> Maybe Doc Source #

PrimPatchBase p => PrimPatchBase (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Associated Types

type PrimOf (Named p) :: Type -> Type -> Type Source #

(PrimPatchBase p, Unwind p) => Unwind (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

fullUnwind :: Named p wX wY -> Unwound (PrimOf (Named p)) wX wY Source #

Summary p => Summary (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Effect p => Effect (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

effect :: Named p wX wY -> FL (PrimOf (Named p)) wX wY Source #

(Commute p, Conflict p) => Conflict (Named p) Source #

This instance takes care of handling the interaction between conflict resolution and explicit dependencies. By definition, a conflict counts as resolved if another patch depends on it. This principle extends to explicit dependencies between Named patches, but not to (aggregate) implicit dependencies.

This means we count any patch inside a Named patch as resolved if some later Named patch depends on it explicitly. The patches contained inside a Named patch that is not explicitly depended on must be commuted one by one past those we know are resolved. It is important to realize that we must not do this commutation at the Named patch level but at the level below that.

Instance details

Defined in Darcs.Patch.Named

Methods

resolveConflicts :: RL (Named p) wO wX -> RL (Named p) wX wY -> [ConflictDetails (PrimOf (Named p)) wY] Source #

HasDeps (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

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

Show2 p => Show2 (PatchInfoAnd rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Methods

showDict2 :: ShowDict (PatchInfoAnd rt p wX wY) Source #

Show2 p => Show1 (Named p wX) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

showDict1 :: Dict (Show (Named p wX wX0)) Source #

RepairToFL p => Repair (PatchInfoAnd rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Methods

applyAndTryToFix :: ApplyMonad (ApplyState (PatchInfoAnd rt p)) m => PatchInfoAnd rt p wX wY -> m (Maybe (String, PatchInfoAnd rt p wX wY)) Source #

(Commute p, Conflict p) => Conflict (PatchInfoAnd rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Methods

resolveConflicts :: RL (PatchInfoAnd rt p) wO wX -> RL (PatchInfoAnd rt p) wX wY -> [ConflictDetails (PrimOf (PatchInfoAnd rt p)) wY] Source #

Show2 p => Show (Named p wX wY) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

showsPrec :: Int -> Named p wX wY -> ShowS #

show :: Named p wX wY -> String #

showList :: [Named p wX wY] -> ShowS #

Show2 p => Show1 (PatchInfoAnd rt p wX) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Methods

showDict1 :: Dict (Show (PatchInfoAnd rt p wX wX0)) Source #

type ApplyState (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

type PatchId (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

type PrimOf (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

type PrimOf (Named p) = PrimOf p

type family ApplyState p :: (* -> *) -> * Source #

Instances

Instances details
type ApplyState Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.V1.Apply

type ApplyState Prim Source # 
Instance details

Defined in Darcs.Patch.Prim.FileUUID.Apply

type ApplyState Prim Source # 
Instance details

Defined in Darcs.Patch.V2.Prim

type ApplyState Prim Source # 
Instance details

Defined in Darcs.Patch.V1.Prim

type ApplyState (RL p) Source # 
Instance details

Defined in Darcs.Patch.Apply

type ApplyState (RL p) = ApplyState p
type ApplyState (FL p) Source # 
Instance details

Defined in Darcs.Patch.Apply

type ApplyState (FL p) = ApplyState p
type ApplyState (RepoPatchV1 prim) Source # 
Instance details

Defined in Darcs.Patch.V1.Apply

type ApplyState (RepoPatchV1 prim) = ApplyState prim
type ApplyState (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

type ApplyState (RepoPatchV2 prim) = ApplyState prim
type ApplyState (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

type ApplyState (RebaseFixup prim) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Fixup

type ApplyState (RebaseFixup prim) = ApplyState prim
type ApplyState (RebaseChange prim) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Change

type ApplyState (Invertible p) Source # 
Instance details

Defined in Darcs.Patch.Invertible

type ApplyState (PatchInfoAndG rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

type ApplyState (WrappedNamed rt p) Source # 
Instance details

Defined in Darcs.Patch.Named.Wrapped

type ApplyState (PrimWithName name p) Source # 
Instance details

Defined in Darcs.Patch.Prim.WithName

type ApplyState (RepoPatchV3 name prim) Source # 
Instance details

Defined in Darcs.Patch.V3.Core

type ApplyState (RepoPatchV3 name prim) = ApplyState prim

rmfile :: PrimConstruct prim => AnchoredPath -> prim wX wY Source #

addfile :: PrimConstruct prim => AnchoredPath -> prim wX wY Source #

rmdir :: PrimConstruct prim => AnchoredPath -> prim wX wY Source #

adddir :: PrimConstruct prim => AnchoredPath -> prim wX wY Source #

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

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

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

anonymous :: FromPrim p => FL (PrimOf p) wX wY -> IO (Named p wX wY) Source #

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

showContextPatch :: (ShowContextPatch p, ApplyMonad (ApplyState p) m) => ShowPatchFor -> p wX wY -> m Doc Source #

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.

content :: ShowPatch p => p wX wY -> Doc Source #

infopatch :: forall p wX wY. FromPrim p => PatchInfo -> FL (PrimOf p) wX wY -> Named p wX wY Source #

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

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

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

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

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

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

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

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

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

forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString Source #

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

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

for PatchTest

resolveConflicts :: Conflict p => RL p wO wX -> RL p wX wY -> [ConflictDetails (PrimOf p) wY] Source #

The first parameter is a context containing all patches preceding the ones for which we want to calculate the conflict resolution, which is the second parameter. Each element of the result list represents the resolution of one maximal set of transitively conflicting alternatives, in other words, a connected subset of the conflict graph. But the elements themselves must not conflict with each other, guaranteeing that they can be cleanly merged into a single FL of prims.

class Effect p Source #

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

A minimal definition would be either of effect or effectRL.

Minimal complete definition

effect

Instances

Instances details
Effect p => Effect (RL p) Source # 
Instance details

Defined in Darcs.Patch.Effect

Methods

effect :: RL p wX wY -> FL (PrimOf (RL p)) wX wY Source #

Effect p => Effect (FL p) Source # 
Instance details

Defined in Darcs.Patch.Effect

Methods

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

PrimPatch prim => Effect (RepoPatchV1 prim) Source # 
Instance details

Defined in Darcs.Patch.V1.Commute

Methods

effect :: RepoPatchV1 prim wX wY -> FL (PrimOf (RepoPatchV1 prim)) wX wY Source #

PrimPatch prim => Effect (RepoPatchV2 prim) Source # 
Instance details

Defined in Darcs.Patch.V2.RepoPatch

Methods

effect :: RepoPatchV2 prim wX wY -> FL (PrimOf (RepoPatchV2 prim)) wX wY Source #

Effect p => Effect (Named p) Source # 
Instance details

Defined in Darcs.Patch.Named

Methods

effect :: Named p wX wY -> FL (PrimOf (Named p)) wX wY Source #

Effect p => Effect (WithDroppedDeps p) Source # 
Instance details

Defined in Darcs.Patch.Rebase.Change

Methods

effect :: WithDroppedDeps p wX wY -> FL (PrimOf (WithDroppedDeps p)) wX wY Source #

Effect p => Effect (PatchInfoAndG rt p) Source # 
Instance details

Defined in Darcs.Patch.PatchInfoAnd

Methods

effect :: PatchInfoAndG rt p wX wY -> FL (PrimOf (PatchInfoAndG rt p)) wX wY Source #

Effect (RepoPatchV3 name prim) Source # 
Instance details

Defined in Darcs.Patch.V3.Core

Methods

effect :: RepoPatchV3 name prim wX wY -> FL (PrimOf (RepoPatchV3 name prim)) wX wY Source #

effect :: Effect p => p wX wY -> FL (PrimOf p) wX wY Source #

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

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

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

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

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

dropInverses :: (Invert p, Eq2 p) => FL p wX wY -> Maybe (FL p wX wY) Source #

Delete the first subsequence of patches that is followed by an inverse subsequence, if one exists. If not return Nothing.

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

commuteFL commutes a single element past a FL.

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

commuteRL commutes a RL past a single element.

canonize :: PrimCanonize prim => DiffAlgorithm -> prim wX wY -> FL prim wX wY 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.

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

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

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

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

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

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

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

maybeApplyToTree :: (Apply p, ApplyState p ~ Tree) => p wX wY -> Tree IO -> IO (Maybe (Tree IO)) Source #

Attempts to apply a given patch to a Tree. If the apply fails, we return Nothing, otherwise we return the updated Tree.

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

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

plainSummary :: (Summary e, PrimDetails (PrimOf e)) => e wX wY -> Doc Source #

xmlSummary :: (Summary p, PrimDetails (PrimOf p)) => p wX wY -> Doc Source #

plainSummaryPrims :: PrimDetails prim => Bool -> FL prim wX wY -> Doc Source #

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

getdeps :: HasDeps p => p wX wY -> [PatchInfo] Source #

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