@@ -28,18 +28,21 @@ data TransactionIdHeadBacktrack = TransactionIdHeadParentBacktrack Int | -- git
2828 TransactionIdHeadBranchBacktrack Int -- git ^: walk back one parent level to the nth arbitrarily-chosen parent
2929 deriving (Show, Eq, Binary, Generic)
3030
31−data CommitOption = AllowEmptyCommitOption | -- allow empty commit and add it to the graph
31+data EmptyCommitOption = AllowEmptyCommitOption | -- allow empty commit and add it to the graph
3232 ForbidEmptyCommitOption | --return error on empty commit- probably the safest option
3333 IgnoreEmptyCommitOption -- don't add the commit and don't add it to the graph (no-op)
3434 deriving (Eq, Show, Binary, Generic)
35−
35+
36+data MergeCommitOption = NoMergeCommitOption | --no special handling
37+ AutoMergeToHeadCommitOption -- branch, merge to current branch, commit- all-in-one in order to take advantage of atomic STM
38+
3639--operators which manipulate a transaction graph
3740data TransactionGraphOperator = JumpToHead HeadName |
3841 JumpToTransaction TransactionId |
3942 Branch HeadName |
4043 DeleteBranch HeadName |
4144 MergeTransactions MergeStrategy HeadName HeadName |
42− Commit CommitOption |
45+ Commit EmptyCommitOption MergeCommitOption |
4346 Rollback
4447 deriving (Eq, Show, Binary, Generic)
4548
@@ -229,6 +232,14 @@ evalGraphOp newId (DisconnectedTransaction parentId schemas' _) graph (Branch ne
229232 Left err -> Left err
230233 Right (_, newGraph) -> Right (newDiscon, newGraph)
231234
235+--a version of commit which adds the discon to a temporary branch and attempts to merge it to the head and commit it- deletes the merge branch so that the newTransId appears to be for a fast-forwardded commit
236+--this emulates a rebase based on the transaction merge code
237+evalGraphOp newTransId discon@(DisconnectedTransaction parentId schema' _) graph cmd@(Commit _ AutoMergeToHeadOption) = do
238+ parentTrans <- transactionForId parentId graph
239+ let tempBranchName = "mergebranch_" <> U.toText newTransId
240+ evalGraphOp ? (Branch "junk
241+
242+
232243-- add the disconnected transaction to the graph
233244-- affects graph and disconnectedtransaction- the new disconnectedtransaction's parent is the freshly committed transaction
234245evalGraphOp newTransId discon@(DisconnectedTransaction parentId schemas' _) graph (Commit _) = case transactionForId parentId graph of