mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:51:50 +00:00
Part of https://github.com/sourcegraph/sourcegraph/issues/62101 This PR ports the GetBehindAhead implementation from the gitserver client to the new gitserver.Backend interface. Here is the original implementation from the client for reference: ```go // GetBehindAhead returns the behind/ahead commit counts information for right vs. left (both Git // revspecs). func (c *clientImplementor) GetBehindAhead(ctx context.Context, repo api.RepoName, left, right string) (_ *gitdomain.BehindAhead, err error) { ctx, _, endObservation := c.operations.getBehindAhead.With(ctx, &err, observation.Args{ MetricLabelValues: []string{c.scope}, Attrs: []attribute.KeyValue{ repo.Attr(), attribute.String("left", left), attribute.String("right", right), }, }) defer endObservation(1, observation.Args{}) if err := checkSpecArgSafety(left); err != nil { return nil, err } if err := checkSpecArgSafety(right); err != nil { return nil, err } cmd := c.gitCommand(repo, "rev-list", "--count", "--left-right", fmt.Sprintf("%s...%s", left, right)) out, err := cmd.Output(ctx) if err != nil { return nil, err } behindAhead := strings.Split(strings.TrimSuffix(string(out), "\n"), "\t") b, err := strconv.ParseUint(behindAhead[0], 10, 0) if err != nil { return nil, err } a, err := strconv.ParseUint(behindAhead[1], 10, 0) if err != nil { return nil, err } return &gitdomain.BehindAhead{Behind: uint32(b), Ahead: uint32(a)}, nil } ``` ## Test plan New unit tests |
||
|---|---|---|
| .. | ||
| appliance | ||
| batcheshelper | ||
| blobstore | ||
| bundled-executor | ||
| cody-gateway | ||
| embeddings | ||
| executor | ||
| executor-kubernetes | ||
| frontend | ||
| gitserver | ||
| loadtest | ||
| migrator | ||
| msp-example | ||
| pings | ||
| precise-code-intel-worker | ||
| repo-updater | ||
| searcher | ||
| server | ||
| symbols | ||
| syntactic-code-intel-worker | ||
| telemetry-gateway | ||
| worker | ||
| README.md | ||
This directory contains Sourcegraph services and binaries.
When a services is added, removed, or when a service's dependencies change, update our architecture diagram.