6

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?

Donal Lafferty
  • 5,807
  • 7
  • 43
  • 60

3 Answers3

11

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.

Donal Lafferty
  • 5,807
  • 7
  • 43
  • 60
  • You got it. This can be a very useful tool. A note about the commit hashes: "Git is smart enough to figure out what commit you meant to type if you provide the first few characters, as long as your partial SHA-1 is at least four characters long and unambiguous — that is, only one object in the current repository begins with that partial SHA-1." (see [http://git-scm.com/book/ch6-1.html]) – Magikhead Jun 28 '13 at 14:04
  • 2
    It is very userful. It should be noted that the range doesn't include the start commit while the end commit is included, namely (, ]. – Jeff Li Oct 11 '13 at 13:48
4

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.

Yuvraj Patil
  • 7,944
  • 5
  • 56
  • 56
1

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

Alexander Oh
  • 24,223
  • 14
  • 73
  • 76