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

LicenseGPL-2
Safe HaskellNone
LanguageHaskell2010

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

Documentation

doesPatchIndexExist :: FilePath -> IO Bool Source #

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

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

isPatchIndexInSync :: Repository rt p wR wU wT -> IO Bool Source #

Checks if patch-index exists and is in sync with repository (more precisely with _darcs/hashed_inventory). That is, checks if patch-index can be used as it is now.

canUsePatchIndex :: Repository rt p wR wU wT -> IO Bool Source #

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 :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> PatchSet rt p Origin wR -> IO () Source #

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 :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> PatchSet rt p Origin wR -> IO () Source #

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 () Source #

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

attemptCreatePatchIndex :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> PatchSet rt p Origin wR -> IO () Source #

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

maybeFilterPatches Source #

Arguments

:: (RepoPatch p, ApplyState p ~ Tree) 
=> Repository rt p wR wU wT

The repository

-> PatchSet rt p Origin wR

PatchSet of patches of repository (in case patch-index needs to be created)

-> PatchFilter rt 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 Source #

Arguments

:: (RepoPatch p, ApplyState p ~ Tree, a ~ PatchInfoAnd rt p) 
=> Sealed (RL a wK)

Sequence of patches you want to filter

-> Repository rt p wR wU wR

The repository (to attempt loading patch-index from its path)

-> PatchSet rt 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 () Source #

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

piTest :: FilePath -> IO () Source #

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