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

Safe HaskellSafe-Infered

Darcs.Repository.Internal

Synopsis

Documentation

data Repository p recordedstate unrecordedstate tentativestate Source

Constructors

Repo !String ![DarcsFlag] !RepoFormat !(RepoType p) 

Instances

Show (Repository p recordedstate unrecordedstate tentativestate) 

data RepoType p Source

Instances

data RIO p r u t t1 a Source

Repository IO monad. This monad-like datatype is responsible for sequencing IO actions that modify the tentative recorded state of the repository.

Instances

Monad (RIO p r u t t)

We have an instance of Monad so that IO actions that do not change the tentative recorded state are convenient in the IO monad.

Functor (RIO p r u t t) 

data RepoJob a Source

Constructors

RepoJob (forall p r u. (RepoPatch p, ApplyState p ~ Tree, ApplyState (PrimOf p) ~ Tree) => Repository p r u r -> IO a) 
V1Job (forall r u. Repository (Patch Prim) r u r -> IO a) 
V2Job (forall r u. Repository (RealPatch Prim) r u r -> IO a) 

maybeIdentifyRepository :: [DarcsFlag] -> String -> IO (IdentifyRepo p r u t)Source

Tries to identify the repository in a given directory

identifyDarcsRepository :: forall p r u t. [DarcsFlag] -> String -> IO (Repository p r u t)Source

identifyDarcsRepository identifies the repo at url. Warning: you have to know what kind of patches are found in that repo.

identifyRepositoryFor :: forall p r u t. RepoPatch p => Repository p r u t -> String -> IO (Repository p r u t)Source

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 r u t Source

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 r u t) 

setTentativePending :: forall p r u t x y. RepoPatch p => Repository p r u t -> FL (PrimOf p) x y -> IO ()Source

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

checkUnrecordedConflicts :: forall p t y. RepoPatch p => [DarcsFlag] -> FL (Named p) t y -> IO BoolSource

withRecorded :: RepoPatch p => Repository p r u t -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO aSource

withGutsOf :: Repository p r u t -> IO a -> IO aSource

tentativelyAddToPending :: forall p r u t x y. RepoPatch p => Repository p r u t -> [DarcsFlag] -> FL (PrimOf p) x y -> IO ()Source

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.

tentativelyReplacePatches :: forall p r u t x. (RepoPatch p, ApplyState p ~ Tree) => Repository p r u t -> Compression -> FL (PatchInfoAnd p) x t -> IO (Repository p r u t)Source

applyToWorking :: (ApplyState (PrimOf p) ~ Tree, RepoPatch p) => Repository p r u t -> [DarcsFlag] -> FL (PrimOf p) u y -> IO (Repository p r y t)Source

createPartialsPristineDirectoryTree :: (FilePathLike fp, RepoPatch p) => Repository p r u t -> [fp] -> FilePath -> IO ()Source

Used by the commands dist and diff

optimizeInventory :: (RepoPatch p, ApplyState p ~ Tree) => Repository p r u t -> IO ()Source

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.

getRepository :: RIO p r u t t (Repository p r u t)Source

Similar to the ask function of the MonadReader class. This allows actions in the RIO monad to get the current repository. FIXME: Don't export this. If we don't export this it makes it harder for arbitrary IO actions to access the repository and hence our code is easier to audit.

rIO :: IO a -> RIO p r u t t aSource

This the RIO equivalent of liftIO.

makeNewPending :: forall p r u t y. (RepoPatch p, ApplyState p ~ Tree) => Repository p r u t -> FL (PrimOf p) t y -> IO ()Source

seekRepo :: IO (Maybe (Either String ()))Source

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