2258: Allow to postreview read a patch from stdin without --diff-file=-

albert.*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 19, 2014
Using version 0.3.2 executing post-review in a pipe will still force the user to use --diff-file=- and act as if it was not in a pipe. That can be easily solved by detecting that post-review is being executed in a pipe.

The attached patch fixes the problem. Note that it also removes the requirement for the authentication details to be specified in the command line.

The patch is useful for us because it allows us to use all the power of 'git diff' for uploading the patches.
#1 albert.*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Updated patch.
  • +
    459,464d458
    <         if (options.diff_filename == '-' and
    <             not options.username and not options.submit_as and
    <             not options.password):
    <             die('Authentication information needs to be provided on '
    <                 'the command line when using --diff-filename=-')
    < 
    3770c3764,3773
    <         diff, parent_diff = tool.diff(args)
    ---
    >         # If post-review is executed in a pipe, behave as if diff_filename == '-'
    >         fd = sys.stdin.fileno()
    >         mode = os.fstat(fd).st_mode
    >         is_fifo = stat.S_ISFIFO( mode )
    >         if is_fifo:
    >             diff = sys.stdin.read()
    >             options.diff_filename = '-'
    >             parent_diff = None
    >         else:    
    >             diff, parent_diff = tool.diff(args)
david
#2 david
Please post this on http://reviews.reviewboard.org/
david
#3 david
  • -Type-Defect
    +Type-Enhancement
    +PendingReview
david
#4 david
  • +Component-RBTools
david
#5 david
  • +PendingReview
david
#6 david
This his bitrotted quite a bit, and never made it over to reviewboard. Closing for now.
  • -PendingReview
    +WontFix