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

Safe Haskell | None

Darcs.Patch.Depends

Synopsis

- getTagsRight :: PatchSet p start x -> [PatchInfo]
- areUnrelatedRepos :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> Bool
- mergeThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> Sealed (FL (PatchInfoAnd p) x)
- findCommonWithThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (PatchSet p :> FL (PatchInfoAnd p)) start x
- countUsThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (Int, Int)
- removeFromPatchSet :: RepoPatch p => FL (PatchInfoAnd p) x y -> PatchSet p start y -> Maybe (PatchSet p start x)
- optimizePatchset :: PatchSet p start x -> PatchSet p start x
- deepOptimizePatchset :: PatchSet p start x -> PatchSet p start x
- slightlyOptimizePatchset :: PatchSet p start x -> PatchSet p start x
- getPatchesBeyondTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> FlippedSeal (RL (PatchInfoAnd p)) x
- getPatchesInTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> SealedPatchSet p start
- splitOnTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> (PatchSet p :> RL (PatchInfoAnd p)) start x
- newsetUnion :: RepoPatch p => [SealedPatchSet p start] -> SealedPatchSet p start
- newsetIntersection :: RepoPatch p => [SealedPatchSet p start] -> SealedPatchSet p start
- commuteToEnd :: forall p start x y. RepoPatch p => RL (PatchInfoAnd p) x y -> PatchSet p start y -> (PatchSet p :> RL (PatchInfoAnd p)) start x
- findUncommon :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (FL (PatchInfoAnd p) :\/: FL (PatchInfoAnd p)) x y
- merge2FL :: RepoPatch p => FL (PatchInfoAnd p) x y -> FL (PatchInfoAnd p) x z -> Sealed (FL (PatchInfoAnd p) y)

# Documentation

getTagsRight :: PatchSet p start x -> [PatchInfo]

`getTagsRight ps` returns the `PatchInfo` for all the patches in `ps` that are not depended on by anything else *through explicit dependencies*. Tags are a likely candidate, although we may also find some non-tag patches in this list.

Keep in mind that in a typical repository with a lot of tags, only a small fraction of tags would be returned as they would be at least indirectly depended on by the topmost ones.

areUnrelatedRepos :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> Bool

mergeThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> Sealed (FL (PatchInfoAnd p) x)

findCommonWithThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (PatchSet p :> FL (PatchInfoAnd p)) start x

countUsThem :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (Int, Int)

removeFromPatchSet :: RepoPatch p => FL (PatchInfoAnd p) x y -> PatchSet p start y -> Maybe (PatchSet p start x)

optimizePatchset :: PatchSet p start x -> PatchSet p start x

`optimizePatchset` is similar to `slightlyOptimizePatchset` in that it only works on the surface inventory (see below), but it works a bit harder and can optimize several tags.

- surface inventory: the sequence of patches that corresponds to the `_darcshashed\_inventory@ or @\_darcsinventory` files
- deep inventory: the sequence of sequences of patches that corresponds to the `_darcs/inventories` directory

deepOptimizePatchset :: PatchSet p start x -> PatchSet p start x

`deepOptimizePatchset` runs through all patches whether they are in the surface inventory or the deep one.

slightlyOptimizePatchset :: PatchSet p start x -> PatchSet p start x

`slightlyOptimizePatchset` only works on the surface inventory (see `optimizePatchset`) and only optimises at most one tag in there, going for the most recent tag which has no non-depended patch after it. Older tags won't be `clean`, which means the PatchSet will not be in 'unclean :< clean' state.

getPatchesBeyondTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> FlippedSeal (RL (PatchInfoAnd p)) x

getPatchesInTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> SealedPatchSet p start

`getPatchesInTag t ps` returns a `SealedPatchSet` of all patches in `ps` which are contained in `t`.

splitOnTag :: RepoPatch p => PatchInfo -> PatchSet p start x -> (PatchSet p :> RL (PatchInfoAnd p)) start x

newsetUnion :: RepoPatch p => [SealedPatchSet p start] -> SealedPatchSet p start

newsetIntersection :: RepoPatch p => [SealedPatchSet p start] -> SealedPatchSet p start

commuteToEnd :: forall p start x y. RepoPatch p => RL (PatchInfoAnd p) x y -> PatchSet p start y -> (PatchSet p :> RL (PatchInfoAnd p)) start x

findUncommon :: RepoPatch p => PatchSet p start x -> PatchSet p start y -> (FL (PatchInfoAnd p) :\/: FL (PatchInfoAnd p)) x y

merge2FL :: RepoPatch p => FL (PatchInfoAnd p) x y -> FL (PatchInfoAnd p) x z -> Sealed (FL (PatchInfoAnd p) y)

Merge two FLs (say L and R), starting in a common context. The result is a FL starting in the original end context of L, going to a new context that is the result of applying all patches from R on top of patches from L.

While this function is similar to `mergeFL`, there are three important differences to keep in mind:

- `mergeFL` does not correctly deal with duplicate patches whereas this one does (Question from Eric Kow: in what sense? Why not fix the mergeFL instance?)
- `mergeFL` returns both paths of the merge diamond, but this version only returns one, so you'd better choose the order carefully, eg. (`merge2FL l r`)
- The conventional order we use in this function is reversed from `mergeFL` (so `mergeFL r l` vs. `merge2FL l r`. This does not matter so much for the former since you get both paths. (Question from Eric Kow: should we flip merge2FL for more uniformity in the code?)