Safe Haskell | None |
---|---|
Language | Haskell2010 |
Darcs.Repository.Hashed
- inventoriesDir :: String
- pristineDir :: String
- patchesDir :: String
- hashedInventory :: String
- revertTentativeChanges :: IO ()
- revertRepositoryChanges :: RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> IO ()
- finalizeTentativeChanges :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> IO ()
- cleanPristine :: Repository rt p wR wU wT -> IO ()
- filterDirContents :: FilePath -> (FilePath -> Bool) -> IO [FilePath]
- cleanInventories :: Repository rt p wR wU wT -> IO ()
- cleanPatches :: Repository rt p wR wU wT -> IO ()
- copyPristine :: Cache -> String -> String -> WithWorkingDir -> IO ()
- copyPartialsPristine :: FilePathLike fp => Cache -> String -> String -> [fp] -> IO ()
- applyToTentativePristine :: (ApplyState q ~ Tree, Effect q, Patchy q, ShowPatch q, PrimPatchBase q) => Repository rt p wR wU wT -> Verbosity -> q wT wY -> IO ()
- applyToTentativePristineCwd :: (ApplyState p ~ Tree, Patchy p) => p wX wY -> IO ()
- addToSpecificInventory :: RepoPatch p => String -> Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO FilePath
- addToTentativeInventory :: RepoPatch p => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO FilePath
- removeFromTentativeInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> FL (PatchInfoAnd rt p) wX wT -> IO ()
- readRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
- readRepoHashed :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wR)
- readTentativeRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wT)
- readRepoUsingSpecificInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wS)
- writeAndReadPatch :: (IsRepoType rt, RepoPatch p) => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO (PatchInfoAnd rt p wX wY)
- writeTentativeInventory :: RepoPatch p => Cache -> Compression -> PatchSet rt p Origin wX -> IO ()
- copyHashedInventory :: RepoPatch p => Repository rt p wR wU wT -> RemoteDarcs -> String -> IO ()
- readHashedPristineRoot :: Repository rt p wR wU wT -> IO (Maybe String)
- pris2inv :: String -> ByteString -> Doc
- inv2pris :: ByteString -> String
- listInventories :: IO [String]
- listInventoriesLocal :: IO [String]
- listInventoriesRepoDir :: String -> IO [String]
- listPatchesLocalBucketed :: String -> String -> IO [String]
- writePatchIfNecessary :: RepoPatch p => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO (PatchInfo, String)
- readRepoFromInventoryList :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Cache -> (Maybe String, [(PatchInfo, String)]) -> IO (SealedPatchSet rt p Origin)
- readPatchIds :: ByteString -> [(PatchInfo, String)]
- set :: [String] -> Set ByteString
- unset :: Set ByteString -> [String]
- withRecorded :: RepoPatch p => Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
- withTentative :: forall rt p a wR wU wT. (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
- 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)
- 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)
- tentativelyRemovePatches_ :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository rt p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd rt p) wX wT -> IO (Repository rt p wR wU wX)
- tentativelyAddPatch_ :: (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository rt p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd rt p wT wY -> IO (Repository rt p wR wU wY)
- 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)
- 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 ()
- finalizeRepositoryChanges :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
- unrevertUrl :: Repository rt p wR wU wT -> String
- createPristineDirectoryTree :: RepoPatch p => Repository rt p wR wU wT -> FilePath -> WithWorkingDir -> IO ()
- createPartialsPristineDirectoryTree :: (FilePathLike fp, RepoPatch p) => Repository rt p wR wU wT -> [fp] -> FilePath -> IO ()
- reorderInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> Compression -> UpdateWorking -> Verbosity -> IO ()
- cleanRepository :: RepoPatch p => Repository rt p wR wU wT -> IO ()
- data UpdatePristine
- repoXor :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> IO SHA1
Documentation
pristineDir :: String Source #
patchesDir :: String Source #
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, ApplyState p ~ Tree) => 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, Effect q, Patchy q, ShowPatch q, PrimPatchBase 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
applyToTentativePristineCwd :: (ApplyState p ~ Tree, Patchy p) => p wX wY -> IO () Source #
addToSpecificInventory :: RepoPatch p => String -> Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO FilePath Source #
addToSpecificInventory adds a patch to a specific inventory file, and returns the FilePath whichs corresponds to the written-out patch.
addToTentativeInventory :: RepoPatch p => Cache -> Compression -> PatchInfoAnd rt p wX wY -> IO FilePath Source #
removeFromTentativeInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Compression -> FL (PatchInfoAnd rt p) wX wT -> IO () Source #
Attempt to remove an FL of patches from the tentative inventory. This is used for commands that wish to modify already-recorded patches.
Precondition: it must be possible to remove the patches, i.e.
- the patches are in the repository
- any necessary commutations will succeed
readRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR) Source #
readRepoHashed :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => 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, ApplyState p ~ Tree) => Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wT) Source #
readRepo returns the tentative repo patchset.
readRepoUsingSpecificInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> String -> IO (PatchSet rt p Origin wS) Source #
readRepoUsingSpecificInventory uses the inventory at invPath
to read the
repository repo
.
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 :: RepoPatch p => 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.
pris2inv :: String -> ByteString -> Doc Source #
pris2inv takes an updated pristine hash and an inventory, and outputs the new pristine hash followed by the original inventory (having skipped the old inventory hash).
inv2pris :: ByteString -> String Source #
inv2pris takes the content of an inventory, and extracts the corresponding pristine hash from the inventory (the hash is prefixed by "pristine:").
listInventories :: IO [String] Source #
listInventories returns a list of the inventories hashes. This function attempts to retrieve missing inventory files.
listInventoriesLocal :: IO [String] Source #
listInventoriesLocal returns a list of the inventories hashes. 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 "hashed_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 (PatchInfo, String) 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.
readRepoFromInventoryList :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Cache -> (Maybe String, [(PatchInfo, String)]) -> IO (SealedPatchSet rt p Origin) Source #
readRepoFromInventoryList allows the caller to provide an optional "from inventory" hash, and a list of info/hash pairs that identify a list of patches, returning a patchset of the resulting repo.
readPatchIds :: ByteString -> [(PatchInfo, String)] Source #
'readPatchIds inventory' parses the content of a hashed_inventory file after the "pristine:" and "Starting with inventory:" header lines have been removed. The second value in the resulting tuples is the file hash of the associated patch (the "hash:" line).
set :: [String] -> Set ByteString Source #
set converts a list of strings into a set of Char8 ByteStrings for faster Set operations.
withRecorded :: RepoPatch p => 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. (RepoPatch p, ApplyState p ~ Tree) => 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 #
tentativelyRemovePatches_ :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository rt p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd rt p) wX wT -> IO (Repository rt p wR wU wX) Source #
tentativelyAddPatch_ :: (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository rt p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd rt p wT wY -> IO (Repository rt p wR wU wY) 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.
finalizeRepositoryChanges :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO () Source #
unrevertUrl :: Repository rt p wR wU wT -> String Source #
createPristineDirectoryTree :: RepoPatch p => 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, RepoPatch p) => 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 :: RepoPatch p => Repository rt p wR wU wT -> IO () Source #
data UpdatePristine Source #
Instances
repoXor :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => 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/ .