Safe Haskell | Safe-Inferred |
---|
Synopsis
- data SaveHistory = SaveHistory !Ui.State !(Maybe.Maybe Commit) [Update.UiUpdate] ![Text]
- data LoadHistory = LoadHistory !Ui.State !Commit !Update.UiDamage ![Text]
- type Repo = FilePath
- data Commit
- is_git :: FilePath -> Bool
- git_suffix :: FilePath
- data SavePoint
- set_save_tag :: Repo -> Commit -> IO (Either.Either Text SavePoint)
- write_save_ref :: Repo -> SavePoint -> Commit -> IO ()
- read_save_ref :: Repo -> SavePoint -> IO (Maybe.Maybe Commit)
- read_last_save :: Repo -> Maybe.Maybe Commit -> IO (Maybe.Maybe (SavePoint, Commit))
- ref_to_save :: Git.Ref -> Maybe.Maybe SavePoint
- checkpoint :: SaveGitT.User -> Repo -> SaveHistory -> IO (Either.Either Text Commit)
- save :: SaveGitT.User -> Repo -> Ui.State -> [Text] -> IO Commit
- should_record :: Update.UiUpdate -> Bool
- load :: Repo -> Maybe.Maybe Commit -> IO (Either.Either Text (Ui.State, Commit, [Text]))
- load_previous_history :: Repo -> Ui.State -> Commit -> IO (Either.Either Text (Maybe.Maybe LoadHistory))
- load_next_history :: Repo -> Ui.State -> Commit -> IO (Either.Either Text (Maybe.Maybe LoadHistory))
- save_views :: Repo -> Map Id.ViewId Block.View -> IO ()
- load_views :: Repo -> IO (Either.Either Text (Map Id.ViewId Block.View))
- infer_commit :: Repo -> String -> IO (Maybe.Maybe Commit)
- try :: Text -> IO a -> IO (Either.Either Text a)
- get_user :: IO (Either.Either Text SaveGitT.User)
Documentation
data SaveHistory Source #
History to be saved to disk. The updates are post-diff to know which bits of state to write, and the commit is what commit the updates are relative to, if any. If they're Nothing, then save everything.
It's very important to bundle the commit and updates together, because without the commit to know what they are relative to, the updates don't mean anything, and if they're applied on top of the wrong commit the result will be a corrupted state.
SaveHistory !Ui.State !(Maybe.Maybe Commit) [Update.UiUpdate] ![Text] |
Instances
Show SaveHistory Source # | |
Defined in Cmd.SaveGitT showsPrec :: Int -> SaveHistory -> ShowS # show :: SaveHistory -> String # showList :: [SaveHistory] -> ShowS # | |
Pretty SaveHistory Source # | |
Defined in Cmd.SaveGitT pretty :: SaveHistory -> Text Source # format :: SaveHistory -> Doc Source # formatList :: [SaveHistory] -> Doc Source # |
data LoadHistory Source #
History loaded from disk. It only has CmdUpdates so you can feed them to diff.
Instances
Show LoadHistory Source # | |
Defined in Cmd.SaveGit showsPrec :: Int -> LoadHistory -> ShowS # show :: LoadHistory -> String # showList :: [LoadHistory] -> ShowS # |
save point
Stored in reverse order as in the ref name.
set_save_tag :: Repo -> Commit -> IO (Either.Either Text SavePoint) Source #
Add a new save point tag to the given commit, unless it already has one.
read_save_ref :: Repo -> SavePoint -> IO (Maybe.Maybe Commit) Source #
:: Repo | |
-> Maybe.Maybe Commit | Find the last save from this commit, or HEAD if not given. |
-> IO (Maybe.Maybe (SavePoint, Commit)) |
save
checkpoint :: SaveGitT.User -> Repo -> SaveHistory -> IO (Either.Either Text Commit) Source #
Checkpoint the given SaveHistory. If it has no previous commit, create a new repo.
save :: SaveGitT.User -> Repo -> Ui.State -> [Text] -> IO Commit Source #
Create a new repo, or throw if it already exists.
should_record :: Update.UiUpdate -> Bool Source #
True if this update is interesting enough to record a checkpoint for.
load
:: Repo | |
-> Maybe.Maybe Commit | |
-> IO (Either.Either Text (Ui.State, Commit, [Text])) | (state, commit, name of the cmd this is a checkpoint of) |
load_previous_history :: Repo -> Ui.State -> Commit -> IO (Either.Either Text (Maybe.Maybe LoadHistory)) Source #
Try to go get the previous history entry.
load_next_history :: Repo -> Ui.State -> Commit -> IO (Either.Either Text (Maybe.Maybe LoadHistory)) Source #
Try to a commits that has this one as a parent.
views
save_views :: Repo -> Map Id.ViewId Block.View -> IO () Source #
load_views :: Repo -> IO (Either.Either Text (Map Id.ViewId Block.View)) Source #
util
infer_commit :: Repo -> String -> IO (Maybe.Maybe Commit) Source #
If a string looks like a commit hash, return the commit, otherwise look for a ref in tags/.