Add option to rbt patch for automatically creating a Git commit

Review Request #4865 — Created Oct. 30, 2013 and submitted

Information

RBTools
master

Reviewers

Add option to rbt patch for automatically creating a Git commit

The option -c, --commit automatically creates a commit in the current local
branch with the summary, description, bugs, testing, and author information
fetched from the review request.

Tested with a new review request using the commands 'rbt patch -c <review_request_id>' and 'rbt patch --commit <review_request_id>'.

Unit tests passed.

Description From Last Updated

You may want to add a step before 'git add' here that checks that the working directory and index are …

daviddavid

Can you do something like the following? If you'll notice, review requests created with rbt post -g will include the …

daviddavid

Clients should ideally not print anything to the console. Only commands should be printing anything. At most, a client can …

chipx86chipx86

I'd prefer to see these in the opposite order. It would also be great to list the review request URL, …

chipx86chipx86

No need for that second layer of parens.

chipx86chipx86

It looks like several steps are being done here that can generate separate exceptions. Let's keep the exception-generating calls to …

chipx86chipx86
ED
david
  1. I am so so excited about this!

  2. rbtools/clients/git.py (Diff revision 1)
     
     
     
    Show all issues

    You may want to add a step before 'git add' here that checks that the working directory and index are clean.

  3. rbtools/commands/patch.py (Diff revision 1)
     
     
    Show all issues

    Can you do something like the following? If you'll notice, review requests created with rbt post -g will include the summary again as the first line of the description.

    info = []
    
    summary = review_request.summary
    description = review_request.description
    
    if not description.startswith(summary):
        info.append(summary)
    
    info.append(description)
    
    ...
    
  4. 
      
ED
chipx86
  1. This is looking great. A few comments.

    Also, food for thought, for everyone involved. I often like to tweak the commit message a bit
    (some patches we get have descriptions that could use some work). It'd be nice to perhaps
    provide a way to commit and allow editing of the default message. git commit -C does this,
    so something like that option.

  2. rbtools/clients/git.py (Diff revision 2)
     
     
    Show all issues

    Clients should ideally not print anything to the console. Only commands should be printing anything.

    At most, a client can use logging.* functions, but that's really more useful for debugging info.

  3. rbtools/commands/patch.py (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    I'd prefer to see these in the opposite order.

    It would also be great to list the review request URL, like:

    Reviewed at http://reviews.reviewboard.org/r/4865/
    
  4. rbtools/commands/patch.py (Diff revision 2)
     
     
     
    Show all issues

    No need for that second layer of parens.

  5. rbtools/commands/patch.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    It looks like several steps are being done here that can generate separate exceptions. Let's keep the exception-generating calls to a minimum, and give them their own try/except blocks where possible.

  6. 
      
ED
ED
ED
ED
david
  1. This looks good to me, but I'd like either Christian or Steven to give it another pass before committing. I can't wait to have this feature! Nice work!

  2. 
      
chipx86
  1. Ship It!
  2. 
      
ED
Review request changed
Status:
Completed
Change Summary:
Pushed to master (999a2e0). Thanks!