ContentsIndex
Darcs.Match
Synopsis
data InclusiveOrExclusive
= Inclusive
| Exclusive
have_nonrange_match :: [DarcsFlag] -> Bool
have_patchset_match :: [DarcsFlag] -> Bool
get_nonrange_match :: RepoPatch p => Repository p -> [DarcsFlag] -> IO ()
get_partial_nonrange_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
get_nonrange_match_s :: (MatchMonad m p, RepoPatch p) => [DarcsFlag] -> PatchSet p -> m ()
first_match :: [DarcsFlag] -> Bool
get_first_match :: RepoPatch p => Repository p -> [DarcsFlag] -> IO ()
get_partial_first_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
get_first_match_s :: (MatchMonad m p, RepoPatch p) => [DarcsFlag] -> PatchSet p -> m ()
second_match :: [DarcsFlag] -> Bool
get_partial_second_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
checkMatchSyntax :: [DarcsFlag] -> IO ()
get_match_pattern :: [DarcsFlag] -> Maybe PatchMatch
tagmatch :: String -> Matcher p
mymatch :: String -> Matcher p
strictJust :: a -> Maybe a
nonrange_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
nonrange_matcher_is_tag :: [DarcsFlag] -> Bool
first_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
first_matcher_is_tag :: [DarcsFlag] -> Bool
second_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
second_matcher_is_tag :: [DarcsFlag] -> Bool
match_a_patchread :: Patchy p => [DarcsFlag] -> PatchInfoAnd p -> Bool
match_a_patch :: Patchy p => [DarcsFlag] -> Named p -> Bool
match_patch :: RepoPatch p => [DarcsFlag] -> PatchSet p -> Sealed2 (Named p)
get_one_patchset :: RepoPatch p => Repository p -> [DarcsFlag] -> IO (SealedPatchSet p)
has_lastn :: [DarcsFlag] -> Maybe Int
has_index_range :: [DarcsFlag] -> Maybe (Int, Int)
match_first_patchset :: RepoPatch p => [DarcsFlag] -> PatchSet p -> SealedPatchSet p
dropn :: Int -> PatchSet p -> SealedPatchSet p
match_second_patchset :: RepoPatch p => [DarcsFlag] -> PatchSet p -> SealedPatchSet p
find_a_patch :: RepoPatch p => Matcher p -> PatchSet p -> Sealed2 (Named p)
match_a_patchset :: RepoPatch p => Matcher p -> PatchSet p -> SealedPatchSet p
get_matching_tag :: RepoPatch p => Matcher p -> PatchSet p -> SealedPatchSet p
match_exists :: Matcher p -> PatchSet p -> Bool
apply_inv_to_matcher :: (RepoPatch p, WriteableDirectory m) => InclusiveOrExclusive -> Matcher p -> PatchSet p -> m ()
maybe_read_file :: ReadableDirectory m => FileName -> m [(FileName, ByteString)]
get_matcher_s :: (MatchMonad m p, RepoPatch p) => InclusiveOrExclusive -> Matcher p -> PatchSet p -> m ()
get_tag_s :: (MatchMonad m p, RepoPatch p) => Matcher p -> PatchSet p -> m ()
apply_invp :: (Patchy p, WriteableDirectory m) => PatchInfoAnd p -> m ()
safetake :: Int -> RL a -> FlippedSeal (RL a)
class (RepoPatch p, WriteableDirectory m) => MatchMonad m p where
withRecordedMatch :: Repository p -> (PatchSet p -> m ()) -> IO ()
withRecordedMatchOnlySomeFiles :: Repository p -> [FileName] -> (PatchSet p -> m ()) -> IO ()
applyInvRL :: RL (PatchInfoAnd p) -> m ()
withRecordedMatchIO :: RepoPatch p => Repository p -> (PatchSet p -> IO ()) -> IO ()
withRecordedMatchSmart :: RepoPatch p => [DarcsFlag] -> Repository p -> (forall m. MatchMonad m p => PatchSet p -> m ()) -> IO ()
withRecordedMatchOnlySomeSmart :: RepoPatch p => [DarcsFlag] -> Repository p -> [FileName] -> (forall m. MatchMonad m p => PatchSet p -> m ()) -> IO ()
Documentation
data InclusiveOrExclusive
Constructors
Inclusive
Exclusive
show/hide Instances
have_nonrange_match :: [DarcsFlag] -> Bool
have_nonrange_match flags tells whether there is a flag in flags which corresponds to a match that is non-range. Thus, --match, --patch and --index make have_nonrange_match true, but not --from-patch or --to-patch.
have_patchset_match :: [DarcsFlag] -> Bool
have_patchset_match 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 have_nonrange_match?
get_nonrange_match :: RepoPatch p => Repository p -> [DarcsFlag] -> IO ()
get_partial_nonrange_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
get_nonrange_match_s :: (MatchMonad m p, RepoPatch p) => [DarcsFlag] -> PatchSet p -> m ()
first_match :: [DarcsFlag] -> Bool
first_match 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.
get_first_match :: RepoPatch p => Repository p -> [DarcsFlag] -> IO ()
get_partial_first_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
get_first_match_s :: (MatchMonad m p, RepoPatch p) => [DarcsFlag] -> PatchSet p -> m ()
second_match :: [DarcsFlag] -> Bool
second_match 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.
get_partial_second_match :: RepoPatch p => Repository p -> [DarcsFlag] -> [FileName] -> IO ()
checkMatchSyntax :: [DarcsFlag] -> IO ()
get_match_pattern :: [DarcsFlag] -> Maybe PatchMatch
tagmatch :: String -> Matcher p
mymatch :: String -> Matcher p
strictJust :: a -> Maybe a

