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

License | GPL-2
Safe Haskell | None
Language | Haskell2010

Darcs.Repository.PatchIndex

Description

The patch-index stores additional information that is extracted from the PatchSet for the repository to speed up certain commands (namely `log` and `annotate`). More precisely, for every file tracked by the repository, it stores the list of patches that touch it.

When created, patch-index lives in `_darcs/patch_index/`, and it should be automatically maintained each time the set of patches of the repository is updated.

Patch-index can also be explicitely disabled by creating a file `_darcs/no_patch_index`. "Explicitely disabed" means that no command should attempt to automatically create the patch-index.

See http://darcs.net/Internals/PatchIndex for more information.

Synopsis

- doesPatchIndexExist :: FilePath -> IO Bool
- isPatchIndexDisabled :: FilePath -> IO Bool
- isPatchIndexInSync :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> IO Bool
- canUsePatchIndex :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> IO Bool
- createPIWithInterrupt :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO ()
- createOrUpdatePatchIndexDisk :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO ()
- deletePatchIndex :: FilePath -> IO ()
- attemptCreatePatchIndex :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO ()
- type PatchFilter (p :: Type -> Type -> Type) = [AnchoredPath] -> [Sealed2 (PatchInfoAnd p)] -> IO [Sealed2 (PatchInfoAnd p)]
- maybeFilterPatches :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> PatchFilter p
- getRelevantSubsequence :: forall (p :: Type -> Type -> Type) (a :: Type -> Type -> Type) wK (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree, a ~ PatchInfoAnd p) => Sealed (RL a wK) -> Repository rt p wU wR -> PatchSet p Origin wR -> [AnchoredPath] -> IO (Sealed (RL a Origin))
- dumpPatchIndex :: FilePath -> IO ()
- piTest :: FilePath -> IO ()

# Documentation

doesPatchIndexExist :: FilePath -> IO Bool #

Read-only. Checks if patch-index exists for this repository it works by checking if:

1. `_darcs/patch_index/` and its corresponding files are all present
2. patch index version is the one handled by this version of Darcs

isPatchIndexDisabled :: FilePath -> IO Bool #

Read-only. Checks if `_darcs/noPatchIndex` exists, that is, if patch-index is explicitely disabled.

isPatchIndexInSync :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> IO Bool #

Checks if patch-index exists and is in sync with repository. That is, checks if patch-index can be used as it is now.

canUsePatchIndex :: forall (rt :: AccessType) (p :: Type -> Type -> Type) wU wR. Repository rt p wU wR -> IO Bool #

Read-only. Checks the two following things:

1. `doesPatchIndexExist`
2. `isPatchIndexDisabled`

Then only if it exists and it is not explicitely disabled, returns `True`, else returns `False` (or an error if it exists and is explicitely disabled at the same time).

createPIWithInterrupt :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO () #

Creates patch-index (ignoring whether it is explicitely disabled). If it is ctrl-c'ed, then aborts, delete patch-index and mark it as disabled.

createOrUpdatePatchIndexDisk :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO () #

Create or update patch index

1. if `_darcs/no_patch_index` exists, delete it
2. if patch index exists, update it
3. if not, create it from scratch

deletePatchIndex :: FilePath -> IO () #

Deletes patch-index (`_darcs/patch_index/` and its contents) and mark repository as disabled (creates `_darcs/no_patch_index`).

attemptCreatePatchIndex :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wU wR -> PatchSet p Origin wR -> IO () #

Checks if patch index can be created and build it with interrupt.

type PatchFilter (p :: Type -> Type -> Type) = [AnchoredPath] -> [Sealed2 (PatchInfoAnd p)] -> IO [Sealed2 (PatchInfoAnd p)] #

maybeFilterPatches #

Arguments

:: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree) |
=> Repository rt p wU wR | The repository
-> PatchSet p Origin wR | PatchSet of patches of repository (in case patch-index needs to be created)
-> PatchFilter p | PatchFilter ready to be used by SelectChanges.

If a patch index is available, returns a filter that takes a list of files and returns a `PatchFilter` that only keeps patches that modify the given list of files. If patch-index cannot be used, return the original input. If patch-index does not exist and is not explicitely disabled, silently create it. (Also, if it is out-of-sync, which should not happen, silently update it).

getRelevantSubsequence #

Arguments

:: forall (p :: Type -> Type -> Type) (a :: Type -> Type -> Type) wK (rt :: AccessType) wU wR. (RepoPatch p, ApplyState p ~ Tree, a ~ PatchInfoAnd p) |
=> Sealed (RL a wK) | Sequence of patches you want to filter
-> Repository rt p wU wR | The repository (to attempt loading patch-index from its path)
-> PatchSet p Origin wR | PatchSet of repository (in case we need to create patch-index)
-> [AnchoredPath] | File(s) about which you want patches from given sequence
-> IO (Sealed (RL a Origin)) | Filtered sequence of patches

Returns an RL in which the order of patches matters. Useful for the `annotate` command. If patch-index does not exist and is not explicitely disabled, silently create it. (Also, if it is out-of-sync, which should not happen, silently update it).

dumpPatchIndex :: FilePath -> IO () #

Dump information in patch index. Patch-index should be checked to exist beforehand. Read-only.

piTest :: FilePath -> IO () #

Read-only sanity check on patch-index. Patch-index should be checked to exist beforehand. It may not be in sync with repository.