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

Safe Haskell | None
Language | Haskell2010

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 `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

- matchParser :: Matchable p => CharParser st (MatchFun rt p)
- helpOnMatchers :: [String]
- addInternalMatcher :: (IsRepoType rt, Matchable p) => Maybe (Matcher rt p) -> Maybe (Matcher rt p)
- matchFirstPatchset :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart
- matchSecondPatchset :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart
- splitSecondFL :: Matchable p => (forall wA wB. q wA wB -> Sealed2 (PatchInfoAnd rt p)) -> [MatchFlag] -> FL q wX wY -> (FL q :> FL q) wX wY
- matchPatch :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> Sealed2 (WrappedNamed rt p)
- matchAPatch :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchInfoAnd rt p wX wY -> Bool
- matchAPatchread :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchInfoAnd rt p wX wY -> Bool
- getNonrangeMatchS :: (ApplyMonad (ApplyState p) m, MonadProgress m, IsRepoType rt, Matchable p, ApplyState p ~ Tree) => [MatchFlag] -> PatchSet rt p Origin wX -> m ()
- firstMatch :: [MatchFlag] -> Bool
- secondMatch :: [MatchFlag] -> Bool
- haveNonrangeMatch :: forall rt p. (IsRepoType rt, Matchable p) => PatchType rt p -> [MatchFlag] -> Bool
- havePatchsetMatch :: forall rt p. (IsRepoType rt, Matchable p) => PatchType rt p -> [MatchFlag] -> Bool
- checkMatchSyntax :: [MatchFlag] -> IO ()
- applyInvToMatcher :: (Matchable p, ApplyMonad (ApplyState p) m) => InclusiveOrExclusive -> Matcher rt p -> PatchSet rt p Origin wX -> m ()
- nonrangeMatcher :: (IsRepoType rt, Matchable p) => [MatchFlag] -> Maybe (Matcher rt p)
- data InclusiveOrExclusive
  - = Inclusive
  - | Exclusive
- matchExists :: Matcher rt p -> PatchSet rt p wStart wX -> Bool
- applyNInv :: (Matchable p, ApplyMonad (ApplyState p) m) => Int -> PatchSet rt p Origin wX -> m ()
- hasIndexRange :: [MatchFlag] -> Maybe (Int, Int)
- getMatchingTag :: Matchable p => Matcher rt p -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart
- matchAPatchset :: Matchable p => Matcher rt p -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart
- getFirstMatchS :: (ApplyMonad (ApplyState p) m, MonadProgress m, Matchable p, IsRepoType rt) => [MatchFlag] -> PatchSet rt p Origin wX -> m ()
- nonrangeMatcherIsTag :: [MatchFlag] -> Bool
- data MatchFlag
  - = OnePattern String
  - | SeveralPattern String
  - | AfterPattern String
  - | UpToPattern String
  - | OnePatch String
  - | OneHash String
  - | AfterHash String
  - | UpToHash String
  - | SeveralPatch String
  - | AfterPatch String
  - | UpToPatch String
  - | OneTag String
  - | AfterTag String
  - | UpToTag String
  - | LastN Int
  - | PatchIndexRange Int Int
  - | Context AbsolutePath

# Documentation

matchParser :: Matchable p => CharParser st (MatchFun rt p) #

helpOnMatchers :: [String] #

The string that is emitted when the user runs `darcs help --match`.

addInternalMatcher :: (IsRepoType rt, Matchable p) => Maybe (Matcher rt p) -> Maybe (Matcher rt p) #

matchFirstPatchset :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart #

`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 :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart #

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

splitSecondFL #

Arguments

:: Matchable p |
=> (forall wA wB. q wA wB -> Sealed2 (PatchInfoAnd rt 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

matchPatch :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchSet rt p wStart wX -> Sealed2 (WrappedNamed rt p) #

matchAPatch :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchInfoAnd rt p wX wY -> Bool #

`matchAPatch fs p` tells whether `p` matches the matchers in the flags `fs`

matchAPatchread :: (IsRepoType rt, Matchable p) => [MatchFlag] -> PatchInfoAnd rt p wX wY -> Bool #

`matchAPatchread fs p` tells whether `p` matches the matchers in the flags listed in `fs`.

getNonrangeMatchS :: (ApplyMonad (ApplyState p) m, MonadProgress m, IsRepoType rt, Matchable p, ApplyState p ~ Tree) => [MatchFlag] -> PatchSet rt p Origin wX -> m () #

firstMatch :: [MatchFlag] -> Bool #

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

`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 :: forall rt p. (IsRepoType rt, Matchable p) => PatchType rt p -> [MatchFlag] -> Bool #

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

havePatchsetMatch :: forall rt p. (IsRepoType rt, Matchable p) => PatchType rt p -> [MatchFlag] -> Bool #

`havePatchsetMatch flags` tells whether there is a "patchset match" in the flag list. A patchset match is `--match` or `--patch`, or `--context`, but not `--from-patch` nor (!) `--index`. Question: Is it supposed not to be a subset of `haveNonrangeMatch`?

checkMatchSyntax :: [MatchFlag] -> IO () #

applyInvToMatcher :: (Matchable p, ApplyMonad (ApplyState p) m) => InclusiveOrExclusive -> Matcher rt p -> PatchSet rt p Origin wX -> m () #

nonrangeMatcher :: (IsRepoType rt, Matchable p) => [MatchFlag] -> Maybe (Matcher rt p) #

`nonrangeMatcher` is the criterion that is used to match against patches in the interval. It is 'Just m' when the `--patch`, `--match`, `--tag` options are passed (or their plural variants).

data InclusiveOrExclusive #

Constructors

Inclusive |
Exclusive |

Instances

Eq InclusiveOrExclusive # |
Methods (==) :: InclusiveOrExclusive -> InclusiveOrExclusive -> Bool # (/=) :: InclusiveOrExclusive -> InclusiveOrExclusive -> Bool #

matchExists :: Matcher rt p -> PatchSet rt p wStart wX -> Bool #

`matchExists m ps` tells whether there is a patch matching `m` in `ps`

applyNInv :: (Matchable p, ApplyMonad (ApplyState p) m) => Int -> PatchSet rt p Origin wX -> m () #

`applyNInv` n ps applies the inverse of the last `n` patches of `ps`.

hasIndexRange :: [MatchFlag] -> Maybe (Int, Int) #

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

`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 :: Matchable p => Matcher rt p -> PatchSet rt p wStart wX -> SealedPatchSet rt p wStart #

`matchAPatchset m ps` returns a (the largest?) subset of `ps` ending in patch which matches `m`. Calls `error` if there is none.

getFirstMatchS :: (ApplyMonad (ApplyState p) m, MonadProgress m, Matchable p, IsRepoType rt) => [MatchFlag] -> PatchSet rt p Origin wX -> m () #

nonrangeMatcherIsTag :: [MatchFlag] -> Bool #

`nonrangeMatcherIsTag` returns true if the matching option was '--tag'

data MatchFlag #

Constructors

OnePattern String |
SeveralPattern String |
AfterPattern String |
UpToPattern String |
OnePatch String |
OneHash String |
AfterHash String |
UpToHash String |
SeveralPatch String |
AfterPatch String |
UpToPatch String |
OneTag String |
AfterTag String |
UpToTag String |
LastN Int |
PatchIndexRange Int Int |
Context AbsolutePath |

Instances

Show MatchFlag # |
Methods showsPrec :: Int -> MatchFlag -> ShowS # show :: MatchFlag -> String # showList :: [MatchFlag] -> ShowS #