strictJust is a strict version of the Just constructor, used to ensure that if we claim we've got a pattern match, that the pattern will actually match (rathern than fail to compile properly).

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 (which means the PatchSet is written right to left), then we have (up to) three Matchers: the nonrange_matcher is the criterion we use to select among patches in the interval, the first_matcher is the left bound of the interval, and the last_matcher is the right bound. Each of these matchers can be present or not according to the options.

nonrange_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
nonrange_matcher 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).
nonrange_matcher_is_tag :: [DarcsFlag] -> Bool
nonrange_matcher_is_tag returns true if the matching option was '--tag'
first_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
first_matcher returns the left bound of the matched interval. This left bound is also specified when we use the singular versions of --patch, --match and --tag. Otherwise, first_matcher returns Nothing.
first_matcher_is_tag :: [DarcsFlag] -> Bool
second_matcher :: Patchy p => [DarcsFlag] -> Maybe (Matcher p)
second_matcher_is_tag :: [DarcsFlag] -> Bool
match_a_patchread :: Patchy p => [DarcsFlag] -> PatchInfoAnd p -> Bool
match_a_patchread fs p tells whether p matches the matchers in the flags listed in fs.
match_a_patch :: Patchy p => [DarcsFlag] -> Named p -> Bool
match_a_patch fs p tells whether p matches the matchers in the flags fs
match_patch :: RepoPatch p => [DarcsFlag] -> PatchSet p -> Sealed2 (Named p)
get_one_patchset :: RepoPatch p => Repository p -> [DarcsFlag] -> IO (SealedPatchSet p)
has_lastn :: [DarcsFlag] -> Maybe Int
has_lastn fs return the --last argument in fs, if any.
has_index_range :: [DarcsFlag] -> Maybe (Int, Int)
match_first_patchset :: RepoPatch p => [DarcsFlag] -> PatchSet p -> SealedPatchSet p

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

Question: are they really? Florent

