Question

I want to create a Review Board review from a single commit.

When I use post-review, it submits all the diffs between my repo and master.

How do I limit this to a specific commit? Or the files in a specific commit?

Was it helpful?

Solution

Turns out you need to use --revision-range with the git commits for before and after your change. E.g.

 post-review --revision-range=f17f771:f5b67e3

Notice that I'm using a truncated value for the commit numbers. Their actual values are f5b67e3978ec0348d33672ba79215fe887709bed and f17f7714f7e6c92fafb03bbfa3d7fefdb3295039. However, I got the range from a git pull, which seems to report truncated numbers.

Note: Put the more recent commit last.

OTHER TIPS

You can use following command to send a particular commit in review request

rbt post d1c631b

Note: Here d1c631b is truncated commit id not the actual commit id.

I was annoyed by having to know two commit ids. So I wrapped this into a little bash script

#!/bin/bash
# I called the file git-review

SHA=$1
shift
post-review --revision-range=$(git rev-parse $SHA^):$(git rev-parse $SHA) $*

The git rev-parse will translate any branch or tag into it's commit id. hence if you are in the repository you can do git-review HEAD -i my_reviewer

The shift operation will make sure that the refspec will not be passed twice to the command line.

NOTE: calling the file git-review has the side effect of it being visible to git and you can call then git review HEAD

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top