mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:31:48 +00:00
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  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` |
||
|---|---|---|
| .. | ||
| cody.json | ||
| extensions.json | ||
| launch.json | ||
| settings.json | ||
| tasks.json | ||