darcs

Safe HaskellSafe-Infered

Darcs.Repository.Internal

Synopsis

Documentation

data Repository p

Constructors

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

Instances

data RepoType p

Instances

data RIO p a

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)

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) 

data RepoJob a

Constructors

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

maybeIdentifyRepository :: [DarcsFlag] -> String -> IO (IdentifyRepo p)

Tries to identify the repository in a given directory

identifyDarcsRepository :: forall p. [DarcsFlag] -> String -> IO (Repository p)

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

identifyRepositoryFor :: forall p. RepoPatch p => Repository p -> String -> IO (Repository p)

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

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) 

setTentativePending :: forall p. RepoPatch p => Repository p -> FL (PrimOf p) -> IO ()

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

withRecorded :: RepoPatch p => Repository p -> ((AbsolutePath -> IO a) -> IO a) -> (AbsolutePath -> IO a) -> IO a

withRepositoryDirectory :: forall a. [DarcsFlag] -> String -> RepoJob a -> IO a

withGutsOf :: Repository p -> IO a -> IO a

tentativelyAddToPending :: forall p. RepoPatch p => Repository p -> [DarcsFlag] -> FL (PrimOf p) -> IO ()

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.

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

Used by the commands dist and diff

optimizeInventory :: (RepoPatch p, ApplyState p ~ Tree) => Repository p -> 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.

getRepository :: RIO p (Repository p)

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 a

This the RIO equivalent of liftIO.

data MakeChanges

Instances

makeNewPending :: forall p. (RepoPatch p, ApplyState p ~ Tree) => Repository p -> FL (PrimOf p) -> IO ()

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

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