Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone





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.

data LoadHistory Source #

History loaded from disk. It only has CmdUpdates so you can feed them to diff.

save point

data SavePoint Source #

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.

write_save_ref :: Repo -> SavePoint -> Commit -> IO () Source #

Create a tag for the given commit.

read_last_save Source #


:: Repo 
-> Maybe.Maybe Commit

Find the last save from this commit, or HEAD if not given.

-> IO (Maybe.Maybe (SavePoint, Commit)) 


checkpoint :: User -> Repo -> SaveHistory -> IO (Either.Either Text Commit) Source #

Checkpoint the given SaveHistory. If it has no previous commit, create a new repo.

save :: 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 Source #


:: 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.



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/.


data User Source #

Git wants these fields for commits. It probably doesn't matter much what they are, but they might as well be accurate.





Show User # 


showsPrec :: Int -> User -> ShowS #

show :: User -> String #

showList :: [User] -> ShowS #

parse_names :: String -> IO [Text] Source #

Each commit saves the name of the command, so when you load it, it still has the proper name.

TODO save and parse in a more robust way