dropn :: Int -> PatchSet p -> SealedPatchSet p
dropn n ps drops the n last patches from ps.
match_second_patchset :: RepoPatch p => [DarcsFlag] -> PatchSet p -> SealedPatchSet p
match_second_patchset fs ps returns the part of ps before its second matcher, ie the one that comes last dependencywise.
find_a_patch :: RepoPatch p => Matcher p -> PatchSet p -> Sealed2 (Named p)
find_a_patch m ps returns the last patch in ps matching m, and calls error if there is none.
match_a_patchset :: RepoPatch p => Matcher p -> PatchSet p -> SealedPatchSet p
match_a_patchset m ps returns a (the largest?) subset of ps ending in patch which matches m. Calls error if there is none.
get_matching_tag :: RepoPatch p => Matcher p -> PatchSet p -> SealedPatchSet p
get_matching_tag 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 changes -t m. Calls error if there is no matching tag.
match_exists :: Matcher p -> PatchSet p -> Bool
match_exists m ps tells whether there is a patch matching m in ps
apply_inv_to_matcher :: (RepoPatch p, WriteableDirectory m) => InclusiveOrExclusive -> Matcher p -> PatchSet p -> m ()
maybe_read_file :: ReadableDirectory m => FileName -> m [(FileName, ByteString)]
maybe_read_file recursively gets the contents of all files in a directory, or just the contents of a file if called on a simple file.
get_matcher_s :: (MatchMonad m p, RepoPatch p) => InclusiveOrExclusive -> Matcher p -> PatchSet p -> m ()
get_tag_s :: (MatchMonad m p, RepoPatch p) => Matcher p -> PatchSet p -> m ()
apply_invp :: (Patchy p, WriteableDirectory m) => PatchInfoAnd p -> m ()
apply_invp tries to get the patch that's in a 'PatchInfoAnd patch', and to apply its inverse. If we fail to fetch the patch (presumably in a partial repositiory), then we share our sorrow with the user.
safetake :: Int -> RL a -> FlippedSeal (RL a)
a version of take for RL lists that cater for contexts.
class (RepoPatch p, WriteableDirectory m) => MatchMonad m p where
A MatchMonad p m is a monad in which we match patches from p by playing with them in m, a WriteableDirectory monad. How we play with the patches depends on the instance of MatchMonad we're using. If we use IO, then we'll apply the patches directly in m, if we use SlurpMonad, then we'll apply the patches to a slurpy, and write to disk at the end. Note that both IO and SlurpMonad have an instance of WriteableDirectory that implicitely writes in the current directory.
Methods
withRecordedMatch :: Repository p -> (PatchSet p -> m ()) -> IO ()
withRecordedMatch is responsible for getting the recorded state into the monad, and then applying the second argument, and finally placing the resulting state into the current directory.
withRecordedMatchOnlySomeFiles :: Repository p -> [FileName] -> (PatchSet p -> m ()) -> IO ()
withRecordedMatchOnlySomeFiles is a variant of withRecordedMatch that may only return some of the files (e.g. if we want to run diff on just a few files).
applyInvRL :: RL (PatchInfoAnd p) -> m ()
show/hide Instances
withRecordedMatchIO :: RepoPatch p => Repository p -> (PatchSet p -> IO ()) -> IO ()
withRecordedMatchSmart :: RepoPatch p => [DarcsFlag] -> Repository p -> (forall m. MatchMonad m p => PatchSet p -> m ()) -> IO ()

withRecordedMatchSmart hides away the choice of the SlurpMonad to use in order to apply withRecordedMatch. If we have the --store-in-memory flag, then use SlurpMonad, else use IO. In both case, the result is in the IO monad.

Suggestion: shouldn't we name withRecordedMatchSmart withRecordedMatch, and give the monad function another name such as withRecordedMatchRaw?

withRecordedMatchOnlySomeSmart :: RepoPatch p => [DarcsFlag] -> Repository p -> [FileName] -> (forall m. MatchMonad m p => PatchSet p -> m ()) -> IO ()
withRecordedMatchOnlySomeSmart is the smart version of withRecordedMatchOnlySome. It runs withRecordedMatchOnlySome either in the SlurpMonad or in IO according to the --store-in-memory flag.
Produced by Haddock version 2.4.2