TouK / sputnik

Static code review for your Gerrit patchsets. Runs Checkstyle, PMD, FindBugs, Scalastyle, CodeNarc, JSLint for you!
Apache License 2.0
200 stars 118 forks source link

Fails to Gerrit fetch for cherry-picked reviews #210

Open vitas opened 4 years ago

vitas commented 4 years ago

Using new option in Gerrit global.commentOnlyChangedLines=true It fails if the commit is a cherry-pick. From log file:

Exception in thread "main" pl.touk.sputnik.connector.gerrit.GerritException: Error when retrieve modified lines at pl.touk.sputnik.connector.gerrit.GerritCommentFilter.init(GerritCommentFilter.java:51) at pl.touk.sputnik.connector.gerrit.GerritFacadeBuilder.buildCommentFilter(GerritFacadeBuilder.java:68) at pl.touk.sputnik.connector.gerrit.GerritFacadeBuilder.build(GerritFacadeBuilder.java:48) at pl.touk.sputnik.connector.ConnectorFacadeFactory.build(ConnectorFacadeFactory.java:25) at pl.touk.sputnik.Main.getConnectorFacade(Main.java:48) at pl.touk.sputnik.Main.main(Main.java:40) Caused by: com.urswolfer.gerrit.client.rest.http.HttpStatusException: Request not successful. Message: Not Found. Status-Code: 404. Content: Multiple changes found for I9b5bd093c5ae8e22142eb15563e922b0e29b56c3.

SpOOnman commented 4 years ago

@vitas can you paste your CLI options that you've used for running Sputnik? Please obfuscate them. Did you use only changeId and revisionId?

vitas commented 4 years ago

my setting work just fine. the issue is a minor and probably related to gerrit rest api client. If you cherry-pick a change in gerrit UI it also copies change-id from original commit. It is legit as both changes are in different branches, but looks like api client cannot handle that case. There is a workaround in gerrit: during cherry-pick remove change id and let generate new one

SpOOnman commented 4 years ago

I've used catch here so if Gerrit fails to fetch with 404 it won't break up.

SpOOnman commented 3 years ago

We're recently made a great progress with gerrit rest client. Please check if it is fixed with #230 and 2.6.0. release.