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

Safe HaskellNone
LanguageHaskell2010

Darcs.Repository.Pending

Synopsis

Documentation

readPending :: RepoPatch p => Repository rt p wR wU wT -> IO (Sealed (FL (PrimOf p) wT)) Source #

Read the contents of pending. The return type is currently incorrect as it refers to the tentative state rather than the recorded state.

siftForPending :: forall prim wX wY. PrimPatch prim => FL prim wX wY -> Sealed (FL prim wX) Source #

siftForPending ps simplifies the candidate pending patch ps through a combination of looking for self-cancellations (sequences of patches followed by their inverses), coalescing, and getting rid of any hunk/binary patches we can commute out the back

The visual image of sifting can be quite helpful here. We are repeatedly tapping (shrinking) the patch sequence and shaking it (sift). Whatever falls out is the pending we want to keep. We do this until the sequence looks about as clean as we can get it

tentativelyRemoveFromPending :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> PatchInfoAnd rt p wX wY -> IO () Source #

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?

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

Replace the pending patch with the tentative pending. If NoUpdateWorking, this merely deletes the tentative pending without replacing the current one.

Question (Eric Kow): shouldn't this also delete the tentative pending if YesUpdateWorking? I'm just puzzled by the seeming inconsistency of the NoUpdateWorking doing deletion, but YesUpdateWorking not bothering.

makeNewPending Source #

Arguments

:: (RepoPatch p, ApplyState p ~ Tree) 
=> Repository rt p wR wU wT 
-> UpdateWorking 
-> FL (PrimOf p) wT wY 
-> Tree IO

recorded state of the repository, to check if pending can be applied

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

tentativelyAddToPending :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO () Source #

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.

setTentativePending :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO () Source #

setTentativePending is basically unsafe. It overwrites the pending state with a new one, not related to the repository state.

prepend :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO () Source #

prepend repo YesUpdateWorking ps prepends ps to the pending patch It's used right before removing ps from the repo. This ensures that the pending patch can still be applied on top of the recorded state.

This function is basically unsafe. It overwrites the pending state with a new one, not related to the repository state.