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

Safe Haskell | None
Language | Haskell2010

Darcs.Repository

Contents

- Recorded and unrecorded and pending.
- Index.
- Used as command arguments

Synopsis

- data Repository rt p wRecordedstate wUnrecordedstate wTentativestate
- data HashedDir
  - = HashedPristineDir
  - | HashedPatchesDir
  - | HashedInventoriesDir
- newtype Cache = Ca [CacheLoc]
- data CacheLoc = Cache {
  - cacheType :: !CacheType
  - cacheWritable :: !WritableOrNot
  - cacheSource :: !String
  }
- data WritableOrNot
  - = Writable
  - | NotWritable
- data RepoJob a
  - = RepoJob (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf 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. Repository rt (RepoPatchV2 Prim) wR wU wR -> IO a)
  - | PrimV1Job (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, PrimOf p ~ Prim) => Repository rt p wR wU wR -> IO a)
  - | RebaseAwareJob RebaseJobFlags (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wR -> IO a)
  - | RebaseJob RebaseJobFlags (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository (RepoType IsRebase) p wR wU wR -> IO a)
  - | StartRebaseJob RebaseJobFlags (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository (RepoType IsRebase) p wR wU wR -> IO a)
- maybeIdentifyRepository :: UseCache -> String -> IO (IdentifyRepo rt p wR wU wT)
- identifyRepositoryFor :: forall rt p wR wU wT vR vU vT. RepoPatch p => Repository rt p wR wU wT -> UseCache -> String -> IO (Repository rt p vR vU vT)
- withRecorded :: RepoPatch p => Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a
- withRepoLock :: DryRun -> UseCache -> UpdateWorking -> UMask -> RepoJob a -> IO a
- withRepoLockCanFail :: UseCache -> UpdateWorking -> UMask -> RepoJob () -> IO ()
- withRepository :: UseCache -> RepoJob a -> IO a
- withRepositoryDirectory :: UseCache -> String -> RepoJob a -> IO a
- writePatchSet :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => PatchSet rt p Origin wX -> UseCache -> IO (Repository rt p wR wU wT)
- findRepository :: WorkRepo -> IO (Either String ())
- amInRepository :: WorkRepo -> IO (Either String ())
- amNotInRepository :: WorkRepo -> IO (Either String ())
- amInHashedRepository :: WorkRepo -> IO (Either String ())
- replacePristine :: Repository rt p wR wU wT -> Tree IO -> IO ()
- readRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR)
- prefsUrl :: Repository rt p wR wU wT -> String
- repoPatchType :: Repository rt p wR wU wT -> PatchType rt p
- readRepoUsingSpecificInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> IO (PatchSet rt p Origin wT)
- addToPending :: (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> UpdateWorking -> FL (PrimOf p) wU wY -> IO ()
- addPendingDiffToPending :: (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> UpdateWorking -> FreeLeft (FL (PrimOf p)) -> IO ()
- 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)
- tentativelyAddToPending :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> FL (PrimOf p) wX wY -> IO ()
- readTentativeRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wT)
- data RebaseJobFlags = RebaseJobFlags {
  - rjoCompression :: Compression
  - rjoVerbosity :: Verbosity
  - rjoUpdateWorking :: UpdateWorking
  }
