Documentation ¶
Index ¶
- func CheckoutUniqueBranch(git gateway.Git, prefix, ref string) (name string, err error)
- type BulkRebaser
- type Gateway
- func (g *Gateway) Checkout(name string) error
- func (g *Gateway) CreateBranch(name, head string) error
- func (g *Gateway) CreateBranchAndCheckout(name, head string) error
- func (g *Gateway) CurrentBranch() (string, error)
- func (g *Gateway) DeleteBranch(name string) error
- func (g *Gateway) DeleteRemoteTrackingBranch(remote, name string) error
- func (g *Gateway) DoesBranchExist(name string) bool
- func (g *Gateway) Fetch(req *gateway.FetchRequest) error
- func (g *Gateway) Pull(remote, name string) error
- func (g *Gateway) Push(req *gateway.PushRequest) error
- func (g *Gateway) Rebase(req *gateway.RebaseRequest) error
- func (g *Gateway) RemoteURL(name string) (string, error)
- func (g *Gateway) ResetBranch(branch, head string) error
- func (g *Gateway) SHA1(ref string) (string, error)
- type RebaseHandle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BulkRebaser ¶ added in v0.5.0
type BulkRebaser struct {
// contains filtered or unexported fields
}
BulkRebaser rebases multiple interdependent branches in a safe way. No changes are made to existing branches. Callers can commit changes by retrieving information from RebaseHandles.
r := NewBulkRebaser(g) defer r.Cleanup() h := r.Onto("origin/master").Rebase("master", "myfeature") if err := r.Err(); err != nil { return err } g.ResetBranch("myfeature", h.Base())
func NewBulkRebaser ¶ added in v0.5.0
func NewBulkRebaser(g gateway.Git) *BulkRebaser
NewBulkRebaser builds a new Bulk Rebaser.
func (*BulkRebaser) Cleanup ¶ added in v0.5.0
func (br *BulkRebaser) Cleanup() (err error)
Cleanup deletes temporary branches created by the rebaser. The BulkRebaser ceases to be valid after this function has been called. No other operations must be made on the BulkRebaser after this function has been called.
func (*BulkRebaser) Err ¶ added in v0.5.0
func (br *BulkRebaser) Err() error
Err returns a non-nil value if any of the operations on BulkRebaser failed.
Failures encountered during Cleanup are not recorded here.
func (*BulkRebaser) Onto ¶ added in v0.5.0
func (br *BulkRebaser) Onto(ref string) RebaseHandle
Onto starts a new rebase onto the given base. Rebase calls on the returned object will be onto the given ref as base.
For example, the following,
rebaser.Onto("master").Rebase("oldfeature", "newfeature")
Is roughly equivalent to,
git rebase --onto master oldfeature newfeature
This function MUST NOT be called after Cleanup.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway is a git gateway.
func NewGateway ¶
NewGateway builds a new Git gateway.
func (*Gateway) CreateBranch ¶
CreateBranch creates a branch with the given name and head but does not check it out.
func (*Gateway) CreateBranchAndCheckout ¶ added in v0.5.0
CreateBranchAndCheckout creates a branch with the given name and head and switches to it.
func (*Gateway) CurrentBranch ¶
CurrentBranch determines the current branch name.
func (*Gateway) DeleteBranch ¶
DeleteBranch deletes the given branch.
func (*Gateway) DeleteRemoteTrackingBranch ¶
DeleteRemoteTrackingBranch deletes the remote tracking branch with the given name.
func (*Gateway) DoesBranchExist ¶
DoesBranchExist checks if this branch exists locally.
func (*Gateway) Push ¶
func (g *Gateway) Push(req *gateway.PushRequest) error
Push pushes refs to a remote.
func (*Gateway) Rebase ¶ added in v0.2.1
func (g *Gateway) Rebase(req *gateway.RebaseRequest) error
Rebase a branch.
func (*Gateway) ResetBranch ¶ added in v0.3.0
ResetBranch resets the given branch to the given head.
type RebaseHandle ¶ added in v0.5.0
type RebaseHandle interface { // Error, if any, encountered by rebase operations executed in the stack // of branches behind this handle. Err() error // Base on which this handle will rebase items. // // Empty if a prior operation failed. Base() string // Rebase requests that the given range of commits be rebased onto the // base of this RebaseHandle. // // A new RebaseHandle is returned whose base is the rebased position of // toRef. // // h := rebaser.Onto("dev").Rebase("master", "feature1") // // h.Base() may now be used to reference the rebased position of feature1, // possibly moving it to that position. // // Any Rebase calls onto the returned RebaseHandle will be against this // new base. This allows for rebasing branhes that depend on previously // rebased branches. // // For example, the following rebases the range of commits // master..feature1 onto dev and the range feature1..feature2 onto // feature1 after it has been rebased. // // rebaser.Onto("dev"). // Rebase("master", "feature1"). // Rebase("feature1", "feature2") // // This function MUST NOT be called after Cleanup. Rebase(fromRef, toRef string) RebaseHandle }
RebaseHandle is an ongoing rebase, allowing chaining on more rebase requests.