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

Safe Haskell | None
Language | Haskell2010

Darcs.Patch.Depends

Description

Definitions used in this module:

Explicit dependencies
  The set of patches that a (named) patch depends on "by name", i.e. irrespective of (non-)commutation (non commuting patches are implicit dependencies). The most important example are tags, but non-tag patches can also have explicit dependencies by recording them with --ask-deps.
Covered
  A patch `p` is covered by a tag `t` if `t` explicitly depends on `p` or a tag covered by `t` explicitly depends on `p`. In other words, the transitive closure of the relation "is depended on", restricted to situations where the right hand side is a tag. Note that it does not take explicit dependencies of non-tag patches into account at all.
Clean
  A tag `t` in a repository is clean if all patches prior to the tag are covered by `t`. Tags normally start out as clean tags (the exception is if --ask-deps is used). It typically becomes unclean when it is merged into another repo (here the exceptions are if --reorder-patches is used, or if the target repo is actually a subset of the source repo).

Synopsis

- getUncovered :: forall (p :: Type -> Type -> Type) wStart wX. PatchSet p wStart wX -> [PatchInfo]
- areUnrelatedRepos :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> Bool
- findCommon :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> Fork (PatchSet p) (FL (PatchInfoAnd p)) (FL (PatchInfoAnd p)) Origin wX wY
- findCommonWithThem :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (PatchSet p :> FL (PatchInfoAnd p)) Origin wX
- findUncommon :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (FL (PatchInfoAnd p) :\/: FL (PatchInfoAnd p)) wX wY
- patchSetMerge :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Merge p) => PatchSet p Origin wX -> PatchSet p Origin wY -> (FL (PatchInfoAnd p) :/\: FL (PatchInfoAnd p)) wX wY
- countUsThem :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (Int, Int)
- removeFromPatchSet :: forall (p :: Type -> Type -> Type) wX wY wStart. (Commute p, Eq2 p) => FL (PatchInfoAnd p) wX wY -> PatchSet p wStart wY -> Maybe (PatchSet p wStart wX)
- slightlyOptimizePatchset :: forall (p :: Type -> Type -> Type) wStart wX. PatchSet p wStart wX -> PatchSet p wStart wX
- fullyOptimizePatchSet :: forall (p :: Type -> Type -> Type) wZ. Commute p => PatchSet p Origin wZ -> PatchSet p Origin wZ
- splitOnTag :: forall (p :: Type -> Type -> Type) wStart wX. Commute p => PatchInfo -> PatchSet p wStart wX -> Maybe (PatchSet p wStart wX)
- patchSetUnion :: forall (p :: Type -> Type -> Type). (Commute p, Merge p) => [SealedPatchSet p Origin] -> SealedPatchSet p Origin
- patchSetIntersection :: forall (p :: Type -> Type -> Type). Commute p => [SealedPatchSet p Origin] -> SealedPatchSet p Origin
- cleanLatestTag :: forall (p :: Type -> Type -> Type) wStart wX. Commute p => PatchSet p wStart wX -> PatchSet p wStart wX
- contextPatches :: forall (p :: Type -> Type -> Type) wX wY. PatchSet p wX wY -> (PatchSet p :> RL (PatchInfoAnd p)) wX wY

# Documentation

getUncovered :: forall (p :: Type -> Type -> Type) wStart wX. PatchSet p wStart wX -> [PatchInfo] #

Return the `PatchInfo` for all the patches in a `PatchSet` that are not *explicitly* depended on by any tag (in the given `PatchSet`).

This is exactly the set of patches that a new tag recorded on top of the `PatchSet` would explicitly depend on.

Note that the result is not minimal with respect to dependencies, not even explicit dependencies: explicit dependencies of regular (non-tag) patches are completely ignored.

areUnrelatedRepos :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> Bool #

Two `PatchSet`s are considered unrelated unless they share a common inventory, or either `PatchSet` has less than 5 patches, or they have at least one patch in common.

findCommon :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> Fork (PatchSet p) (FL (PatchInfoAnd p)) (FL (PatchInfoAnd p)) Origin wX wY #