- withManualRebaseUpdate :: forall rt p x wR wU wT1 wT2. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => RebaseJobFlags -> Repository rt p wR wU wT1 -> (Repository rt p wR wU wT1 -> IO (Repository rt p wR wU wT2, FL (RebaseFixup p) wT2 wT1, x)) -> IO (Repository rt p wR wU wT2, x)
- tentativelyMergePatches :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> String -> AllowConflicts -> UpdateWorking -> ExternalMerge -> WantGuiPause -> Compression -> Verbosity -> Reorder -> (UseIndex, ScanKnown, DiffAlgorithm) -> FL (PatchInfoAnd rt p) wX wT -> FL (PatchInfoAnd rt p) wX wY -> IO (Sealed (FL (PrimOf p) wU))
- considerMergeToWorking :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> String -> AllowConflicts -> UpdateWorking -> ExternalMerge -> WantGuiPause -> Compression -> Verbosity -> Reorder -> (UseIndex, ScanKnown, DiffAlgorithm) -> FL (PatchInfoAnd rt p) wX wT -> FL (PatchInfoAnd rt p) wX wY -> IO (Sealed (FL (PrimOf p) wU))
- revertRepositoryChanges :: RepoPatch p => Repository rt p wR wU wT -> UpdateWorking -> IO ()
- finalizeRepositoryChanges :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> UpdateWorking -> Compression -> IO ()
- createRepository :: PatchFormat -> WithWorkingDir -> WithPatchIndex -> IO ()
- cloneRepository :: String -> String -> Verbosity -> UseCache -> CloneKind -> UMask -> RemoteDarcs -> SetScriptsExecutable -> RemoteRepos -> SetDefault -> [MatchFlag] -> RepoFormat -> WithWorkingDir -> WithPatchIndex -> Bool -> ForgetParent -> IO ()
- patchSetToRepository :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR1 wU1 wR1 -> PatchSet rt p Origin wX -> UseCache -> RemoteDarcs -> IO ()
- unrevertUrl :: Repository rt p wR wU wT -> String
- applyToWorking :: (ApplyState (PrimOf p) ~ Tree, RepoPatch p) => Repository rt p wR wU wT -> Verbosity -> FL (PrimOf p) wU wY -> IO (Repository rt p wR wY wT)
- 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 PatchSet rt p wStart wY
- type SealedPatchSet rt p wStart = Sealed (PatchSet rt p wStart)
- data PatchInfoAnd rt p wA wB
- setScriptsExecutable :: IO ()
- setScriptsExecutablePatches :: PatchInspect p => p wX wY -> IO ()
- checkUnrelatedRepos :: RepoPatch p => Bool -> PatchSet rt p wStart wX -> PatchSet rt p wStart wY -> IO ()
- testTentative :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> RunTest -> LeaveTestDir -> SetScriptsExecutable -> Verbosity -> IO ExitCode
- modifyCache :: forall rt p wR wU wT. RepoPatch p => Repository rt p wR wU wT -> (Cache -> Cache) -> Repository rt p wR wU wT
- reportBadSources :: IO ()
- readRecorded :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (Tree IO)
- readUnrecorded :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Maybe [SubPath] -> IO (Tree IO)
- unrecordedChanges :: forall rt p wR wU wT. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => (UseIndex, ScanKnown, DiffAlgorithm) -> Repository rt p wR wU wT -> Maybe [SubPath] -> IO (FL (PrimOf p) wT wU)
- unrecordedChangesWithPatches :: forall rt p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => FL (PrimOf p) wX wT -> FL (PrimOf p) wT wT -> (UseIndex, ScanKnown, DiffAlgorithm) -> Repository rt p wR wU wT -> Maybe [SubPath] -> IO (FL (PrimOf p) wT wU)
- filterOutConflicts :: (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => RL (PatchInfoAnd rt p) wX wT -> Repository rt p wR wU wT -> FL (PatchInfoAnd rt p) wX wZ -> IO (Bool, Sealed (FL (PatchInfoAnd rt p) wX))
- readPending :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (Tree IO, Sealed (FL p wT))
- readRecordedAndPending :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (Tree IO)
- readIndex :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO Index
- invalidateIndex :: t -> IO ()
- listFiles :: Bool -> IO [String]
- listRegisteredFiles :: IO [String]
- listUnregisteredFiles :: Bool -> IO [String]

# Documentation

data Repository rt 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.

Instances

Show (Repository rt p wRecordedstate wUnrecordedstate wTentativestate) # |
Methods showsPrec :: Int -> Repository rt p wRecordedstate wUnrecordedstate wTentativestate -> ShowS # show :: Repository rt p wRecordedstate wUnrecordedstate wTentativestate -> String # showList :: [Repository rt p wRecordedstate wUnrecordedstate wTentativestate] -> ShowS #

data HashedDir #

Constructors

HashedPristineDir |
HashedPatchesDir |
HashedInventoriesDir |

newtype Cache #

Cache is an abstract type for hiding the underlying cache locations

Constructors

Ca [CacheLoc] |

Instances

Show Cache # |
Methods showsPrec :: Int -> Cache -> ShowS # show :: Cache -> String # showList :: [Cache] -> ShowS #

data CacheLoc #

Constructors

Cache |
Fields cacheType :: !CacheType cacheWritable :: !WritableOrNot cacheSource :: !String

Instances

Eq CacheLoc # |
Methods (==) :: CacheLoc -> CacheLoc -> Bool # (/=) :: CacheLoc -> CacheLoc -> Bool #
Show CacheLoc # |
Methods showsPrec :: Int -> CacheLoc -> ShowS # show :: CacheLoc -> String # showList :: [CacheLoc] -> ShowS #

data WritableOrNot #

Constructors

Writable |
NotWritable |

Instances

Eq WritableOrNot # |
Methods (==) :: WritableOrNot -> WritableOrNot -> Bool # (/=) :: WritableOrNot -> WritableOrNot -> Bool #
Show WritableOrNot # |
Methods showsPrec :: Int -> WritableOrNot -> ShowS # show :: WritableOrNot -> String # showList :: [WritableOrNot] -> ShowS #

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, ApplyState (PrimOf 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. 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, PrimOf p ~ Prim) => 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 RebaseJobFlags (forall rt p wR wU. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wR -> IO a) |
RebaseJob RebaseJobFlags (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository (RepoType IsRebase) p wR wU wR -> IO a) |
StartRebaseJob RebaseJobFlags (forall p wR wU. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository (RepoType IsRebase) p wR wU wR -> IO a) |

maybeIdentifyRepository :: UseCache -> String -> IO (IdentifyRepo rt p wR wU wT) #

Tries to identify the repository in a given directory

identifyRepositoryFor :: forall rt p wR wU wT vR vU vT. RepoPatch p => Repository rt p wR wU wT -> UseCache -> String -> IO (Repository rt 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.

withRecorded :: RepoPatch p => Repository rt p wR wU wT -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a #

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

apply a given RepoJob to a repository in the current working directory, taking a lock

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

apply a given RepoJob to a repository in the current working directory, taking a lock. If lock not takeable, do nothing.

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

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

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

apply a given RepoJob to a repository in a given url

writePatchSet :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => PatchSet rt p Origin wX -> UseCache -> IO (Repository rt p wR wU wT) #

writePatchSet is like patchSetToRepository, except that it doesn't touch the working directory or pristine cache.

findRepository :: WorkRepo -> IO (Either String ()) #

amInRepository :: WorkRepo -> IO (Either String ()) #

amNotInRepository :: WorkRepo -> IO (Either String ()) #

amInHashedRepository :: WorkRepo -> IO (Either String ()) #

replacePristine :: Repository rt p wR wU wT -> Tree IO -> IO () #

Replace the existing pristine with a new one (loaded up in a Tree object).

readRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wR) #

prefsUrl :: Repository rt p wR wU wT -> String #

repoPatchType :: Repository rt p wR wU wT -> PatchType rt p #

readRepoUsingSpecificInventory :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => String -> Repository rt p wR wU wT -> IO (PatchSet rt p Origin wT) #

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

Add a FL of patches starting from the working state to the pending patch, including as much extra context as is necessary (context meaning dependencies), by commuting the patches to be added past as much of the changes between pending and working as is possible, and including anything that doesn't commute, and the patch itself in the new pending patch.

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

Add an FL of patches started from the pending state to the pending patch. TODO: add witnesses for pending so we can make the types precise: currently the passed patch can be applied in any context, not just after pending.

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) #

