Automating SVN pre-commit to Review Board and then

2019-04-14 22:40发布

问题:

My objective is to use SVN pre-commit hook to post a review request directly to reviewboard instead of committing it to repository. As second step I want that on approval of a diff it should automatically go to repository.

is that possible to do ? If yes then some pointers will be appreciated. There are lots of places where configuring post-commit is explained but I could not find anything on Google.

EDIT: Trying to elaborate the problem

So recently we have done setup for review board. We did its integration with SVN using review boards post-review hook. As soon as user commits with "publish review" string it goes to review board.

Now what I want to achieve is this

1. User commits from SVN. The change instead if going into repository should go to review board in form of diff(automatically).
2. Review should be assigned to default reviewer(for starters, later may be it can be specified in commit string)
3. Reviewer will review it. On approval that diff should be committed to repository (Automatically or Manually)

回答1:

  1. You can block commits and transfer to RB with pre-commit hook (block is obvious, transfer - "if you can do it by hand - it can be automated", but more details about operation is needed for definitive answer)
  2. Commit of approved changes isn't task of hook, it will be additional independent automatic commit and this process may contains some pitfalls: you must preserve original order of commits in queue (if more than one may exist at the same time), on condition that more recent change can be approved before the previous

From my POV, commit into special branch instead of blocking commit and merge <this REV> to trunk on approval may be more robust and easy way



回答2:

@abhishek :

  • In our case, We have added a pre-commit hook script in our svn that needs the review board URL while committing. If not there, it will block you from committing.

  • Regarding the review request, i think you can do that from the pre-commit script itself. But this will definitely slow down the committing process. You can get the svn commit message and create a review request based on that. But i wont recommend this because this wont be accurate and you wont be able to elaborate your changes.

  • we have integrated Eclipse with e-reviewboard plugin which is available in git. This will allow you to create the review request just performing a right click. it will automatically upload the diff of the selected files. After this step, you can commit to svn using that review request.This way you can elaborate your changes. I think this is the best way!



回答3:

Why not we directly connect the Reviewboard Db and check for the appropriate state of a review in pre-commit hook. Thus solving the issue more clearly.