// TrackBranch mocks base method
485247
func (m *MockTrackBranchCommandAPI) TrackBranch(arg0 string, arg1 []string) error {
	ret := m.ctrl.Call(m, "TrackBranch", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
950836
func (s *GetBranchOutput) SetBranch(v *Branch) *GetBranchOutput {
	s.Branch = v
	return s
}
1226
func (s *SubDomainSetting) SetBranchName(v string) *SubDomainSetting {
	s.BranchName = &v
	return s
}
602180
func (s *CreateBranchOutput) SetBranch(v *Branch) *CreateBranchOutput {
	s.Branch = v
	return s
}
643224
func (s *Webhook) SetBranchFilter(v string) *Webhook {
	s.BranchFilter = &v
	return s
}
226761
func (nsPayloads_) trackOp(payloads mongo.Collection, doc payloadDoc) (txn.Op, error) {
	docID := nsPayloads.docID(doc.UnitID, doc.Name)
	payloadOp := txn.Op{
		C:  payloads.Name(),
		Id: docID,
	}
	count, err := payloads.FindId(docID).Count()
	if err != nil {
		return txn.Op{}, errors.Trace(err)
	} else if count == 0 {
		payloadOp.Assert = txn.DocMissing
		payloadOp.Insert = doc
	} else {
		payloadOp.Assert = txn.DocExists
		payloadOp.Update = bson.D{{"$set", doc}}
	}
	return payloadOp, nil
}
9654
func (m *MockModel) AddBranch(arg0, arg1 string) error {
	ret := m.ctrl.Call(m, "AddBranch", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
1108177
func TrackDuration(f func() error) (time.Duration, error) {
	ts := timeNow()
	err := f()
	d := timeNow().Sub(ts)
	return d, err
}
1158435
func (s *RepositoryMetadata) SetDefaultBranch(v string) *RepositoryMetadata {
	s.DefaultBranch = &v
	return s
}
818535
func (s *ListJobsInput) SetBranchName(v string) *ListJobsInput {
	s.BranchName = &v
	return s
}
576372
func (repo *Repository) GetRemoteBranchCommit(name string) (*Commit, error) {
	commitID, err := repo.GetRemoteBranchCommitID(name)
	if err != nil {
		return nil, err
	}
	return repo.GetCommit(commitID)
}
161657
func (c *Client) TrackBranch(branchName string, entities []string) error {
	var result params.ErrorResults
	arg := params.BranchTrackArg{
		BranchName: branchName,
	}
	if len(entities) == 0 {
		return errors.New("no units or applications specified")
	}
	for _, entity := range entities {
		switch {
		case names.IsValidApplication(entity):
			arg.Entities = append(arg.Entities,
				params.Entity{Tag: names.NewApplicationTag(entity).String()})
		case names.IsValidUnit(entity):
			arg.Entities = append(arg.Entities,
				params.Entity{Tag: names.NewUnitTag(entity).String()})
		default:
			return errors.Errorf("%q is not an application or a unit", entity)
		}
	}
	err := c.facade.FacadeCall("TrackBranch", arg, &result)
	if err != nil {
		return errors.Trace(err)
	}

	if err := result.Combine(); err != nil {
		return errors.Trace(err)
	}
	return nil
}
16733
func (c *ModelCommandBase) ActiveBranch() (string, error) {
	if c._activeBranch != "" {
		return c._activeBranch, nil
	}
	// If we need to look up the model generation, we need to ensure we
	// have access to the model details.
	if err := c.maybeInitModel(); err != nil {
		return "", errors.Trace(err)
	}
	details, err := c.store.ModelByName(c._controllerName, c._modelName)
	if err != nil {
		if !c.runStarted {
			return "", errors.Trace(err)
		}
		details, err = c.modelDetails(c._controllerName, c._modelName)
		if err != nil {
			return "", errors.Trace(err)
		}
	}
	c._activeBranch = details.ActiveBranch
	return c._activeBranch, nil
}
1198582
func (r *runner) trackPeekN(i int) int {
	return r.runtrack[r.runtrackpos-i-1]
}
594032
func ValidateBranchName(name string) error {
	if name == "" {
		return errors.NotValidf("empty branch name")
	}
	if name == GenerationMaster {
		return errors.NotValidf("branch name %q", GenerationMaster)
	}
	return nil
}
1005829
func (ndb *nodeDB) SaveBranch(node *Node) []byte {
	if node.persisted {
		return node.hash
	}

	if node.leftNode != nil {
		node.leftHash = ndb.SaveBranch(node.leftNode)
	}
	if node.rightNode != nil {
		node.rightHash = ndb.SaveBranch(node.rightNode)
	}

	node._hash()
	ndb.SaveNode(node)

	node.leftNode = nil
	node.rightNode = nil

	return node.hash
}
1105594
func (c *Configuration) RemoteForBranch(localBranch string) string {
	return c.Find(fmt.Sprintf("branch.%s.remote", localBranch))
}