Commit review status from REST API

madlord's Avatar

madlord

01 Feb, 2017 03:46 AM

When i use api method "comment_commit" i see the new comment for commit with text "Status change on commit: Approved ". But in web interface "Commit status" on commit not changed. How to change review status of commit from api?

  1. Support Staff 1 Posted by Marcin Kuzminsk... on 01 Feb, 2017 09:12 AM

    Marcin Kuzminski's Avatar

    What version are you using (rhodecode, and rhodecode-api) ? I just executed a command:

    rhodecode-api --instance-name=dev changeset_comment repoid:aa-root-level-repo-1 revision:df2c6023a173d24a85a8c4cc04e6717f001fe322 status:approved message:approved
    

    and it correctly set the approval state.

  2. 2 Posted by madlord on 01 Feb, 2017 09:53 AM

    madlord's Avatar

    rhodecode: 4.5.2
    I not use rhodecode-api, i use REST API:
    http://<rc_server>/_admin/api
    {"id":1,"auth_token":"...","method":"comment_commit", "args":{"apiuser":"madlord","repoid":"...","commit_id":"8a9ab4d889db","message":"set status","status":"approved"}}'

    And i use comment_commit method, not changeset_comment. Because changeset_comment method is deprecated (https://docs.rhodecode.com/RhodeCode-Enterprise/api/methods/deprecated-methods.html#changeset-comment)

  3. Support Staff 3 Posted by Marcin Kuzminsk... on 01 Feb, 2017 10:31 AM

    Marcin Kuzminski's Avatar

    That's odd i tried also

    rhodecode-api --instance-name=dev comment_commit repoid:aa-root-level-repo-1 commit_id:df2c6023a173d24a85a8c4cc04e6717f001fe322 status:approved message:approved

    We'll investigate if there's no regression in 4.5.2, we anyway release 4.6 in next couple of days so if it's not working as expected it will be fixed !

  4. 4 Posted by madlord on 01 Feb, 2017 10:39 AM

    madlord's Avatar

    changeset_comment from REST API also not change review status in web interface.

  5. 5 Posted by madlord on 07 Feb, 2017 09:41 AM

    madlord's Avatar

    I updated RhodeCode to 4.6.0. I use this API:
    curl http://<ip>:<port>/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,
    "auth_token":"<token>","method":"comment_commit", "args":{"apiuser":"","repoid":"<repo_name>","commit_id":"<id>","message":"set status","status":"approved"}}'

    I get answer:
    {
        "id": 1,
        "error": null,
        "result": {
            "status_change": "approved",
            "success": true,
            "msg": "Commented on commit `<some_id>` for repository `<repo_name>`"
        }
    }

    I see new comment for commit_id, but in web interface "Commit status:" not changed.

  6. Support Staff 6 Posted by Marcin Kuzminsk... on 07 Feb, 2017 09:45 AM

    Marcin Kuzminski's Avatar

    maybe there are other votes on this commit preventing it being approved ? The aproval is voting, and there must be all votes to get a final review status ?

  7. 7 Posted by madlord on 07 Feb, 2017 10:09 AM

    madlord's Avatar

    Where i can see votes?

  8. Support Staff 8 Posted by Marcin Kuzminsk... on 07 Feb, 2017 11:15 AM

    Marcin Kuzminski's Avatar

    The votes are other comments. Aren't there maybe other comments made on this commits that are not approved ?

  9. 9 Posted by madlord on 08 Feb, 2017 03:01 AM

    madlord's Avatar

    Sorry, i don`t understand. I have 2 comments with approved status (see attach). But Commit status not changed. How i can change commit status from API?

  10. 10 Posted by madlord on 08 Feb, 2017 03:47 AM

    madlord's Avatar

    This is about i want to review commits, not pull request.

  11. Support Staff 11 Posted by Marcin Kuzminsk... on 08 Feb, 2017 08:11 AM

    Marcin Kuzminski's Avatar

    yes it should work like that on commits, what database are you using ?

  12. Support Staff 12 Posted by Marcin Kuzminsk... on 08 Feb, 2017 08:17 AM

    Marcin Kuzminski's Avatar

    Please consider joining our Slack community channel under https://rhodecode.com/join . Get access to our development team as well as community members always willing to help.

    Maybe we could discuss this issue, there's no way we can reproduce this and it works fine in tests, and on our test instances for postgres and sqlite

  13. 13 Posted by madlord on 08 Feb, 2017 08:28 AM

    madlord's Avatar

    We use sqlite.
    I can`t join to Slack: "There was a connection problem, please try again."

  14. 14 Posted by madlord on 08 Feb, 2017 10:13 AM

    madlord's Avatar

    Thanks for help. Reason: in commit_id param of comment_commit method need full hash (40 symbols) value. I used small hash (12 symbols).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • review.jpg 90.1 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac