// Branch retrieves the generation with the the input branch name from the
// collection of not-yet-completed generations.
767881
func (m *Model) Branch(name string) (*Generation, error) {
	gen, err := m.st.Branch(name)
	return gen, errors.Trace(err)
}
866794
func (ini *Init) Branch(initFn func() (interface{}, error)) *Init {
	if ini == nil {
		ini = New()
	}
	return ini.add(true, initFn)
}
1251899
func (s *StopJobInput) SetBranchName(v string) *StopJobInput {
	s.BranchName = &v
	return s
}
877614
func (t Term) Branch(args ...interface{}) Term {
	return constructMethodTerm(t, "Branch", p.Term_BRANCH, args, map[string]interface{}{})
}
954553
func (t *Trie) GetBranch(entry string) *Branch {
	return t.Root.getBranch([]byte(entry))
}
1002828
func (st *State) Branches() ([]*Generation, error) {
	col, closer := st.db().GetCollection(generationsC)
	defer closer()

	var docs []generationDoc
	if err := col.Find(bson.M{"completed": 0}).All(&docs); err != nil {
		return nil, errors.Trace(err)
	}

	branches := make([]*Generation, len(docs))
	for i, d := range docs {
		branches[i] = newGeneration(st, &d)
	}
	return branches, nil
}
314738
func (p *page) branchPageElement(index uint16) *branchPageElement {
	return &((*[0x7FFFFFF]branchPageElement)(unsafe.Pointer(&p.ptr)))[index]
}
1203166
func (repo *Repository) SetDefaultBranch(name string) error {
	if version.Compare(gitVersion, "1.7.10", "<") {
		return ErrUnsupportedVersion{"1.7.10"}
	}

	_, err := NewCommand("symbolic-ref", "HEAD", BRANCH_PREFIX+name).RunInDir(repo.Path)
	return err
}
1121925
func (r *RepositoryContentFileOptions) GetBranch() string {
	if r == nil || r.Branch == nil {
		return ""
	}
	return *r.Branch
}
388704
func (c *Client) CommitBranch(branchName string) (int, error) {
	var result params.IntResult
	err := c.facade.FacadeCall("CommitBranch", argForBranch(branchName), &result)
	if err != nil {
		return 0, errors.Trace(err)
	}
	if result.Error != nil {
		return 0, errors.Trace(result.Error)
	}
	return result.Result, nil
}
846643
func (s *ProjectsService) DeleteBranch(projectName, branchID string) (*Response, error) {
	u := fmt.Sprintf("projects/%s/branches/%s", url.QueryEscape(projectName), url.QueryEscape(branchID))
	return s.client.DeleteRequest(u, nil)
}
857924
func (api *API) BranchInfo(args params.BranchInfoArgs) (params.GenerationResults, error) {
	result := params.GenerationResults{}

	isModelAdmin, err := api.hasAdminAccess()
	if err != nil {
		return result, errors.Trace(err)
	}
	if !isModelAdmin && !api.isControllerAdmin {
		return result, common.ErrPerm
	}

	// From clients, we expect a single branch name or none,
	// but we accommodate any number - they all must exist to avoid an error.
	// If no branch is supplied, get them all.
	var branches []Generation
	if len(args.BranchNames) > 0 {
		branches = make([]Generation, len(args.BranchNames))
		for i, name := range args.BranchNames {
			if branches[i], err = api.model.Branch(name); err != nil {
				return generationInfoError(err)
			}
		}
	} else {
		if branches, err = api.model.Branches(); err != nil {
			return generationInfoError(err)
		}
	}

	results := make([]params.Generation, len(branches))
	for i, b := range branches {
		if results[i], err = api.oneBranchInfo(b, args.Detailed); err != nil {
			return generationInfoError(err)
		}
	}
	result.Generations = results
	return result, nil
}
103640
func (v *TreeVertex) Clone() *TreeVertex {
	var descendants []*TreeVertex
	for _, u := range v.Descendants {
		descendants = append(descendants, u.Clone())
	}
	copy := &TreeVertex{
		Id:          v.Id,
		Descendants: descendants,
		Data:        v.Data,
	}
	return copy
}
659285
func (s *Action) GitPull(ctx context.Context, c *cli.Context) error {
	store := c.String("store")
	origin := c.Args().Get(0)
	branch := c.Args().Get(1)

	if origin == "" {
		origin = "origin"
	}
	if branch == "" {
		branch = "master"
	}
	return s.Store.GitPull(ctx, store, origin, branch)
}
980224
func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, apppath string) {
	db, err := sql.Open(dbms, connStr)
	if err != nil {
		beeLogger.Log.Fatalf("Could not connect to '%s' database using '%s': %s", dbms, connStr, err)
	}
	defer db.Close()
	if trans, ok := dbDriver[dbms]; ok {
		beeLogger.Log.Info("Analyzing database tables...")
		var tableNames []string
		if len(selectedTableNames) != 0 {
			for tableName := range selectedTableNames {
				tableNames = append(tableNames, tableName)
			}
		} else {
			tableNames = trans.GetTableNames(db)
		}
		tables := getTableObjects(tableNames, db, trans)
		mvcPath := new(MvcPath)
		mvcPath.ModelPath = path.Join(apppath, "models")
		mvcPath.ControllerPath = path.Join(apppath, "controllers")
		mvcPath.RouterPath = path.Join(apppath, "routers")
		createPaths(mode, mvcPath)
		pkgPath := getPackagePath(apppath)
		writeSourceFiles(pkgPath, tables, mode, mvcPath)
	} else {
		beeLogger.Log.Fatalf("Generating app code from '%s' database is not supported yet.", dbms)
	}
}
126127
func (c *Consumer) Source(
	genLine, genColumn int,
) (source, name string, line, column int, ok bool) {
	for i := range c.sections {
		s := &c.sections[i]
		if s.Offset.Line < genLine ||
			(s.Offset.Line+1 == genLine && s.Offset.Column <= genColumn) {
			genLine -= s.Offset.Line
			genColumn -= s.Offset.Column
			return c.source(s.Map, genLine, genColumn)
		}
	}
	return
}
834835
func (s *ProjectsService) ListBranches(projectName string, opt *BranchOptions) (*[]BranchInfo, *Response, error) {
	u := fmt.Sprintf("projects/%s/branches/", url.QueryEscape(projectName))

	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	v := new([]BranchInfo)
	resp, err := s.client.Do(req, v)
	if err != nil {
		return nil, resp, err
	}

	return v, resp, err
}