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

Safe HaskellNone
LanguageHaskell2010

Darcs.Patch

Contents

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

IsRebaseType rebaseType => IsRepoType (RepoType rebaseType) 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

PatchListFormat (Named p) Source # 
(Commute p, Eq2 p) => Eq2 (Named p) Source # 

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 #

Show2 p => Show2 (Named p) Source # 

Methods

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

Invert p => Invert (Named p) Source # 

Methods

invert :: Named p wX wY -> Named p wY wX Source #

PatchInspect p => PatchInspect (Named p) Source # 

Methods

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

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

PatchDebug p => PatchDebug (Named p) Source # 

Methods

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

Commute p => Commute (Named p) Source # 

Methods

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

Merge p => Merge (Named p) Source # 

Methods

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

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

Methods

readPatch' :: ParserM m => m (Sealed (Named p wX)) Source #

Apply p => Apply (Named p) Source # 

Associated Types

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

Methods

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

(CommuteNoConflicts p, Conflict p, PatchListFormat p, PrimPatchBase p, ShowPatch p) => ShowPatch (Named p) Source # 

Methods

showNicely :: 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 # 
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (Named p) Source # 

Methods

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

IsHunk (Named p) Source # 

Methods

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

RepairToFL p => Repair (Named p) Source # 

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 # 

Methods

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

PrimPatchBase p => PrimPatchBase (Named p) Source # 

Associated Types

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

Effect p => Effect (Named p) Source # 

Methods

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

effectRL :: Named p wX wY -> RL (PrimOf (Named p)) wX wY Source #

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

Methods

resolveConflicts :: Named p wX wY -> [[Sealed (FL (PrimOf (Named p)) wY)]] Source #

conflictedEffect :: Named p wX wY -> [IsConflictedPrim (PrimOf (Named p))] Source #

Annotate p => Annotate (Named p) Source # 

Methods

annotate :: Named p wX wY -> AnnotatedM () Source #

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

Methods

showDict1 :: ShowDict (Named p wX wX) Source #

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

Methods

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

show :: Named p wX wY -> String #

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

type ApplyState (Named p) Source # 
type PrimOf (Named p) Source # 
type PrimOf (Named p) = PrimOf p

data WrappedNamed (rt :: RepoType) p wX wY Source #

A layer inbetween the 'Named p' type and 'PatchInfoAnd p' design for holding "internal" patches such as the rebase container. Ideally these patches would be stored at the repository level but this would require some significant refactoring/cleaning up of that code.

Instances

PatchListFormat (WrappedNamed rt p) Source # 
Show2 p => Show2 (WrappedNamed rt p) Source # 

Methods

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

Invert p => Invert (WrappedNamed rt p) Source # 

Methods

invert :: WrappedNamed rt p wX wY -> WrappedNamed rt p wY wX Source #

PatchInspect p => PatchInspect (WrappedNamed rt p) Source # 

Methods

listTouchedFiles :: WrappedNamed rt p wX wY -> [FilePath] Source #

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

Commute p => Commute (WrappedNamed rt p) Source # 

Methods

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

Merge p => Merge (WrappedNamed rt p) Source # 

Methods

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

(ReadPatch p, PrimPatchBase p, FromPrim p, Effect p, PatchListFormat p, IsRepoType rt) => ReadPatch (WrappedNamed rt p) Source # 

Methods

readPatch' :: ParserM m => m (Sealed (WrappedNamed rt p wX)) Source #

Apply p => Apply (WrappedNamed rt p) Source # 

Associated Types

type ApplyState (WrappedNamed rt p :: * -> * -> *) :: (* -> *) -> * Source #

Methods

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

(ShowPatch p, PatchListFormat p, Apply p, PrimPatchBase p, IsHunk p, Conflict p, CommuteNoConflicts p) => ShowPatch (WrappedNamed rt p) Source # 

Methods

showNicely :: WrappedNamed rt p wX wY -> Doc Source #

description :: WrappedNamed rt p wX wY -> Doc Source #

summary :: WrappedNamed rt p wX wY -> Doc Source #

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

thing :: WrappedNamed rt p wX wY -> String Source #

things :: WrappedNamed rt p wX wY -> String Source #

(ShowContextPatch p, PatchListFormat p, Apply p, PrimPatchBase p, IsHunk p) => ShowContextPatch (WrappedNamed rt p) Source # 
(ShowPatchBasic p, PatchListFormat p) => ShowPatchBasic (WrappedNamed rt p) Source # 

