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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Darcs.Repository.Job

Synopsis

- data RepoJob a
  - = RepoJob (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> IO a)
  - | V1Job (forall wR wU. Repository ('RepoType 'NoRebase) (RepoPatchV1 Prim) wR wU wR -> IO a)
  - | V2Job (forall rt wR wU. IsRepoType rt => Repository rt (RepoPatchV2 Prim) wR wU wR -> IO a)
  - | PrimV1Job (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, IsPrimV1 (PrimOf p)) => Repository rt p wR wU wR -> IO a)
  - | RebaseAwareJob (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> IO a)
  - | RebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
  - | OldRebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
  - | StartRebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a)
- class ApplyState p ~ Tree => IsPrimV1 p where
  - toPrimV1 :: p wX wY -> Prim wX wY
- withRepoLock :: DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob a -> IO a
- withOldRepoLock :: RepoJob a -> IO a
- withRepoLockCanFail :: UseCache -> RepoJob () -> IO ()
- withRepository :: UseCache -> RepoJob a -> IO a
- withRepositoryLocation :: UseCache -> String -> RepoJob a -> IO a
- checkRepoIsNoRebase :: forall rt p wR wU wT. IsRepoType rt => Repository rt p wR wU wT -> Maybe (Repository ('RepoType 'NoRebase) p wR wU wT)
- withUMaskFlag :: UMask -> IO a -> IO a

# Documentation

data RepoJob a #

A `RepoJob` wraps up an action to be performed with a repository. Because repositories can contain different types of patches, such actions typically need to be polymorphic in the kind of patch they work on. `RepoJob` is used to wrap up the polymorphism, and the various functions that act on a `RepoJob` are responsible for instantiating the underlying action with the appropriate patch type.

Constructors

RepoJob (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> IO a) | The most common `RepoJob`; the underlying action can accept any patch type that a darcs repository may use.
V1Job (forall wR wU. Repository ('RepoType 'NoRebase) (RepoPatchV1 Prim) wR wU wR -> IO a) | A job that only works on darcs 1 patches
V2Job (forall rt wR wU. IsRepoType rt => Repository rt (RepoPatchV2 Prim) wR wU wR -> IO a) | A job that only works on darcs 2 patches
PrimV1Job (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, IsPrimV1 (PrimOf p)) => Repository rt p wR wU wR -> IO a) | A job that works on any repository where the patch type `p` has `PrimOf` `p` = `Prim`. This was added to support darcsden, which inspects the internals of V1 prim patches. In future this should be replaced with a more abstract inspection API as part of `PrimPatch`.
RebaseAwareJob (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wR -> IO a) |
RebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a) |
OldRebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a) |
StartRebaseJob (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree) => Repository ('RepoType 'IsRebase) p wR wU wR -> IO a) |

class ApplyState p ~ Tree => IsPrimV1 p where #

Methods

toPrimV1 :: p wX wY -> Prim wX wY #

#### Instances

Instances details

IsPrimV1 Prim # |
Instance details Defined in Darcs.Repository.Job Methods toPrimV1 :: Prim wX wY -> Prim0 wX wY #
IsPrimV1 Prim # |
Instance details Defined in Darcs.Repository.Job Methods toPrimV1 :: Prim wX wY -> Prim0 wX wY #

withRepoLock :: DryRun -> UseCache -> UpdatePending -> UMask -> RepoJob a -> IO a #

Apply a given RepoJob to a repository in the current working directory. However, before doing the job, take the repo lock and initializes a repo transaction, unless this is a dry-run.

withOldRepoLock :: RepoJob a -> IO a #

run a lock-taking job in an old-fashion repository. only used by `darcs optimize upgrade`.

withRepoLockCanFail :: UseCache -> RepoJob () -> IO () #

Apply a given RepoJob to a repository in the current working directory, taking a lock. If lock not takeable, do nothing. If old-fashioned repository, do nothing. The job must not touch pending or pending.tentative, because there is no call to revertRepositoryChanges. This entry point is currently only used for attemptCreatePatchIndex.

withRepository :: UseCache -> RepoJob a -> IO a #

apply a given RepoJob to a repository in the current working directory

withRepositoryLocation :: UseCache -> String -> RepoJob a -> IO a #

apply a given RepoJob to a repository in a given url

checkRepoIsNoRebase :: forall rt p wR wU wT. IsRepoType rt => Repository rt p wR wU wT -> Maybe (Repository ('RepoType 'NoRebase) p wR wU wT) #

If the `RepoType` of the given repo indicates that we have `NoRebase`, then `Just` the repo with the refined type, else `Nothing`. NB The amount of types we have to import to make this simple check is ridiculous!

withUMaskFlag :: UMask -> IO a -> IO a #