Hello, everyone!
I am writing an application, which uses Gerrit REST API. In particular it uses Get Patch (
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-patch) request, which returns a complete diff against the base revision.
During my experiments with the application it turned out, that for some changes this request reseives 409 HTTP error. I haven't found a description of such situation in the official documentation. I also haven't found any discussion regarding this problem on google.
After short analysis I noticed, that all changes, that received 409, were merges with conflicts, so the first patch set has multiple parents and o Gerrit web app this changes doesn't have a 'Base' revision. Instead of it they have 'Auto Merge', which contains source files with git markers for resolving conflicts. It makes sense, since final patch is supposed to be applied to the base revision, But since there are multiple base revisions, you have to merge it first.
It means, that for some changes Get Patch operation actually fails and the application may switch to unexpected state.
I would like to know, if there is a solution for such a problem?
For example, if you request a diff (
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-diff) you can also specify the base revision for the diff (for example you want diff for specific file between patch set 1 and 9). The only problem here, is that in patch you have all files all together. In case of diff, you have to specify filename each time.