The symmetric difference between two `PatchSet`s, expressed as a `Fork` consisting of the intersection `PatchSet` and the trailing lists of left-only and right-only patches.

From a purely functional point of view this is a symmetric function. However, laziness effects make it asymmetric: the LHS is more likely to be evaluated fully, while the RHS is evaluated as sparingly as possible. For efficiency, the LHS should come from the local repo and the RHS from the remote one. This asymmetry can also have a semantic effect, namely if `PatchSet`s have *unavailable* patches or inventories, for instance when we deal with a lazy clone of a repo that is no longer accessible. In this case the order of arguments may determine whether the command fails or succeeds.

findCommonWithThem :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (PatchSet p :> FL (PatchInfoAnd p)) Origin wX #

findUncommon :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (FL (PatchInfoAnd p) :\/: FL (PatchInfoAnd p)) wX wY #

patchSetMerge :: forall (p :: Type -> Type -> Type) wX wY. (Commute p, Merge p) => PatchSet p Origin wX -> PatchSet p Origin wY -> (FL (PatchInfoAnd p) :/\: FL (PatchInfoAnd p)) wX wY #

countUsThem :: forall (p :: Type -> Type -> Type) wX wY. Commute p => PatchSet p Origin wX -> PatchSet p Origin wY -> (Int, Int) #

removeFromPatchSet :: forall (p :: Type -> Type -> Type) wX wY wStart. (Commute p, Eq2 p) => FL (PatchInfoAnd p) wX wY -> PatchSet p wStart wY -> Maybe (PatchSet p wStart wX) #

slightlyOptimizePatchset :: forall (p :: Type -> Type -> Type) wStart wX. PatchSet p wStart wX -> PatchSet p wStart wX #

Create a new `Tagged` section for the most recent clean tag found in the tail of un-`Tagged` patches without re-ordering patches. Note that earlier tags may remain un-`Tagged` even if they are actually clean.

fullyOptimizePatchSet :: forall (p :: Type -> Type -> Type) wZ. Commute p => PatchSet p Origin wZ -> PatchSet p Origin wZ #

Create a `Tagged` section for every clean tag. For unclean tags we try to make them clean, but only if that doesn't make an earlier clean tag dirty. This means that the operation is idempotent and in particular monotonic, which justifies the "optimize" in the name.

splitOnTag :: forall (p :: Type -> Type -> Type) wStart wX. Commute p => PatchInfo -> PatchSet p wStart wX -> Maybe (PatchSet p wStart wX) #

Take a tag's `PatchInfo`, and a `PatchSet`, and attempt to find the tag in the `PatchSet`. If found, return a new `PatchSet`, in which the tag is now clean (and the last of the `Tagged` list), while all patches that are not covered by the tag are in the trailing list of patches. If the tag is not in the `PatchSet`, we return `Nothing`.

patchSetUnion :: forall (p :: Type -> Type -> Type). (Commute p, Merge p) => [SealedPatchSet p Origin] -> SealedPatchSet p Origin #

A `PatchSet` consisting of the patches contained in any of the input `PatchSet`s. The input `PatchSet`s are merged in left to right order, left patches first.

patchSetIntersection :: forall (p :: Type -> Type -> Type). Commute p => [SealedPatchSet p Origin] -> SealedPatchSet p Origin #

A `PatchSet` consisting of the patches common to all input `PatchSet`s. This is *undefined* for the empty list since intersection of `PatchSet`s has no unit.

cleanLatestTag :: forall (p :: Type -> Type -> Type) wStart wX. Commute p => PatchSet p wStart wX -> PatchSet p wStart wX #

Reorder a `PatchSet` such that the latest tag becomes clean.

contextPatches :: forall (p :: Type -> Type -> Type) wX wY. PatchSet p wX wY -> (PatchSet p :> RL (PatchInfoAnd p)) wX wY #

Split a `PatchSet` at the latest clean tag. The left part is what comes before the tag, the right part is the tag and its non-dependencies.