darcs-2.4.4: a distributed, interactive, smart revision control systemSource codeContentsIndex
Darcs.Patch.Choices
Description

PatchChoices divides a sequence of patches into three sets: first, middle and last, such that all patches can be applied, if you first apply the first ones then the middle ones and then the last ones. Obviously if there are dependencies between the patches that will put a constraint on how you can choose to divide them up. The PatchChoices data type and associated functions are here to deal with many of the common cases that come up when choosing a subset of a group of patches.

forceLast tells PatchChoices that a particular patch is required to be in the last group, which also means that any patches that depend on it must be in the last group.

Internally, a PatchChoices doesn't actually reorder the patches until it is asked for the final output (e.g. by get_first_choice). Instead, each patch is placed in a state of definitely first, definitely last and undecided; undecided leans towards middle. In case you're wondering about the first-middle-last language, it's because in some cases the yes answers will be last (as is the case for the revert command), and in others first (as in record, pull and push).

Synopsis
data PatchChoices p
patchChoices :: Patchy p => FL p -> PatchChoices p
patchChoicesTps :: Patchy p => FL p -> (PatchChoices p, FL (TaggedPatch p))
patchChoicesTpsSub :: Patchy p => Maybe Tag -> FL p -> (PatchChoices p, FL (TaggedPatch p))
patchSlot :: forall p. TaggedPatch p -> PatchChoices p -> Slot
getChoices :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> (FL (TaggedPatch p) :> FL (TaggedPatch p))
separateFirstMiddleFromLast :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> FL (TaggedPatch p)
separateFirstFromMiddleLast :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> FL (TaggedPatch p)
forceFirst :: Patchy p => Tag -> PatchChoices p -> PatchChoices p
forceFirsts :: Patchy p => [Tag] -> PatchChoices p -> PatchChoices p
forceLast :: Patchy p => Tag -> PatchChoices p -> PatchChoices p
forceLasts :: Patchy p => [Tag] -> PatchChoices p -> PatchChoices p
forceMatchingFirst :: Patchy p => (TaggedPatch p -> Bool) -> PatchChoices p -> PatchChoices p
forceMatchingLast :: Patchy p => (TaggedPatch p -> Bool) -> PatchChoices p -> PatchChoices p
selectAllMiddles :: Patchy p => Bool -> PatchChoices p -> PatchChoices p
makeUncertain :: Patchy p => Tag -> PatchChoices p -> PatchChoices p
makeEverythingLater :: Patchy p => PatchChoices p -> PatchChoices p
data TaggedPatch p
data Tag
tag :: TaggedPatch p -> Tag
tpPatch :: TaggedPatch p -> p
data Slot
= InFirst
| InMiddle
| InLast
substitute :: forall p. Patchy p => Sealed2 (TaggedPatch p :||: FL (TaggedPatch p)) -> PatchChoices p -> PatchChoices p
Documentation
data PatchChoices p Source
patchChoices :: Patchy p => FL p -> PatchChoices pSource
patchChoicesTps :: Patchy p => FL p -> (PatchChoices p, FL (TaggedPatch p))Source
Tag a sequence of patches.
patchChoicesTpsSub :: Patchy p => Maybe Tag -> FL p -> (PatchChoices p, FL (TaggedPatch p))Source
Tag a sequence of patches as subpatches of an existing tag. This is intended for use when substituting a patch for an equivalent patch or patches.
patchSlot :: forall p. TaggedPatch p -> PatchChoices p -> SlotSource
getChoices :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> (FL (TaggedPatch p) :> FL (TaggedPatch p))Source
separateFirstMiddleFromLast :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> FL (TaggedPatch p)Source
separateFirstFromMiddleLast :: Patchy p => PatchChoices p -> FL (TaggedPatch p) :> FL (TaggedPatch p)Source
forceFirst :: Patchy p => Tag -> PatchChoices p -> PatchChoices pSource
forceFirsts :: Patchy p => [Tag] -> PatchChoices p -> PatchChoices pSource
forceLast :: Patchy p => Tag -> PatchChoices p -> PatchChoices pSource
forceLasts :: Patchy p => [Tag] -> PatchChoices p -> PatchChoices pSource
forceMatchingFirst :: Patchy p => (TaggedPatch p -> Bool) -> PatchChoices p -> PatchChoices pSource
forceMatchingLast :: Patchy p => (TaggedPatch p -> Bool) -> PatchChoices p -> PatchChoices pSource
selectAllMiddles :: Patchy p => Bool -> PatchChoices p -> PatchChoices pSource
makeUncertain :: Patchy p => Tag -> PatchChoices p -> PatchChoices pSource
makeEverythingLater :: Patchy p => PatchChoices p -> PatchChoices pSource
data TaggedPatch p Source
show/hide Instances
data Tag Source

TG mp i acts as a temporary identifier to help us keep track of patches during the selection process. These are useful for finding patches that may have moved around during patch selection (being pushed forwards or backwards as dependencies arise).

The identifier is implemented as a tuple TG mp i. The i is just some arbitrary label, expected to be unique within the patches being scrutinised. The mp is motivated by patch splitting; it provides a convenient way to generate a new identifier from the patch being split. For example, if we split a patch identified as TG Nothing 5, the resulting sub-patches could be identified as TG (TG Nothing 5) 1, TG (TG Nothing 5) 2, etc.

show/hide Instances
tag :: TaggedPatch p -> TagSource
tpPatch :: TaggedPatch p -> pSource
data Slot Source
See module documentation for Darcs.Patch.Choices
Constructors
InFirst
InMiddle
InLast
substitute :: forall p. Patchy p => Sealed2 (TaggedPatch p :||: FL (TaggedPatch p)) -> PatchChoices p -> PatchChoices pSource
substitute (a :||: bs) pcs replaces a with bs in pcs preserving the choice associated with a
Produced by Haddock version 2.4.2