'rbt stamp': Adding the review request URL to the commit message

Review Request #6623 — Created Nov. 23, 2014 and submitted — Latest diff uploaded

nicolexin
RBTools
master
cdd98e0...
rbtools, students

Add a new rbt command called 'rbt stamp' that can automatically find the review request URL for the current commit and amend the commit with the right "Reviewed at" line.

Two cases:
- By default, 'rbt stamp' will guess the review request id using the same mechanism as 'rbt post -u'. After a review request id successfully found, it then stamp the last commit message with url of the review request. If there is no matching review request, it will abort and show the error message.

  • When a '-r' option is used, 'rbt stamp' will first check if it is a valid review request id owned by user. If yes, it will stamp the last commit message with url of the review request. Otherwise, it will abort and show the error message.

In either case, a comfirmation and new commit message will be print if success.

Note:
- Currently 'rbt stamp' support git only.
- If the current directory is not clean (i.e. since last commit user has made changes), 'rbt stamp' would include any changes made after the last commit into the new commit.

Testing manually (all passed):

  1. rbt stamp guessing review request id succeed: comfirmation with new commit message (SUCCESS)
  2. rbt stamp guessing review request id failed: abort with review request message (FAIL)
  3. rbt stamp with option -r valid review request id: comfirmation with review request message (SUCCESS)
  4. rbt stamp with option -r review request not owned by user: throwa api no permission error (FAIL)
  5. rbt stamp with option -r review request not exist: throws api not exist error (FAIL)
Loading...