Methods

showPatch :: ShowPatchFor -> WrappedNamed rt p wX wY -> Doc Source #

IsHunk (WrappedNamed rt p) Source # 

Methods

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

RepairToFL p => Repair (WrappedNamed rt p) Source # 

Methods

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

Check p => Check (WrappedNamed rt p) Source # 

Methods

isInconsistent :: WrappedNamed rt p wX wY -> Maybe Doc Source #

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

Associated Types

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

Effect p => Effect (WrappedNamed rt p) Source # 

Methods

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

effectRL :: WrappedNamed rt p wX wY -> RL (PrimOf (WrappedNamed rt p)) wX wY Source #

(CommuteNoConflicts p, Conflict p) => Conflict (WrappedNamed rt p) Source # 
Annotate p => Annotate (WrappedNamed rt p) Source # 

Methods

annotate :: WrappedNamed rt p wX wY -> AnnotatedM () Source #

Show2 p => Show1 (WrappedNamed rt p wX) Source # 

Methods

showDict1 :: ShowDict (WrappedNamed rt p wX wX) Source #

Show2 p => Show (WrappedNamed rt p wX wY) Source # 

Methods

showsPrec :: Int -> WrappedNamed rt p wX wY -> ShowS #

show :: WrappedNamed rt p wX wY -> String #

showList :: [WrappedNamed rt p wX wY] -> ShowS #

type ApplyState (WrappedNamed rt p) Source # 
type PrimOf (WrappedNamed rt p) Source # 
type PrimOf (WrappedNamed rt p) = PrimOf p

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

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

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

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

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

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

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

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

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

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

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

binary :: PrimConstruct prim => FilePath -> ByteString -> ByteString -> prim 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.

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

infopatch :: PatchInfo -> FL 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.

for PatchTest

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

class Effect p where Source #

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

Instances

Effect DummyPatch Source # 

Methods

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

effectRL :: DummyPatch wX wY -> RL (PrimOf DummyPatch) wX wY Source #

Effect p => Effect (RL p) Source # 

Methods

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

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

Effect p => Effect (FL p) Source # 

Methods

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

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

Effect p => Effect (Named p) Source # 

Methods

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

effectRL :: Named p wX wY -> RL (PrimOf (Named p)) wX wY Source #

Effect (RebaseName p) Source # 

Methods

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

effectRL :: RebaseName p wX wY -> RL (PrimOf (RebaseName p)) wX wY Source #

Effect (RebaseFixup p) Source # 

Methods

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

effectRL :: RebaseFixup p wX wY -> RL (PrimOf (RebaseFixup p)) wX wY Source #

Effect (Suspended p) Source # 

Methods

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

effectRL :: Suspended p wX wY -> RL (PrimOf (Suspended p)) wX wY Source #

Effect p => Effect (WithDroppedDeps p) Source # 

Methods

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

effectRL :: WithDroppedDeps p wX wY -> RL (PrimOf (WithDroppedDeps p)) wX wY Source #

(PrimPatchBase p, Invert p, Effect p) => Effect (RebaseChange p) Source # 

Methods

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

effectRL :: RebaseChange p wX wY -> RL (PrimOf (RebaseChange p)) wX wY Source #

(PrimPatchBase p, Invert p, Effect p) => Effect (RebaseSelect p) Source # 

Methods

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

effectRL :: RebaseSelect p wX wY -> RL (PrimOf (RebaseSelect p)) wX wY Source #

PrimPatch prim => Effect (RepoPatchV2 prim) Source # 

Methods

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

effectRL :: RepoPatchV2 prim wX wY -> RL (PrimOf (RepoPatchV2 prim)) wX wY Source #

Effect p => Effect (WrappedNamed rt p) Source # 

Methods

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

effectRL :: WrappedNamed rt p wX wY -> RL (PrimOf (WrappedNamed rt p)) wX wY Source #

Effect p => Effect (PatchInfoAnd rt p) Source # 

Methods

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

effectRL :: PatchInfoAnd rt p wX wY -> RL (PrimOf (PatchInfoAnd rt p)) 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 #

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

commuteFL commutes a single element past a FL.

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

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) 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 replace patch to a Tree. If the apply fails (if the file the patch applies to already contains the target token), we return Nothing, otherwise we return the updated Tree.

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

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

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

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

xmlSummary :: (Conflict p, PrimPatchBase 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 :: Named p wX wY -> [PatchInfo] Source #

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