bugbug icon indicating copy to clipboard operation
bugbug copied to clipboard

[code_review] In SearchfoxAPI class, get sources directly from Searchfox

Open marco-c opened this issue 1 year ago • 0 comments

Since we search functions on "tip" in Searchfox (at least currently) and then get the contents at "commit_hash" (https://github.com/mozilla/bugbug/blob/8697b2c257d0d73184521355535b43eadbfb05c6/bugbug/code_search/searchfox_api.py#L142-L147), sometimes we might have conflicts (especially when analyzing patches based on old commits).

For example, I was running the tool on a revision, and it wanted to know the "ShouldNotProcessUpdatesReasonAsString" function.

We found in on Searchfox at line 4537, but on tip the function moved a bit to line 4525 (https://hg.mozilla.org/mozilla-unified/file/cfc17f0426dd014004b062e7814369bb05a30087/toolkit/xre/nsAppRunner.cpp#l4525).

Instead of getting function lines from Searchfox and source contents from hgmo, we could just get everything from Searchfox (we have the data in the page anyway!).

marco-c avatar Feb 10 '25 17:02 marco-c