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

Safe HaskellNone
LanguageHaskell2010

Darcs.Repository.Hashed

Synopsis

Documentation

revertTentativeChanges :: IO () Source #

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

revertRepositoryChanges :: RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> IO () Source #

Slightly confusingly named: as well as throwing away any tentative changes, revertRepositoryChanges also re-initialises the tentative state. It's therefore used before makign any changes to the repo. So the type should rather be

... -> Repo rt p wR wU wT -> IO (Repo rt p wR wU wR)

finalizeTentativeChanges :: (IsRepoType rt, RepoPatch p) => Repository rt p wR wU wT -> Compression -> IO () Source #

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.

cleanPristine :: Repository rt p wR wU wT -> IO () Source #

cleanPristine removes any obsolete (unreferenced) entries in the pristine cache.

filterDirContents :: FilePath -> (FilePath -> Bool) -> IO [FilePath] Source #

filterDirContents returns the contents of the directory d except files whose names begin with . (directories . and .., hidden files) and files whose names are filtered by the function f, if dir is empty, no paths are returned.

cleanInventories :: Repository rt p wR wU wT -> IO () Source #

cleanInventories removes any obsolete (unreferenced) files in the inventories directory.

cleanPatches :: Repository rt p wR wU wT -> IO () Source #

cleanPatches removes any obsolete (unreferenced) files in the patches directory.

copyPristine :: Cache -> String -> String -> WithWorkingDir -> IO () Source #

copyPristine copies a pristine tree into the current pristine dir, and possibly copies a clean working copy. The target is read from the passed-in dir/inventory name combination.

copyPartialsPristine :: FilePathLike fp => Cache -> String -> String -> [fp] -> IO () Source #

copyPartialsPristine copies the pristine entries for a given list of filepaths.

applyToTentativePristine :: (ApplyState q ~ Tree, Apply q, ShowPatch q) => Repository rt p wR wU wT -> Verbosity -> q wT wY -> IO () Source #

applyToTentativePristine applies a patch p to the tentative pristine tree, and updates the tentative pristine hash

addToTentativeInventory :: RepoPatch p => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO FilePath Source #

Warning: this allows to add any arbitrary patch! Used by convert import.

readRepo :: (IsRepoType rt, RepoPatch p) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR) Source #

readRepoHashed :: (IsRepoType rt, RepoPatch p) => Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wR) Source #

readRepo returns the "current" repo patchset.

readTentativeRepo :: (IsRepoType rt, RepoPatch p) => Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wT) Source #

readRepo returns the tentative repo patchset.

writeAndReadPatch :: (IsRepoType rt, RepoPatch p) => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO (PatchInfoAnd rt p wX wY) Source #

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

writeTentativeInventory :: RepoPatch p => Cache -> Compression -> PatchSet rt p Origin wX -> IO () Source #

writeTentativeInventory writes patchSet as the tentative inventory.

copyHashedInventory :: Repository rt p wR wU wT -> RemoteDarcs -> String -> IO () Source #

copyRepo copies the hashed inventory of repo to the repository located at remote.

readHashedPristineRoot :: Repository rt p wR wU wT -> IO (Maybe String) Source #

readHashedPristineRoot attempts to read the pristine hash from the current inventory, returning Nothing if it cannot do so.

pokePristineHash :: String -> ByteString -> Doc Source #

Replace the pristine hash at the start of a raw, unparsed HeadInventory or add it if none is present.

listInventories :: IO [String] Source #

listInventories returns a list of the inventories hashes. This function attempts to retrieve missing inventory files.

listInventoriesLocal :: IO [String] Source #

Return inventories hashes by following the head inventory. This function does not attempt to retrieve missing inventory files.

listInventoriesRepoDir :: String -> IO [String] Source #

listInventoriesRepoDir returns a list of the inventories hashes. The argument repoDir is the directory of the repository from which we are going to read the head inventory file. The rest of hashed files are read from the global cache.

listPatchesLocalBucketed :: String -> String -> IO [String] Source #

listPatchesLocalBucketed is similar to listPatchesLocal, but it read the inventory directory under darcsDir in bucketed format.

writePatchIfNecessary :: RepoPatch p => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO InventoryEntry Source #

writeHashIfNecessary writes the patch and returns the resulting info/hash, if it has not already been written. If it has been written, we have the hash in the PatchInfoAnd, so we extract and return the info/hash.

diffHashLists :: [String] -> [String] -> [String] Source #

Set difference between two lists of hashes.

withRecorded :: Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a Source #

withTentative :: forall rt p a wR wU wT. Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a Source #

tentativelyAddPatch :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd rt p wT wY -> IO (Repository rt p wR wU wY) Source #

tentativelyRemovePatches :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd rt p) wX wT -> IO (Repository rt p wR wU wX) Source #

tentativelyAddPatches_ :: (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository rt p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> FL (PatchInfoAnd rt p) wT wY -> IO (Repository rt p wR wU wY) Source #

tentativelyReplacePatches :: forall rt p wR wU wT wX. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> UpdateWorking -> Verbosity -> FL (PatchInfoAnd rt p) wX wT -> IO () Source #

Given a sequence of patches anchored at the end of the current repository, actually pull them to the end of the repository by removing any patches with the same name and then adding the passed in sequence. Typically callers will have obtained the passed in sequence using findCommon and friends.

unrevertUrl :: Repository rt p wR wU wT -> String Source #

createPristineDirectoryTree :: Repository rt p wR wU wT -> FilePath -> WithWorkingDir -> IO () Source #

grab the pristine hash of _darcs/hash_inventory, and retrieve whole pristine tree, possibly writing a clean working copy in the process.

createPartialsPristineDirectoryTree :: FilePathLike fp => Repository rt p wR wU wT -> [fp] -> FilePath -> IO () Source #

Used by the commands dist and diff

reorderInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> Compression -> UpdateWorking -> Verbosity -> IO () Source #

Writes out a fresh copy of the inventory that minimizes the amount of inventory that need be downloaded when people pull from the repository.

Specifically, 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.

cleanRepository :: Repository rt p wR wU wT -> IO () Source #

repoXor :: (IsRepoType rt, RepoPatch p) => Repository rt p wR wU wR -> IO SHA1 Source #

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/ .