Prompt user to continue when there is a uncommitted diff.

Review Request #4390 — Created Aug. 5, 2013 and discarded

Information

RBTools

Reviewers

Sometimes the user may forget to commit the change before putting a patch to revision, which end up being a empty revision, which is confusing.
This patch gives user a warning when there is a uncommitted diff by asking if he/she really wants to continue.
Test with both dirty branch and clean branch, works fine. 
Description From Last Updated

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 19 E231 missing whitespace after ':'

reviewbotreviewbot

Col: 31 E231 missing whitespace after ':'

reviewbotreviewbot

Col: 43 E231 missing whitespace after ':'

reviewbotreviewbot

Col: 25 E241 multiple spaces after ','

reviewbotreviewbot

Col: 37 E241 multiple spaces after ','

reviewbotreviewbot

Col: 18 E231 missing whitespace after ':'

reviewbotreviewbot

Col: 33 E231 missing whitespace after ':'

reviewbotreviewbot

Col: 25 E241 multiple spaces after ','

reviewbotreviewbot

Col: 16 E711 comparison to None should be 'if cond is None:'

reviewbotreviewbot

Col: 66 E502 the backslash is redundant between brackets

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

This should probably check sys.__stdin__.isatty() and just automatically make a decision without any output in the case where python is …

daviddavid

This should probably use distutils.util.strtobool instead of rolling it yourself.

daviddavid

These should still be broken up into two groups (one group for standard library modules, and one for rbtools). They …

daviddavid

Please capitalize "Invalid"

daviddavid

Please move this block to come first--there's no reason to define the prompt if we never use it.

daviddavid

raw_input will print a prompt, so this can be condensed to: choice = raw_input(question + prompt).lower()

daviddavid

Hmm. So make_diff is only defined in the git client, which means I think this will explode for anything not …

daviddavid
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. rbtools/postreview.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  3. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  4. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 19
     E231 missing whitespace after ':'
    
  5. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 31
     E231 missing whitespace after ':'
    
  6. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 43
     E231 missing whitespace after ':'
    
  7. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 25
     E241 multiple spaces after ','
    
  8. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 37
     E241 multiple spaces after ','
    
  9. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 18
     E231 missing whitespace after ':'
    
  10. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 33
     E231 missing whitespace after ':'
    
  11. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 25
     E241 multiple spaces after ','
    
  12. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 16
     E711 comparison to None should be 'if cond is None:'
    
  13. rbtools/utils/users.py (Diff revision 1)
     
     
    Show all issues
    Col: 66
     E502 the backslash is redundant between brackets
    
  14. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
YU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. rbtools/utils/users.py (Diff revision 2)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  3. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
YU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
david
  1. 
      
  2. rbtools/utils/users.py (Diff revision 3)
     
     
     
    Show all issues
    This should probably check sys.__stdin__.isatty() and just automatically make a decision without any output in the case where python is not running in an interactive terminal.
  3. rbtools/utils/users.py (Diff revision 3)
     
     
     
    Show all issues
    This should probably use distutils.util.strtobool instead of rolling it yourself.
  4. 
      
YU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
david
  1. 
      
  2. rbtools/utils/users.py (Diff revision 4)
     
     
     
     
     
     
     
    Show all issues
    These should still be broken up into two groups (one group for standard library modules, and one for rbtools). They should also be sorted alphabetically, so the distutils line should come first.
  3. rbtools/utils/users.py (Diff revision 4)
     
     
    Show all issues
    Please capitalize "Invalid"
  4. rbtools/utils/users.py (Diff revision 4)
     
     
     
     
     
     
     
    Show all issues
    Please move this block to come first--there's no reason to define the prompt if we never use it.
  5. rbtools/utils/users.py (Diff revision 4)
     
     
     
    Show all issues
    raw_input will print a prompt, so this can be condensed to:
    
    choice = raw_input(question + prompt).lower()
  6. 
      
YU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
YU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        rbtools/postreview.py
        rbtools/utils/users.py
      Ignored Files:
    
    
  2. 
      
david
  1. We'll need a similar change to the postreview.py one in rbtools/commands/post.py
  2. rbtools/postreview.py (Diff revision 6)
     
     
    Show all issues
    Hmm. So make_diff is only defined in the git client, which means I think this will explode for anything not git. Can you test with other SCMs and fix things up?
  3. 
      
YU
Review request changed
Status:
Discarded
Change Summary:
Fixed in a somewhat different way in rbtools master (66562bc).
YU
  1. Sorry....Just remember I have a pending review here 4 months agao..... Happy holiday!

  2.