0

I have to implement reverting changes via Azure REST API, but I've got "Exactly one source for a revert must be specified." message in 400 response. Documentation is poor and I've ran out of ideas, since there is only one source in request. Any ideas?

Request:

  var bodyJson = @$"{{
                ""repository"": {{
                        ""id"": ""{_configuration.Value.RepositoryId}"",
                        ""name"": ""test_repo"",
                        ""url"": ""https://dev.azure.com/xx/yy/_apis/git/repositories/zz"",
                        ""project"": {{
                          ""id"": ""{_configuration.Value.ProjectId}"",
                          ""name"": ""xx"",
                          ""url"": ""https://dev.azure.com/xx/yy/_apis/projects/{_configuration.Value.ProjectId}"",
                          ""state"": ""wellFormed"",
                          ""revision"": {status.Pipeline.Revision}
                        }},
                ""defaultBranch"": ""refs/heads/master"",
                ""remoteUrl"": ""https://dev.azure.com/xx/yy/_git/test_repo""
              }},
              ""source"": {{
                ""commitList"": [[
                  {{
                    ""commitId"": ""commitIdWithoutDashes""
                  }}
               ]]
              }},
              ""ontoRefName"": ""refs/heads/master"",
              ""generatedRefName"": ""refs/heads/revert{DateTime.Now.Date.ToShortDateString()}""
            }}";
P3k1
  • 90
  • 9
  • Yeah, looks like your revert mechanism is stumbling upon a merge commit rather than a "regular" (one-parent) one. Then `git revert` expects a `-m ` [parameter](https://git-scm.com/docs/git-revert#Documentation/git-revert.txt--mparent-number) to be able to choose which side of the merge it tries to revert against. – Romain Valeri Jan 24 '23 at 14:33

0 Answers0