-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Wire meta.DB through codebase #94
refactor: Wire meta.DB through codebase #94
Conversation
Current Aviator status
This PR was merged using Aviator. Stack
|
internal/meta/branchstate.go
Outdated
} | ||
return base, nil | ||
} | ||
//// BaseCommit determines the base commit for the given branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the intention for this comment out?
internal/meta/branch.go
Outdated
func branchMetaRefName(branchName string) string { | ||
return branchMetaRefPrefix + branchName | ||
} | ||
//func FindStackRoot(branches map[string]Branch, name string) (Branch, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the intention for the comment out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just forgot to delete the function after deleting its usages. My bad!
cmd/av/stack_tree.go
Outdated
if err != nil { | ||
return err | ||
} | ||
tx := db.WriteTx() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be ReadTx.
if err != nil { | ||
return err | ||
} | ||
tx := db.WriteTx() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be committed.
if err := meta.WriteBranch(repo, *br); err != nil { | ||
return err | ||
} | ||
tx.SetBranch(*br) | ||
} | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, you want to cancel cu
here. But if we change the Abort to be called even after Commit (like I commented in the other PR), we can omit the cancel.
@@ -316,6 +323,9 @@ base branch. | |||
if err := writeStackSyncState(repo, nil); err != nil { | |||
return errors.Wrap(err, "failed to write stack sync state") | |||
} | |||
if err := tx.Commit(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we need to cancel cu
every time we call Commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just cancelled this to always defer tx.Abort()
.
Parent: meta.BranchState{ | ||
Name: parentBranchName, | ||
Trunk: isBranchFromTrunk, | ||
Head: parentHead, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
cmd/av/pr.go
Outdated
tx := db.WriteTx() | ||
var cu cleanup.Cleanup | ||
defer cu.Cleanup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit and cancel.
This pull request failed to merge: top queued PR in the stack failed to merge. Remove the |
5718042
to
68f461b
Compare
25938f5
to
253fb67
Compare
This is obviously a pretty big change. Want to test it decently thoroughly and possibly add some more e2e type tests.
Next PR in stack will implement the import existing metadata from refs functionality.