Coder Social home page Coder Social logo

junkblocker / patchreview-vim Goto Github PK

View Code? Open in Web Editor NEW
108.0 4.0 8.0 155 KB

Vim/Neovim plugin for doing single, multi-patch or diff code reviews

Home Page: http://www.vim.org/scripts/script.php?script_id=1563

Makefile 0.97% Vim Script 99.03%
patch diff viml codereview tab interface vim neovim

patchreview-vim's Introduction

patchreview.vim

The Patch Review plugin allows easy single or multipatch code or diff reviews.

It opens each affected (modified/added/deleted) file in the patch or in a version controlled workspace diff in a diff view in a separate tab.

VIM provides the :diffpatch command to do single file reviews but can not handle patch files containing multiple patches as is common with software development projects. This plugin provides that missing functionality.

It also does not pollute the workspace like :diffpatch does by writing files in the workspace.

It does automatic diff generation for various version control systems by running their respective diff commands.

(Keywords: codereview, codereviews, code review, patch, patchutils, diff, diffpatch, patchreview, patchreviews, patch review, vcs, scm, mercurial, bazaar, hg, bzr, cvs, monotone, mtn, git, perforce, fossil)

  1. Vim 7.0 or higher built with +diff option.

  2. A gnu compatible patch command installed. This is the standard patch command on any Linux, Mac OS X, *BSD, Cygwin or /usr/bin/gpatch on newer Solaris/OpenSolairs.

    For Windows, UnxUtils ( http://unxutils.sourceforge.net/ ) provides a compatible patch implementation. However, you might need to set:

    let g:patchreview_patch_needs_crlf = 1

    in your .vimrc file.

Use your favorite vim package manager to install from the github repository for the project. Examples:

" With vim-plug
Plug 'junkblocker/patchreview-vim'

" With NeoBundle
NeoBundle 'junkblocker/patchreview-vim'

" With dein.vim
call dein#add('junkblocker/patchreview-vim')

" With Vundle
Bundle 'junkblocker/patchreview-vim'
% cd ~/.vim/bundle
% git clone https://github.com/junkblocker/patchreview-vim
  1. Extract the zip from http://www.vim.org/scripts/script.php?script_id=1563 in your $HOME/.vim or $VIM/vimfiles directory and restart vim. The directory location relevant to your platform can be seen by running:

    :help add-global-plugin

    in vim.

    Alternatively, if installing from extracted form, copy the directories by hand:

    % cp -r autoload doc plugin $HOME/.vim/
  2. Generate help tags to use help

    :helptags $HOME/.vim/doc

    or, for example on Windows if you installed under $VIM/vimfiles:

    :helptags $VIM/vimfiles/doc

    etc.

  • Reviewing current changes in your workspace:

    :DiffReview
  • Reviewing staged git changes:

    :DiffReview git staged --no-color -U5
  • Reviewing a patch:

    :PatchReview some.patch
  • Reviewing a previously applied patch (AKA reverse patch review):

    :ReversePatchReview some.patch
  • See

    :h patchreview

    for usage details.

The plugin can not handle diffs/patches which change the line ending types between DOS, UNIX and Mac etc. This is a general patching problem and is not specific to this plugin.

Fork this project at https://github.com/junkblocker/patchreview-vim

patchreview-vim's People

Contributors

dlobatog avatar junkblocker avatar lutostag avatar richq avatar wilywampa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

patchreview-vim's Issues

ERROR: 1 out of 1 hunk FAILED -- saving rejects to file /tmp/v8YAN3Y/349.rej¬

I'm using Gundo to view hunks of changes in the preview window, save the buffer as a patch and try to apply a reverse patch through ReversePatchReview.

Unfortunately PatchReview fails to apply the patch and I have no '.rej' file written in /tmp.
Any idea why?

p.s.: the patch file is modified in order to include the correct filename and path.

error on running :DIffReview

Error detected while processing function patchreview#diff_review..39:
line 2:
E721: Duplicate key in Dictionary: "diff"
E15: Invalid expression: {'diff': 0, 'diff': l:diff}

subversion.vim line 15 does indeed have that dictionary on it. I'm not clear on how that's supposed to work. Maybe it worked in some older version of vim?

DiffReview does not honor patchreview_split_right setting

I have set patchreview_split_right to 1 and this work OK for the PatchReview command, but when I use DiffReview, the changes are still on the left, while I'd prefer them on the right.

Now, this could be by design (it's a "patchreview" setting after all), but in that case I'd like to see a "diffreview_split_right" setting if possible.

Thank you.

First tab does not show diff

The first tab shows the same file as the second tab, but without a diff split.

It would be nice if the first tab could show the commit message, then the files in subsequent tabs.

Support google/git-appraise reviews

I'm really excited about the possibility of this plugin working as a UI to google's distributed code review tool git-appraise. I'd like to take a look at this integration, but probably won't have time until next year.

If someone has already started working on this or wants to get started, let's talk about progress on this issue.

old/new windows are backwards

I love this tool - it makes reviewing patches so much easier. I've had an issue that's been bothering me for a while, and I'm not sure whether it's my config or an issue with the tool.

When I execute :PatchReview some-file.patch, it opens a new tab for each modified file. In each tab, though, the "before" is on the right and the "after" is on the left. For me, this is backwards from what I expect. Is this expected, or configurable? Or is it interaction with something in my config?

Thanks!

Cannot work on worktree

It doesn't work inside of an worktree.

Error detected while processing function patchreview#diff_review[55]..patchreview#get_patchfile_lines:
line 6:
E605: Exception not caught: File is not readable

Didn't detect new file correctly

It looks like patchreview-vim didn't handle new files in diff correctly. Here is an example to reproduce this issue

[ytj@localhost ~]$ mkdir repo
[ytj@localhost ~]$ cd repo
[ytj@localhost repo]$ git init
Initialized empty Git repository in /home/ytj/repo/.git/
[ytj@localhost repo]$ echo whatever > a
[ytj@localhost repo]$ git add a
[ytj@localhost repo]$ git commit -m "first"
[master (root-commit) 2be937f] first
 1 file changed, 1 insertion(+)
 create mode 100644 a
[ytj@localhost repo]$ echo hello > README
[ytj@localhost repo]$ git add README
[ytj@localhost repo]$ git commit -m "add readme"
[master 8245157] add readme
 1 file changed, 1 insertion(+)
 create mode 100644 README
[ytj@localhost repo]$ git diff HEAD^
diff --git a/README b/README
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+hello
[ytj@localhost repo]$ vim -c "DiffReview git diff HEAD^"

Basically it simply added a new file in the last commit. When I was "DiffReview git diff HEAD^" to review the diff for the last commit, I got such error:

Source directory: /home/ytj/repo
------------------
ERROR: Original file b/README does not exist.
New file        :  b/README
-----
Done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.