Hi Terry, You can try using rbt api-get on /review-requests/ with the commit-id=<value> query parameter, if you know the previous commit. However, it's likely this will have changed, since commit IDs aren't stable when updating code on a branch.
The in-development version of RBTools (currently 0.8, might be 1.0) stores some additional state when doing a `rbt post` containing the branch the change was posted from. This is stored in review_request.extra_data['local_branch']. We use this in `rbt status` to show the corresponding branch when looking through the review requests that are up for review. One option is to beta test this and make use of it yourself. However, you can do something very similar yourself today: 1. When posting a change using `rbt post`, pass: --field local_branch=<your determined branch> (or some other kind of identifier, if something else works better for you). 2. To determine whether to update an existing review request, iterate through all opened review requests and look for an extra_data.local_branch (or your custom identifier) field. If you see one matching what you're checking against, you can decide to update. If you don't, then you post a new one. This can look like: $ rbt api-get https://<server>/api/review-requests/ --from-user=<username> --status=pending --only-fields=id,extra_data --only-links= That will return just the ID and extra data (and a couple other little pieces of info that get added), keeping the results simple. 3. Instead of using -u, use -r <ID>, where <ID> is the ID in that result. This will be much faster than -u, and will be accurate, assuming the data you store in extra_data is enough to properly identify that review request. Hope that helps! Christian -- Christian Hammond President/CEO of Beanbag <https://www.beanbaginc.com/> Makers of Review Board <https://www.reviewboard.org/> On Wed, Jan 4, 2017 at 6:10 PM, Terry Bringazi <[email protected]> wrote: > Hello, > > I'm having a specific problem in trying to automate our use of 'rbt post' > in a git post-commit environment. Any advice or solution would be > appreciated. > > In our current workflow, developers commit and push to their own branches > prior to peer review, and then we review changes in those branches before > merging from their branches. > > I'm trying to automate calls to the rbt command for changes that have > already been made to developer branches prior to merging from those > branches. Basically, on the first 'rbt post', I want to call it without a > '-u', and for all subsequent calls for the same branch to include a '-u'. > > MY PROBLEM is, I have not yet been able to create a script that can > determine if 'rbt post' should be called with an update option '-u' or not. > > My script currently calls rbt post as follows, (Note that $RB_UPDATE is > equal to either '-u' or ''): > rbt post --api-token $RB_API_TOKEN $RB_UPDATE --guess-summary > --guess-description --branch $BRANCH --tracking-branch $PARENT_BRANCH -d -p > $commit_id > > I've found no efficient automated way to use 'rbt api-get' on > /review-requests/ to determine if rbt has any commit records for a > developer owned branch. My thinking was that if reviewboard knows about a > prior commit for the branch, then for any subsequent 'rbt post', $RB_UPDATE > should be set to '-u'. I also tried using curl over http with a GET, but > did not find the right incantation. > > Is there an efficient way to automatically determine if 'rbt post' should > be called with an update option '-u' or not? > > Does my approach for automating use of reviewboard seem reasonable, or is > there a better strategy that I should consider? > > Thank you, > > Terry L. Bringazi > > > -- > Supercharge your Review Board with Power Pack: > https://www.reviewboard.org/powerpack/ > Want us to host Review Board for you? Check out RBCommons: > https://rbcommons.com/ > Happy user? Let us know! https://www.reviewboard.org/users/ > --- > You received this message because you are subscribed to the Google Groups > "reviewboard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/ Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/ Happy user? Let us know! https://www.reviewboard.org/users/ --- You received this message because you are subscribed to the Google Groups "reviewboard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
