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

Darcs.Patch.Match

Description

First matcher, Second matcher and Nonrange matcher

When we match for patches, we have a PatchSet, of which we want a subset. This subset is formed by the patches in a given interval which match a given criterion. If we represent time going left to right, then we have (up to) three Matchers:

• the firstMatcher is the left bound of the interval,
• the secondMatcher is the right bound, and
• the nonrangeMatcher is the criterion we use to select among patches in the interval.
Synopsis

# Documentation

The string that is emitted when the user runs darcs help patterns.

matchFirstPatchset :: MatchableRP p => [MatchFlag] -> PatchSet rt p wStart wX -> Maybe (SealedPatchSet rt p wStart) Source #

matchFirstPatchset fs ps returns the part of ps before its first matcher, ie the one that comes first dependencywise. Hence, patches in matchFirstPatchset fs ps are the context for the ones we don't want.

matchSecondPatchset :: MatchableRP p => [MatchFlag] -> PatchSet rt p wStart wX -> Maybe (SealedPatchSet rt p wStart) Source #

matchSecondPatchset fs ps returns the part of ps before its second matcher, ie the one that comes last dependencywise.

Arguments

 :: Matchable p => (forall wA wB. q wA wB -> Sealed2 p) -> [MatchFlag] -> FL q wX wY -> (FL q :> FL q) wX wY The first element is the patches before and including the first patch matching the second matcher, the second element is the patches after it

Split on the second matcher. Note that this picks up the first match starting from the earliest patch in a sequence, as opposed to matchSecondPatchset which picks up the first match starting from the latest patch

matchAPatch :: Matchable p => [MatchFlag] -> p wX wY -> Bool Source #

Whether a patch matches the given MatchFlags. This should be invariant under inversion:

matchAPatch (invert p) = matchAPatch p

rollbackToPatchSetMatch :: (ApplyMonad (ApplyState p) m, IsRepoType rt, MatchableRP p, ApplyState p ~ Tree) => PatchSetMatch -> PatchSet rt p Origin wX -> m () Source #

Rollback (i.e. apply the inverse) of what remains of a PatchSet after we extract a PatchSetMatch. This is the counterpart of getOnePatchset and is used to create a matching state. In particular, if the match is --index=n then rollback the last (n-1) patches; if the match is --tag, then rollback patches that are not depended on by the tag; otherwise rollback patches that follow the latest matching patch.

firstMatch :: [MatchFlag] -> Bool Source #

firstMatch fs tells whether fs implies a "first match", that is if we match against patches from a point in the past on, rather than against all patches since the creation of the repository.

secondMatch :: [MatchFlag] -> Bool Source #

secondMatch fs tells whether fs implies a "second match", that is if we match against patches up to a point in the past on, rather than against all patches until now.

haveNonrangeMatch flags tells whether there is a flag in flags which corresponds to a match that is "non-range". Thus, --match, --patch, and --hash make haveNonrangeMatch true, but not --from-patch or --to-patch.

Constructors

 IndexMatch Int PatchMatch Matcher TagMatch Matcher ContextMatch AbsolutePath

getMatchingTag :: MatchableRP p => Matcher -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart Source #

getMatchingTag m ps, where m is a Matcher which matches tags returns a SealedPatchSet containing all patches in the last tag which matches m. Last tag means the most recent tag in repository order, i.e. the last one you'd see if you ran darcs log -t m. Calls error if there is no matching tag.

matchAPatchset :: MatchableRP p => Matcher -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart Source #

matchAPatchset m ps returns a prefix of ps ending in a patch matching m, and calls error if there is none.

data MatchFlag Source #

Instances
 Source # Instance detailsDefined in Darcs.Patch.Match MethodsshowList :: [MatchFlag] -> ShowS #

matchingHead :: forall rt p wR. MatchableRP p => [MatchFlag] -> PatchSet rt p Origin wR -> (PatchSet rt p :> FL (PatchInfoAnd rt p)) Origin wR Source #

matchingHead returns the repository up to some tag. The tag t is the last tag such that there is a patch after t that is matched by the user's query.

type Matchable p = (Apply p, PatchInspect p, Ident p, PatchId p ~ PatchInfo) Source #

Patches that can be matched.

type MatchableRP p = (Apply p, Commute p, PatchInspect p) Source #

Constraint for a patch type p that ensures PatchInfoAnd rt p is Matchable.