Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 Matcher
s:
- 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
- helpOnMatchers :: [String]
- matchFirstPatchset :: MatchableRP p => [MatchFlag] -> PatchSet p wStart wX -> Maybe (SealedPatchSet p wStart)
- matchSecondPatchset :: MatchableRP p => [MatchFlag] -> PatchSet p wStart wX -> Maybe (SealedPatchSet p wStart)
- splitSecondFL :: Matchable p => (forall wA wB. q wA wB -> Sealed2 p) -> [MatchFlag] -> FL q wX wY -> (FL q :> FL q) wX wY
- matchAPatch :: Matchable p => [MatchFlag] -> p wX wY -> Bool
- rollbackToPatchSetMatch :: (ApplyMonad (ApplyState p) m, MatchableRP p, ApplyState p ~ Tree) => PatchSetMatch -> PatchSet p Origin wX -> m ()
- firstMatch :: [MatchFlag] -> Bool
- secondMatch :: [MatchFlag] -> Bool
- haveNonrangeMatch :: [MatchFlag] -> Bool
- data PatchSetMatch
- = IndexMatch Int
- | PatchMatch Matcher
- | TagMatch Matcher
- | ContextMatch AbsolutePath
- patchSetMatch :: [MatchFlag] -> Maybe PatchSetMatch
- checkMatchSyntax :: [MatchFlag] -> IO ()
- hasIndexRange :: [MatchFlag] -> Maybe (Int, Int)
- getMatchingTag :: MatchableRP p => Matcher -> PatchSet p wStart wX -> SealedPatchSet p wStart
- matchAPatchset :: MatchableRP p => Matcher -> PatchSet p wStart wX -> SealedPatchSet p wStart
- data MatchFlag
- = OnePattern String
- | SeveralPattern String
- | AfterPattern String
- | UpToPattern String
- | OnePatch String
- | SeveralPatch String
- | AfterPatch String
- | UpToPatch String
- | OneHash String
- | AfterHash String
- | UpToHash String
- | OneTag String
- | SeveralTag String
- | AfterTag String
- | UpToTag String
- | LastN Int
- | OneIndex Int
- | IndexRange Int Int
- | Context AbsolutePath
- matchingHead :: forall p wR. MatchableRP p => [MatchFlag] -> PatchSet p Origin wR -> (PatchSet p :> FL (PatchInfoAnd p)) Origin wR
- type Matchable p = (Apply p, PatchInspect p, Ident p, PatchId p ~ PatchInfo)
- type MatchableRP p = (Apply p, Commute p, PatchInspect p)
Documentation
helpOnMatchers :: [String] Source #
The string that is emitted when the user runs darcs help patterns
.
matchFirstPatchset :: MatchableRP p => [MatchFlag] -> PatchSet p wStart wX -> Maybe (SealedPatchSet 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 want.
matchSecondPatchset :: MatchableRP p => [MatchFlag] -> PatchSet p wStart wX -> Maybe (SealedPatchSet p wStart) Source #
matchSecondPatchset fs ps
returns the part of ps
before its
second matcher, ie the one that comes last dependencywise.
:: 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 MatchFlag
s. This should be
invariant under inversion:
matchAPatch (invert p) = matchAPatch p
rollbackToPatchSetMatch :: (ApplyMonad (ApplyState p) m, MatchableRP p, ApplyState p ~ Tree) => PatchSetMatch -> PatchSet 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 :: [MatchFlag] -> Bool Source #
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
.
data PatchSetMatch Source #
IndexMatch Int | |
PatchMatch Matcher | |
TagMatch Matcher | |
ContextMatch AbsolutePath |
patchSetMatch :: [MatchFlag] -> Maybe PatchSetMatch Source #
checkMatchSyntax :: [MatchFlag] -> IO () Source #
getMatchingTag :: MatchableRP p => Matcher -> PatchSet p wStart wX -> SealedPatchSet 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 p wStart wX -> SealedPatchSet p wStart Source #
matchAPatchset m ps
returns a prefix of ps
ending in a patch matching m
, and calls error
if there is none.
matchingHead :: forall p wR. MatchableRP p => [MatchFlag] -> PatchSet p Origin wR -> (PatchSet p :> FL (PatchInfoAnd 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
is PatchInfoAnd
pMatchable
.