sourcegraph/.vscode
Matthew Manela 814aceb46f
feat(search): Make search aware of perforce changelist id mapping (#63563)
https://linear.app/sourcegraph/issue/SPLF-116/perforce-searching-by-perforce-changelist-id

## Details
We have had requests from our customers using Perforce to be able to
search inside of a changelist id. For a commit sha we support doing this

```
context:global repo:^perforce-sgdev-org/rhia-depot-test$@345c17c` some text
```

But for perforce they want to do the same thing but with the change list
ids. Which would look like this

```
context:global repo:^perforce-sgdev-org/rhia-depot-test$@changelist/83732` some text
```

To support this, I am attempting to smartly detect when we should do a
DB round trip and look up the proper mapping. I built a simple heuristic
that is
1. Is perforce changelist mapping feature flag enabled
2. Is this a perforce repo?
3. Is the revision request a integer ?

This mapping is just a best effort, if it fails it just falls back on
current behavior.

We are doing with a syntax of `@changelist/CL_ID` instead of supporting
`@CL_ID` to future proof us. This lookup focuses on finding the mapping
in the DB but in the future we may want to pre-create these refs in the
db duing mapping of perforce CLs to git commits.

## Limitations
This works well in testing however, the repo name@changelist/rev we
return contains the sha

![image](https://github.com/sourcegraph/sourcegraph/assets/304410/a673b9bd-d11f-4b36-bd95-c21ab8a5c4af)


I investigated changing this but it would required a larger change in
resolving the stream results. While that would be nice to have, I
decided to keep this minimal for now and add that later if needed

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog
- For perforce depots, support searching within a specific changelist by
specifying a ref like `context:global repo:^repo/name$@changelist/83854`
2024-07-09 14:01:05 -04:00
..
cody.json [Cody GA Docs] Guides on Cody Capabilities — Chat, Autocomplete, Bug Fixes, Commands (#58288) 2023-12-11 09:33:02 -08:00
extensions.json reapply "switch from jest to vitest for faster, simpler tests (#57886)" (#58145) 2023-11-07 12:00:18 +02:00
launch.json Remove App from codebase (#59115) 2023-12-21 01:07:05 +01:00
settings.json feat(search): Make search aware of perforce changelist id mapping (#63563) 2024-07-09 14:01:05 -04:00
tasks.json release: drop legacy release tooling (#61220) 2024-04-09 14:29:35 -05:00