Safe Haskell | None |
---|---|
Language | Haskell2010 |
Darcs.Repository.Internal
- data Repository p wRecordedstate wUnrecordedstate wTentativestate = Repo !String !RepoFormat !Pristine Cache
- maybeIdentifyRepository :: UseCache -> String -> IO (IdentifyRepo p wR wU wT)
- identifyRepository :: forall p wR wU wT. UseCache -> String -> IO (Repository p wR wU wT)
- identifyRepositoryFor :: forall p wR wU wT vR vU vT. RepoPatch p => Repository p wR wU wT -> UseCache -> String -> IO (Repository p vR vU vT)
- data IdentifyRepo p wR wU wT
- = BadRepository String
- | NonRepository String
- | GoodRepository (Repository p wR wU wT)
- findRepository :: WorkRepo -> IO (Either String ())
- amInRepository :: WorkRepo -> IO (Either String ())
- amNotInRepository :: WorkRepo -> IO (Either String ())
- amInHashedRepository :: WorkRepo -> IO (Either String ())
- revertRepositoryChanges :: RepoPatch p => Repository p wR wU wT -> UpdateWorking -> IO ()
- announceMergeConflicts :: (PrimPatch p, PatchInspect p) => String -> AllowConflicts -> ExternalMerge -> FL p wX wY -> IO Bool
- setTentativePending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
- checkUnrecordedConflicts :: forall p wT wY. RepoPatch p => UpdateWorking -> FL (Named p) wT wY -> IO Bool
- readRepo :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> IO (PatchSet p Origin wR)
- readTentativeRepo :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> IO (PatchSet p Origin wT)
- readRepoUsingSpecificInventory :: (RepoPatch p, ApplyState p ~ Tree) => String -> Repository p wR wU wT -> IO (PatchSet p Origin wT)
- prefsUrl :: Repository p wR wU wT -> String
- withRecorded :: RepoPatch p => Repository p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
- withTentative :: forall p a wR wU wT. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
- tentativelyAddPatch :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd p wT wY -> IO (Repository p wR wU wY)
- tentativelyRemovePatches :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd p) wX wT -> IO (Repository p wR wU wX)
- tentativelyRemovePatches_ :: forall p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd p) wX wT -> IO (Repository p wR wU wX)
- tentativelyRemoveFromPending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> PatchInfoAnd p wX wY -> IO ()
- tentativelyAddToPending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
- tentativelyAddPatch_ :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd p wT wY -> IO (Repository p wR wU wY)
- tentativelyAddPatches_ :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> FL (PatchInfoAnd p) wT wY -> IO (Repository p wR wU wY)
- tentativelyReplacePatches :: forall p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> UpdateWorking -> Verbosity -> FL (PatchInfoAnd p) wX wT -> IO ()
- finalizeRepositoryChanges :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> UpdateWorking -> Compression -> IO ()
- unrevertUrl :: Repository p wR wU wT -> String
- applyToWorking :: (ApplyState (PrimOf p) ~ Tree, RepoPatch p) => Repository p wR wU wT -> Verbosity -> FL (PrimOf p) wU wY -> IO (Repository p wR wY wT)
- patchSetToPatches :: RepoPatch p => PatchSet p wX wY -> FL (Named p) wX wY
- createPristineDirectoryTree :: RepoPatch p => Repository p wR wU wT -> FilePath -> WithWorkingDir -> IO ()
- createPartialsPristineDirectoryTree :: (FilePathLike fp, RepoPatch p) => Repository p wR wU wT -> [fp] -> FilePath -> IO ()
- reorderInventory :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wR -> Compression -> UpdateWorking -> Verbosity -> IO ()
- cleanRepository :: RepoPatch p => Repository p wR wU wT -> IO ()
- setScriptsExecutable :: IO ()
- setScriptsExecutablePatches :: PatchInspect p => p wX wY -> IO ()
- data UpdatePristine
- data MakeChanges
- applyToTentativePristine :: (ApplyState q ~ Tree, Effect q, Patchy q, ShowPatch q, PrimPatchBase q) => Repository p wR wU wT -> Verbosity -> q wT wY -> IO ()
- makeNewPending :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wT wY -> IO ()
- seekRepo :: IO (Maybe (Either String ()))
Documentation
data Repository p wRecordedstate wUnrecordedstate wTentativestate
A Repository
is a token representing the state of a repository on disk.
It is parameterized by the patch type in the repository, and witnesses for
the recorded state of the repository (i.e. what darcs get would retrieve),
the unrecorded state (what's in the working directory now),
and the tentative state, which represents work in progress that will
eventually become the new recorded state unless something goes wrong.
Constructors
Repo !String !RepoFormat !Pristine Cache |
Instances
Show (Repository p wRecordedstate wUnrecordedstate wTentativestate) |
maybeIdentifyRepository :: UseCache -> String -> IO (IdentifyRepo p wR wU wT)
Tries to identify the repository in a given directory
identifyRepository :: forall p wR wU wT. UseCache -> String -> IO (Repository p wR wU wT)
identifyRepository identifies the repo at url
. Warning:
you have to know what kind of patches are found in that repo.
identifyRepositoryFor :: forall p wR wU wT vR vU vT. RepoPatch p => Repository p wR wU wT -> UseCache -> String -> IO (Repository p vR vU vT)
identifyRepositoryFor repo url
identifies (and returns) the repo at url
,
but fails if it is not compatible for reading from and writing to.
data IdentifyRepo p wR wU wT
The status of a given directory: is it a darcs repository?
Constructors
BadRepository String | looks like a repository with some error |
NonRepository String | safest guess |
GoodRepository (Repository p wR wU wT) |
findRepository :: WorkRepo -> IO (Either String ())
amInRepository :: WorkRepo -> IO (Either String ())
amNotInRepository :: WorkRepo -> IO (Either String ())
amInHashedRepository :: WorkRepo -> IO (Either String ())
revertRepositoryChanges :: RepoPatch p => Repository p wR wU wT -> UpdateWorking -> IO ()
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.
announceMergeConflicts :: (PrimPatch p, PatchInspect p) => String -> AllowConflicts -> ExternalMerge -> FL p wX wY -> IO Bool
setTentativePending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
setTentativePending is basically unsafe. It overwrites the pending state with a new one, not related to the repository state.
checkUnrecordedConflicts :: forall p wT wY. RepoPatch p => UpdateWorking -> FL (Named p) wT wY -> IO Bool
readRepo :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> IO (PatchSet p Origin wR)
readTentativeRepo :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> IO (PatchSet p Origin wT)
readRepoUsingSpecificInventory :: (RepoPatch p, ApplyState p ~ Tree) => String -> Repository p wR wU wT -> IO (PatchSet p Origin wT)
prefsUrl :: Repository p wR wU wT -> String
withRecorded :: RepoPatch p => Repository p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
withTentative :: forall p a wR wU wT. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
tentativelyAddPatch :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd p wT wY -> IO (Repository p wR wU wY)
tentativelyRemovePatches :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd p) wX wT -> IO (Repository p wR wU wX)
tentativelyRemovePatches_ :: forall p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> UpdateWorking -> FL (PatchInfoAnd p) wX wT -> IO (Repository p wR wU wX)
tentativelyRemoveFromPending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> PatchInfoAnd p wX wY -> IO ()
tentativelyRemoveFromPending p
is used by Darcs whenever it
adds a patch to the repository (eg. with apply or record).
Think of it as one part of transferring patches from pending to
somewhere else.
Question (Eric Kow): how do we detect patch equivalence?
tentativelyAddToPending :: forall p wR wU wT wX wY. RepoPatch p => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
tentativelyAddToPending repo NoDryRun YesUpdateWorking pend ps
appends ps
to the pending patch.
It has no effect with NoUpdateWorking
.
This fuction is unsafe because it accepts a patch that works on the tentative pending and we don't currently track the state of the tentative pending.
tentativelyAddPatch_ :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> PatchInfoAnd p wT wY -> IO (Repository p wR wU wY)
tentativelyAddPatches_ :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => UpdatePristine -> Repository p wR wU wT -> Compression -> Verbosity -> UpdateWorking -> FL (PatchInfoAnd p) wT wY -> IO (Repository p wR wU wY)
tentativelyReplacePatches :: forall p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> Compression -> UpdateWorking -> Verbosity -> FL (PatchInfoAnd p) wX wT -> IO ()
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 :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> UpdateWorking -> Compression -> IO ()
unrevertUrl :: Repository p wR wU wT -> String
applyToWorking :: (ApplyState (PrimOf p) ~ Tree, RepoPatch p) => Repository p wR wU wT -> Verbosity -> FL (PrimOf p) wU wY -> IO (Repository p wR wY wT)
patchSetToPatches :: RepoPatch p => PatchSet p wX wY -> FL (Named p) wX wY
createPristineDirectoryTree :: RepoPatch p => Repository p wR wU wT -> FilePath -> WithWorkingDir -> IO ()
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 p wR wU wT -> [fp] -> FilePath -> IO ()
Used by the commands dist and diff
reorderInventory :: (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wR -> Compression -> UpdateWorking -> Verbosity -> 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.
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 p wR wU wT -> IO ()
setScriptsExecutable :: IO ()
setScriptsExecutablePatches :: PatchInspect p => p wX wY -> IO ()
data UpdatePristine
Instances
applyToTentativePristine :: (ApplyState q ~ Tree, Effect q, Patchy q, ShowPatch q, PrimPatchBase q) => Repository p wR wU wT -> Verbosity -> q wT wY -> IO ()
makeNewPending :: forall p wR wU wT wY. (RepoPatch p, ApplyState p ~ Tree) => Repository p wR wU wT -> UpdateWorking -> FL (PrimOf p) wT wY -> IO ()
makeNewPending repo YesUpdateWorking pendPs
verifies that the
pendPs
could be applied to pristine if we wanted to, and if so
writes it to disk. If it can't be applied, pendPs
must
be somehow buggy, so we save it for forensics and crash.
seekRepo :: IO (Maybe (Either String ()))
hunt upwards for the darcs repository This keeps changing up one parent directory, testing at each step if the current directory is a repository or not. $ The result is: Nothing, if no repository found Just (Left errorMessage), if bad repository found Just (Right ()), if good repository found. WARNING this changes the current directory for good if matchFn succeeds