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

Safe Haskell | None
Language | Haskell2010

Darcs.Repository.Hashed

Synopsis

- revertTentativeChanges :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> IO ()
- finalizeTentativeChanges :: forall (p :: Type -> Type -> Type) wU wR. RepoPatch p => Repository 'RW p wU wR -> IO ()
- addToTentativeInventory :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO ()
- readPatches :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. RepoPatch p => Repository rt p wU wR -> IO (PatchSet p Origin wR)
- readTentativePatches :: forall (p :: Type -> Type -> Type) wU wR. (PatchListFormat p, ReadPatch p) => Repository 'RW p wU wR -> IO (PatchSet p Origin wR)
- writeAndReadPatch :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO (PatchInfoAnd p wX wY)
- writeTentativeInventory :: forall (p :: Type -> Type -> Type) wU wR wX. RepoPatch p => Repository 'RW p wU wR -> PatchSet p Origin wX -> IO ()
- copyHashedInventory :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> RemoteDarcs -> String -> IO ()
- writePatchIfNecessary :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO InventoryEntry
- tentativelyAddPatch :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> PatchInfoAnd p wR wY -> IO (Repository 'RW p wU wY)
- tentativelyRemovePatches :: forall (p :: Type -> Type -> Type) wU wR wX. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wX wR -> IO (Repository 'RW p wU wX)
- tentativelyRemovePatches_ :: forall (p :: Type -> Type -> Type) wU wR wX. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wX wR -> IO (Repository 'RW p wU wX)
- tentativelyAddPatch_ :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> PatchInfoAnd p wR wY -> IO (Repository 'RW p wU wY)
- tentativelyAddPatches :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wR wY -> IO (Repository 'RW p wU wY)
- tentativelyAddPatches_ :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wR wY -> IO (Repository 'RW p wU wY)
- reorderInventory :: forall (p :: Type -> Type -> Type) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> OptimizeDeep -> IO ()
- data UpdatePristine
  - = UpdatePristine
  - | DontUpdatePristine
  - | DontUpdatePristineNorRevert
- repoXor :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. RepoPatch p => Repository rt p wU wR -> IO SHA1

# Documentation

revertTentativeChanges :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> IO () #

revertTentativeChanges swaps the tentative and "real" hashed inventory files, and then updates the tentative pristine with the "real" inventory hash.

finalizeTentativeChanges :: forall (p :: Type -> Type -> Type) wU wR. RepoPatch p => Repository 'RW p wU wR -> IO () #

finalizeTentativeChanges trys to atomically swap the tentative inventory/pristine pointers with the "real" pointers; it first re-reads the inventory to optimize it, presumably to take account of any new tags, and then writes out the new tentative inventory, and finally does the atomic swap. In general, we can't clean the pristine cache at the same time, since a simultaneous get might be in progress.

addToTentativeInventory :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO () #

Add (append) a patch to the tentative inventory. Warning: this allows to add any arbitrary patch! Used by convert import and `tentativelyAddPatch_`.

readPatches :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. RepoPatch p => Repository rt p wU wR -> IO (PatchSet p Origin wR) #

Read inventories and patches from a `Repository` and return them as a `PatchSet`. Note that patches and inventories are read lazily.

readTentativePatches :: forall (p :: Type -> Type -> Type) wU wR. (PatchListFormat p, ReadPatch p) => Repository 'RW p wU wR -> IO (PatchSet p Origin wR) #

Read the tentative `PatchSet` of a (hashed) `Repository`.

writeAndReadPatch :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO (PatchInfoAnd p wX wY) #

writeAndReadPatch makes a patch lazy, by writing it out to disk (thus forcing it), and then re-reads the patch lazily.

writeTentativeInventory :: forall (p :: Type -> Type -> Type) wU wR wX. RepoPatch p => Repository 'RW p wU wR -> PatchSet p Origin wX -> IO () #

Write a `PatchSet` to the tentative inventory.

copyHashedInventory :: forall (p :: Type -> Type -> Type) wU wR. Repository 'RO p wU wR -> RemoteDarcs -> String -> IO () #

Copy the hashed inventory from the given location to the given repository, possibly using the given remote darcs binary.

writePatchIfNecessary :: forall (p :: Type -> Type -> Type) wX wY. RepoPatch p => Cache -> PatchInfoAnd p wX wY -> IO InventoryEntry #

Write a `PatchInfoAnd` to disk and return an `InventoryEntry` i.e. the patch info and hash. However, if we patch already contains a hash, assume it has already been written to disk at some point and merely return the info and hash.

tentativelyAddPatch :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> PatchInfoAnd p wR wY -> IO (Repository 'RW p wU wY) #

tentativelyRemovePatches :: forall (p :: Type -> Type -> Type) wU wR wX. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wX wR -> IO (Repository 'RW p wU wX) #

tentativelyRemovePatches_ :: forall (p :: Type -> Type -> Type) wU wR wX. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wX wR -> IO (Repository 'RW p wU wX) #

tentativelyAddPatch_ :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> PatchInfoAnd p wR wY -> IO (Repository 'RW p wU wY) #

tentativelyAddPatches :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wR wY -> IO (Repository 'RW p wU wY) #

tentativelyAddPatches_ :: forall (p :: Type -> Type -> Type) wU wR wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository 'RW p wU wR -> UpdatePending -> FL (PatchInfoAnd p) wR wY -> IO (Repository 'RW p wU wY) #

reorderInventory :: forall (p :: Type -> Type -> Type) wU wR. (RepoPatch p, ApplyState p ~ Tree) => Repository 'RW p wU wR -> OptimizeDeep -> IO () #

Writes out a fresh copy of the inventory that minimizes the amount of inventory that need be downloaded when people pull from the repository. The exact beavior depends on the 3rd parameter:

For `OptimizeShallow` it breaks up the inventory on the most recent tag. This speeds up most commands when run remotely, both because a smaller file needs to be transfered (only the most recent inventory). It also gives a guarantee that all the patches prior to a given tag are included in that tag, so less commutation and history traversal is needed. This latter issue can become very important in large repositories.

For `OptimizeDeep`, the whole repo is traversed, from oldest to newest patch. Every tag we encounter is made clean, but only if that doesn't make any previous clean tag unclean. Every clean tags gets its own inventory. This speeds up "deep" operations, too, such as cloning a specific tag. It does not necessarily make the latest tag clean, but the benefits are similar to the shallow case.

data UpdatePristine #

Constructors

UpdatePristine |
DontUpdatePristine |
DontUpdatePristineNorRevert |

#### Instances

Instances details

Eq UpdatePristine # |
Instance details Defined in Darcs.Repository.Hashed Methods (==) :: UpdatePristine -> UpdatePristine -> Bool # (/=) :: UpdatePristine -> UpdatePristine -> Bool #

repoXor :: forall (p :: Type -> Type -> Type) (rt :: AccessType) wU wR. RepoPatch p => Repository rt p wU wR -> IO SHA1 #

XOR of all hashes of the patches' metadata. It enables to quickly see whether two repositories have the same patches, independently of their order. It relies on the assumption that the same patch cannot be present twice in a repository. This checksum is not cryptographically secure, see http://robotics.stanford.edu/~xb/crypto06b/ .