// GetRemoteBranchCommitID returns last commit ID string of given remote branch.
480078
func (repo *Repository) GetRemoteBranchCommitID(name string) (string, error) {
	return repo.getRefCommitID(REMOTE_PREFIX + name)
}
382187
func (g *GistCommit) GetNodeID() string {
	if g == nil || g.NodeID == nil {
		return ""
	}
	return *g.NodeID
}
441145
func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opt RawOptions) (string, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return "", nil, err
	}

	switch opt.Type {
	case Diff:
		req.Header.Set("Accept", mediaTypeV3Diff)
	case Patch:
		req.Header.Set("Accept", mediaTypeV3Patch)
	default:
		return "", nil, fmt.Errorf("unsupported raw type %d", opt.Type)
	}

	var buf bytes.Buffer
	resp, err := s.client.Do(ctx, req, &buf)
	if err != nil {
		return "", resp, err
	}

	return buf.String(), resp, nil
}
59663
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	c := new(Commit)
	resp, err := s.client.Do(ctx, req, c)
	if err != nil {
		return nil, resp, err
	}

	return c, resp, nil
}
484031
func (t *Timeline) GetCommitURL() string {
	if t == nil || t.CommitURL == nil {
		return ""
	}
	return *t.CommitURL
}
744828
func (p *PullRequest) GetCommitsURL() string {
	if p == nil || p.CommitsURL == nil {
		return ""
	}
	return *p.CommitsURL
}
289247
func GetProtectBranchesByRepoID(repoID int64) ([]*ProtectBranch, error) {
	protectBranches := make([]*ProtectBranch, 0, 2)
	return protectBranches, x.Where("repo_id = ? and protected = ?", repoID, true).Asc("name").Find(&protectBranches)
}
1098113
func (s *SubModule) SetCommitId(v string) *SubModule {
	s.CommitId = &v
	return s
}
987815
func (s *JobSummary) SetCommitId(v string) *JobSummary {
	s.CommitId = &v
	return s
}
627171
func (p *TxnPool) CommitID(id uintptr) {
	if !p.handlesUpdates() {
		return
	}

	updated := false

	// As long as we think we are holding a newer id than lastid we keep trying
	// to CAS until we see a newer id or the CAS succeeds.
	lastid := atomic.LoadUintptr(&p.lastid)
	for lastid < id {
		if atomic.CompareAndSwapUintptr(&p.lastid, lastid, id) {
			updated = true
			break
		}
		lastid = atomic.LoadUintptr(&p.lastid)
	}

	if updated && p.UpdateHandling&HandleIdle != 0 {
		// In the case where a single transaction enters and exits the pool
		// repeatedly we are actually doing a disservice to the application because
		// it will need to allocate more Txns than it would otherwise if we were to
		// terminate them. Renewing them preemptively runs the risk of wasting
		// resources.
		//
		// The questions surrounding this require more benchmarks and real world
		// experimentation.

		// NOTE:
		// If the cost of creating a goroutine here is disruptive in some way
		// it would be worth experimenting to see if sending over a channel to
		// notify a worker goroutine would improve performance or other runtime
		// characteristics.
		go p.handleIdle()
	}
}
1103534
func (s *SourceImportAuthor) GetRemoteID() string {
	if s == nil || s.RemoteID == nil {
		return ""
	}
	return *s.RemoteID
}
1204978
func (p *PushEventRepository) GetDefaultBranch() string {
	if p == nil || p.DefaultBranch == nil {
		return ""
	}
	return *p.DefaultBranch
}
298176
func (client Client) GetCommit(projectKey, repositorySlug, commitHash string) (Commit, error) {
	retry := retry.New(3, retry.DefaultBackoffFunc)

	var data []byte
	work := func() error {
		req, err := http.NewRequest("GET", fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos/%s/commits/%s", client.baseURL.String(), projectKey, repositorySlug, commitHash), nil)
		if err != nil {
			return err
		}
		req.Header.Set("Accept", "application/json")

		if client.userName != "" && client.password != "" {
			req.SetBasicAuth(client.userName, client.password)
		}

		var responseCode int
		responseCode, data, err = client.consumeResponse(req)
		if err != nil {
			return err
		}

		if responseCode != http.StatusOK {
			reason := "unhandled reason"
			switch {
			case responseCode == http.StatusBadRequest:
				reason = "Bad Request"
			case responseCode == http.StatusUnauthorized:
				reason = "Unauthorized"
			case responseCode == http.StatusNotFound:
				reason = "Not found"
			}
			return errorResponse{StatusCode: responseCode, Reason: reason}
		}
		return nil
	}

	if err := retry.Try(work); err != nil {
		return Commit{}, err
	}

	var commit Commit
	err := json.Unmarshal(data, &commit)
	return commit, err
}
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)
}
610206
func (s *ProjectsService) GetBranchContent(projectName, branchID, fileID string) (string, *Response, error) {
	u := fmt.Sprintf("projects/%s/branches/%s/files/%s/content", url.QueryEscape(projectName), url.QueryEscape(branchID), fileID)
	return getStringResponseWithoutOptions(s.client, u)
}
1144406
func (s *VPNService) GetRemoteAccessVpnByID(id string, opts ...OptionFunc) (*RemoteAccessVpn, int, error) {
	p := &ListRemoteAccessVpnsParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListRemoteAccessVpns(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.RemoteAccessVpns[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for RemoteAccessVpn UUID: %s!", id)
}