Enhance 'rbt patch' for better merging and feedback.

Review Request #6236 — Created Aug. 16, 2014 and submitted

Information

RBTools
release-0.6.x
d886cdf...

Reviewers

By default, git apply isn't very good at handling patches that don't
apply perfectly cleanly. It will just fail with an error. That means if
you attempt to apply a patch, and the underlying files have changed,
even just a little, nothing will be applied, and the user will be shown
an error.

git apply has a nice option we can use to force better behavior:
-3 (or --3way). This enables Git's merge behavior for patches, and will
also generate conflict markers. This option implies --index, so that has
been removed from the command line.

When a patch does fail to apply, partially or fully, it no longer shows
an "Unable to execute command" error. Instead, apply_patch() returns a
PatchResult, which contains the state of the patch operation, including
any list of conflicting files that could be reported, and any output
from the patch command line.

This is then shown to the user. The output shows that the patch is being
applied, then shows the patch output, and then the status as a
human-readable message. If any conflicting files were seen (Git only,
for now), those will be shown as well.

Tested with both Git and Mercurial, in all failure/success modes.

For Git, I tested with and without a list of conflicting files.

Description From Last Updated

undefined name 'PatchResult'

reviewbotreviewbot

This should probably only be run if the patch applied cleanly.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
  2. rbtools/clients/mercurial.py (Diff revision 1)
     
     
    Show all issues
     undefined name 'PatchResult'
    
  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
  2. 
      
david
  1. Bug 3389?

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

    This should probably only be run if the patch applied cleanly.

  3. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbtools/commands/patch.py
        rbtools/clients/__init__.py
        rbtools/clients/mercurial.py
        rbtools/utils/process.py
        rbtools/clients/git.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.6.x (fcdddb4)
Loading...