tentativelyAddToPending :: forall rt p wR wU wT wX wY. RepoPatch p => Repository rt 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.

readTentativeRepo :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (PatchSet rt p Origin wT) #

data RebaseJobFlags #

Some common flags that are needed to run rebase jobs. Normally flags are captured directly by the implementation of the specific job's function, but the rebase infrastructure needs to do work on the repository directly that sometimes needs these options, so they have to be passed as part of the job definition.

Constructors

RebaseJobFlags |
Fields rjoCompression :: Compression rjoVerbosity :: Verbosity rjoUpdateWorking :: UpdateWorking

withManualRebaseUpdate :: forall rt p x wR wU wT1 wT2. (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => RebaseJobFlags -> Repository rt p wR wU wT1 -> (Repository rt p wR wU wT1 -> IO (Repository rt p wR wU wT2, FL (RebaseFixup p) wT2 wT1, x)) -> IO (Repository rt p wR wU wT2, x) #

tentativelyMergePatches :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> String -> AllowConflicts -> UpdateWorking -> ExternalMerge -> WantGuiPause -> Compression -> Verbosity -> Reorder -> (UseIndex, ScanKnown, DiffAlgorithm) -> FL (PatchInfoAnd rt p) wX wT -> FL (PatchInfoAnd rt p) wX wY -> IO (Sealed (FL (PrimOf p) wU)) #

considerMergeToWorking :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository rt p wR wU wT -> String -> AllowConflicts -> UpdateWorking -> ExternalMerge -> WantGuiPause -> Compression -> Verbosity -> Reorder -> (UseIndex, ScanKnown, DiffAlgorithm) -> FL (PatchInfoAnd rt p) wX wT -> FL (PatchInfoAnd rt p) wX wY -> IO (Sealed (FL (PrimOf p) wU)) #

revertRepositoryChanges :: RepoPatch p => Repository rt 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.

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

createRepository :: PatchFormat -> WithWorkingDir -> WithPatchIndex -> IO () #

cloneRepository :: String -> String -> Verbosity -> UseCache -> CloneKind -> UMask -> RemoteDarcs -> SetScriptsExecutable -> RemoteRepos -> SetDefault -> [MatchFlag] -> RepoFormat -> WithWorkingDir -> WithPatchIndex -> Bool -> ForgetParent -> IO () #

patchSetToRepository :: (IsRepoType rt, RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR1 wU1 wR1 -> PatchSet rt p Origin wX -> UseCache -> RemoteDarcs -> IO () #

patchSetToRepository takes a patch set, and writes a new repository in the current directory that contains all the patches in the patch set. This function is used when 'darcs get'ing a repository with the --to-match flag.

unrevertUrl :: Repository rt p wR wU wT -> String #

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

createPristineDirectoryTree :: RepoPatch p => Repository rt 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 rt p wR wU wT -> [fp] -> FilePath -> IO () #

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 () #

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 () #

data PatchSet rt p wStart wY #

The patches in a repository are stored in chunks broken up at "clean" tags. A tag is clean if the only patches before it in the current repository ordering are ones that the tag depends on (either directly or indirectly). Each chunk is stored in a separate inventory file on disk.

A `PatchSet` represents a repo's history as the list of patches since the last clean tag, and then a list of patch lists each delimited by clean tags.

Instances

Show2 p => Show2 (PatchSet rt p) # |
Methods showDict2 :: ShowDict (PatchSet rt p wX wY) #
Show2 p => Show1 (PatchSet rt p wStart) # |
Methods showDict1 :: ShowDict (PatchSet rt p wStart wX) #
Show2 p => Show (PatchSet rt p wStart wY) # |
Methods showsPrec :: Int -> PatchSet rt p wStart wY -> ShowS # show :: PatchSet rt p wStart wY -> String # showList :: [PatchSet rt p wStart wY] -> ShowS #

type SealedPatchSet rt p wStart = Sealed (PatchSet rt p wStart) #

data PatchInfoAnd rt p wA wB #

``PatchInfoAnd` p wA wB` represents a hope we have to get a patch through its info. We're not sure we have the patch, but we know its info.

Instances

Show2 p => Show2 (PatchInfoAnd rt p) # |
Methods showDict2 :: ShowDict (PatchInfoAnd rt p wX wY) #
MyEq (PatchInfoAnd rt p) # |
Methods unsafeCompare :: PatchInfoAnd rt p wA wB -> PatchInfoAnd rt p wC wD -> Bool # (=\/=) :: PatchInfoAnd rt p wA wB -> PatchInfoAnd rt p wA wC -> EqCheck wB wC # (=/\=) :: PatchInfoAnd rt p wA wC -> PatchInfoAnd rt p wB wC -> EqCheck wA wB #
PatchListFormat (PatchInfoAnd rt p) # |
Methods patchListFormat :: ListFormat (PatchInfoAnd rt p) #
Commute p => Commute (PatchInfoAnd rt p) # |
Methods commute :: (PatchInfoAnd rt p :> PatchInfoAnd rt p) wX wY -> Maybe ((PatchInfoAnd rt p :> PatchInfoAnd rt p) wX wY) #
PatchDebug p => PatchDebug (PatchInfoAnd rt p) # |
Methods patchDebugDummy :: PatchInfoAnd rt p wX wY -> () #
PatchInspect p => PatchInspect (PatchInfoAnd rt p) # |
Methods listTouchedFiles :: PatchInfoAnd rt p wX wY -> [FilePath] # hunkMatches :: (ByteString -> Bool) -> PatchInfoAnd rt p wX wY -> Bool #
Invert p => Invert (PatchInfoAnd rt p) # |
Methods invert :: PatchInfoAnd rt p wX wY -> PatchInfoAnd rt p wY wX #
Merge p => Merge (PatchInfoAnd rt p) # |
Methods merge :: (PatchInfoAnd rt p :\/: PatchInfoAnd rt p) wX wY -> (PatchInfoAnd rt p :/\: PatchInfoAnd rt p) wX wY #
(ReadPatch p, PatchListFormat p, PrimPatchBase p, Effect p, FromPrim p, IsRepoType rt) => ReadPatch (PatchInfoAnd rt p) # |
Methods readPatch' :: ParserM m => m (Sealed (PatchInfoAnd rt p wX)) #
Apply p => Apply (PatchInfoAnd rt p) # |
Associated Types type ApplyState (PatchInfoAnd rt p :: * -> * -> *) :: (* -> *) -> * # Methods apply :: ApplyMonad (ApplyState (PatchInfoAnd rt p)) m => PatchInfoAnd rt p wX wY -> m () #
RepairToFL p => Repair (PatchInfoAnd rt p) # |
Methods applyAndTryToFix :: ApplyMonad (ApplyState (PatchInfoAnd rt p)) m => PatchInfoAnd rt p wX wY -> m (Maybe (String, PatchInfoAnd rt p wX wY)) #
(Apply p, Conflict p, CommuteNoConflicts p, IsHunk p, PatchListFormat p, PrimPatchBase p, ShowPatch p, (~) ((* -> *) -> *) (ApplyState p) Tree) => ShowPatch (PatchInfoAnd rt p) # |
Methods showNicely :: PatchInfoAnd rt p wX wY -> Doc # showContextPatch :: (Monad m, ApplyMonad (ApplyState (PatchInfoAnd rt p)) m) => PatchInfoAnd rt p wX wY -> m Doc # description :: PatchInfoAnd rt p wX wY -> Doc # summary :: PatchInfoAnd rt p wX wY -> Doc # summaryFL :: FL (PatchInfoAnd rt p) wX wY -> Doc # thing :: PatchInfoAnd rt p wX wY -> String # things :: PatchInfoAnd rt p wX wY -> String #
(PatchListFormat p, ShowPatchBasic p) => ShowPatchBasic (PatchInfoAnd rt p) # |
Methods showPatch :: PatchInfoAnd rt p wX wY -> Doc #
IsHunk (PatchInfoAnd rt p) # |
Methods isHunk :: PatchInfoAnd rt p wX wY -> Maybe (FileHunk wX wY) #
(Patchy p, (~) ((* -> *) -> *) (ApplyState p) Tree) => Patchy (PatchInfoAnd rt p) # |
PrimPatchBase p => PrimPatchBase (PatchInfoAnd rt p) # |
Associated Types type PrimOf (PatchInfoAnd rt p :: * -> * -> *) :: * -> * -> * #
Effect p => Effect (PatchInfoAnd rt p) # |
Methods effect :: PatchInfoAnd rt p wX wY -> FL (PrimOf (PatchInfoAnd rt p)) wX wY # effectRL :: PatchInfoAnd rt p wX wY -> RL (PrimOf (PatchInfoAnd rt p)) wX wY #
Show2 p => Show1 (PatchInfoAnd rt p wX) # |
Methods showDict1 :: ShowDict (PatchInfoAnd rt p wX wX) #
Show2 p => Show (PatchInfoAnd rt p wA wB) # |
Methods showsPrec :: Int -> PatchInfoAnd rt p wA wB -> ShowS # show :: PatchInfoAnd rt p wA wB -> String # showList :: [PatchInfoAnd rt p wA wB] -> ShowS #
type ApplyState (PatchInfoAnd rt p) # |
type ApplyState (PatchInfoAnd rt p) = ApplyState p
type PrimOf (PatchInfoAnd rt p) # |
type PrimOf (PatchInfoAnd rt p) = PrimOf p

setScriptsExecutable :: IO () #

setScriptsExecutablePatches :: PatchInspect p => p wX wY -> IO () #

checkUnrelatedRepos :: RepoPatch p => Bool -> PatchSet rt p wStart wX -> PatchSet rt p wStart wY -> IO () #

testTentative :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> RunTest -> LeaveTestDir -> SetScriptsExecutable -> Verbosity -> IO ExitCode #

modifyCache :: forall rt p wR wU wT. RepoPatch p => Repository rt p wR wU wT -> (Cache -> Cache) -> Repository rt p wR wU wT #

`modifyCache` `repository function` modifies the cache of `repository` with `function`, remove duplicates and sort the results with `compareByLocality`.

reportBadSources :: IO () #

Prints an error message with a list of bad caches.

# Recorded and unrecorded and pending.

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

Obtains a Tree corresponding to the "recorded" state of the repository: this is the same as the pristine cache, which is the same as the result of applying all the repository's patches to an empty directory.

readUnrecorded :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> Maybe [SubPath] -> IO (Tree IO) #

Obtains a Tree corresponding to the "unrecorded" state of the repository: the modified files of the working tree plus the "pending" patch. The optional list of paths allows to restrict the query to a subtree.

Limiting the query may be more efficient, since hashes on the uninteresting parts of the index do not need to go through an up-to-date check (which involves a relatively expensive lstat(2) per file.

unrecordedChanges :: forall rt p wR wU wT. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => (UseIndex, ScanKnown, DiffAlgorithm) -> Repository rt p wR wU wT -> Maybe [SubPath] -> IO (FL (PrimOf p) wT wU) #

For a repository and an optional list of paths (when Nothing, take everything) compute a (forward) list of prims (i.e. a patch) going from the recorded state of the repository (pristine) to the unrecorded state of the repository (the working copy + pending). When a list of paths is given, at least the files that live under any of these paths in either recorded or unrecorded will be included in the resulting patch. NB. More patches may be included in this list, eg. the full contents of the pending patch. This is usually not a problem, since selectChanges will properly filter the results anyway.

This also depends on the options given: with LookForAdds, we will include any non-boring files (i.e. also those that do not exist in the "recorded" state) in the working in the "unrecorded" state, and therefore they will show up in the patches as addfiles.

The IgnoreTimes option disables index usage completely -- for each file, we read both the unrecorded and the recorded copy and run a diff on them. This is very inefficient, although in extremely rare cases, the index could go out of sync (file is modified, index is updated and file is modified again within a single second).

unrecordedChangesWithPatches :: forall rt p wR wU wT wX. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => FL (PrimOf p) wX wT -> FL (PrimOf p) wT wT -> (UseIndex, ScanKnown, DiffAlgorithm) -> Repository rt p wR wU wT -> Maybe [SubPath] -> IO (FL (PrimOf p) wT wU) #

filterOutConflicts #

Arguments

:: (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) |
=> RL (PatchInfoAnd rt p) wX wT | Recorded patches from repository, starting from same context as the patches to filter
-> Repository rt p wR wU wT | Repository itself, used for grabbing unrecorded changes
-> FL (PatchInfoAnd rt p) wX wZ | Patches to filter
-> IO (Bool, Sealed (FL (PatchInfoAnd rt p) wX)) | (True iff any patches were removed, possibly filtered patches)

Remove any patches (+dependencies) from a sequence that conflict with the recorded or unrecorded changes in a repo

readPending :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO (Tree IO, Sealed (FL p wT)) #

Obtains a Tree corresponding to the recorded state of the repository and a pending patch to go with it. The pending patch should start at the recorded state (we even verify that it applies, and degrade to renaming pending and starting afresh if it doesn't), but we've set to say it starts at the tentative state.

Question (Eric Kow) Is this a bug? Darcs.Repository.Pending.readPending says it is

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

Obtains the same Tree as `readRecorded` would but with the additional side effect of reading/checking the pending patch.

# Index.

readIndex :: (RepoPatch p, ApplyState p ~ Tree) => Repository rt p wR wU wT -> IO Index #

invalidateIndex :: t -> IO () #

Mark the existing index as invalid. This has to be called whenever the listing of pristine changes and will cause darcs to update the index next time it tries to read it. (NB. This is about files added and removed from pristine: changes to file content in either pristine or working are handled transparently by the index reading code.)

# Used as command arguments

listFiles :: Bool -> IO [String] #

Get a list of all files and directories in the working copy, including boring files if necessary

listRegisteredFiles :: IO [String] #

`listRegisteredFiles` returns the list of all registered files in the repository.

listUnregisteredFiles :: Bool -> IO [String] #

`listUnregisteredFiles` returns the list of all non-boring unregistered files in the repository.