darcs-2.16.1: 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) wR)) Source #

Read the contents of pending.

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

Read the contents of tentative pending.

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

Write the contents of tentative pending.

siftForPending :: PrimSift 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 wO. RepoPatch p => Repository rt p wR wU wT -> FL (PrimOf p) wO wT -> IO () Source #

Remove as much as possible of the given list of prim patches from the pending patch. The "as much as possible" is due to --look-for-* options which cause changes that normally must be explicitly done by the user (such as add, move, and replace) to be inferred from the the diff between pristine and working. These changes cannot be removed from pending because they have never been part of it.

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

tentativelyRemoveFromPW :: forall rt p wR wO wT wP wU. RepoPatch p => Repository rt p wR wU wT -> FL (PrimOf p) wO wT -> FL (PrimOf p) wO wP -> FL (PrimOf p) wP wU -> IO () Source #

Similar to tentativelyRemoveFromPending, but also takes the (old) difference between pending and working into account. It is used by amend and record commands to adjust the pending patch. See the docs for updatePending below for details.

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

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

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

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

makeNewPending Source #

Arguments

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

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

-> IO () 

makeNewPending repo YesUpdatePending 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 -> FL (PrimOf p) wX wY -> IO () Source #

tentativelyAddToPending repo ps appends ps to the pending patch.

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 wP. RepoPatch p => Repository rt p wR wU wT -> FL (PrimOf p) wT wP -> IO () Source #

Overwrites the pending patch with a new one, starting at the tentative state.