Mercurial > hg
annotate contrib/vim/patchreview.vim @ 10545:b9e4a67329cd stable
Updated contrib/vim/patchreview.* to version 0.2.1
1) adds a :DiffReview command to review code changes
in the current workspace.
2) removes the need to have patchutils (specifically filterdiff)
installed on the system by implementing patch extraction in
pure vim script.
author | Manpreet Singh <junkblocker@yahoo.com> |
---|---|
date | Wed, 24 Feb 2010 13:12:17 -0800 |
parents | 091d555653a4 |
children | 8036bc1871c2 |
rev | line source |
---|---|
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
1 " VIM plugin for doing single, multi-patch or diff code reviews {{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
2 " Home: http://www.vim.org/scripts/script.php?script_id=1563 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
3 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
4 " Version : 0.2.1 "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
5 " Author : Manpreet Singh < junkblocker@yahoo.com > |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
6 " Copyright : 2006-2010 by Manpreet Singh |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
7 " License : This file is placed in the public domain. |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
8 " No warranties express or implied. Use at your own risk. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
9 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
10 " Changelog : |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
11 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
12 " 0.2.1 - Minor temp directory autodetection logic and cleanup |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
13 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
14 " 0.2 - Removed the need for filterdiff by implemeting it in pure vim script |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
15 " - Added DiffReview command for reverse (changed repository to |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
16 " pristine state) reviews. |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
17 " (PatchReview does pristine repository to patch review) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
18 " - DiffReview does automatic detection and generation of diffs for |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
19 " various Source Control systems |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
20 " - Skip load if VIM 7.0 or higher unavailable |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
21 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
22 " 0.1 - First released |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
23 "}}} |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
24 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
25 " Documentation: "{{{ |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
26 " =========================================================================== |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
27 " This plugin allows single or multiple, patch or diff based code reviews to |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
28 " be easily done in VIM. VIM has :diffpatch command to do single file reviews |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
29 " but a) can not handle patch files containing multiple patches or b) do |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
30 " automated diff generation for various version control systems. This plugin |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
31 " attempts to provide those functionalities. It opens each changed / added or |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
32 " removed file diff in new tabs. |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
33 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
34 " Installing: |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
35 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
36 " For a quick start... |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
37 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
38 " Requirements: |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
39 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
40 " 1) VIM 7.0 or higher built with +diff option. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
41 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
42 " 2) A gnu compatible patch command installed. This is the standard patch |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
43 " command on Linux, Mac OS X, *BSD, Cygwin or /usr/bin/gpatch on newer |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
44 " Solaris. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
45 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
46 " 3) Optional (but recommended for speed) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
47 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
48 " Install patchutils ( http://cyberelk.net/tim/patchutils/ ) for your |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
49 " OS. For windows it is availble from Cygwin |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
50 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
51 " http://www.cygwin.com |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
52 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
53 " or GnuWin32 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
54 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
55 " http://gnuwin32.sourceforge.net/ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
56 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
57 " Install: |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
58 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
59 " 1) Extract the zip in your $HOME/.vim or $VIM/vimfiles directory and |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
60 " restart vim. The directory location relevant to your platform can be |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
61 " seen by running :help add-global-plugin in vim. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
62 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
63 " 2) Restart vim. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
64 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
65 " Configuration: |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
66 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
67 " Optionally, specify the locations to these filterdiff and patch commands |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
68 " and location of a temporary directory to use in your .vimrc. |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
69 " |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
70 " let g:patchreview_patch = '/path/to/gnu/patch' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
71 " let g:patchreview_tmpdir = '/tmp/or/something' |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
72 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
73 " " If you are using filterdiff |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
74 " let g:patchreview_filterdiff = '/path/to/filterdiff' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
75 " |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
76 " |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
77 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
78 " Usage: |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
79 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
80 " Please see :help patchreview or :help diffreview for details. |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
81 " |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
82 ""}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
83 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
84 " Enabled only during development |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
85 " unlet! g:loaded_patchreview " DEBUG |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
86 " unlet! g:patchreview_tmpdir " DEBUG |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
87 " unlet! g:patchreview_patch " DEBUG |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
88 " unlet! g:patchreview_filterdiff " DEBUG |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
89 " let g:patchreview_patch = 'patch' " DEBUG |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
90 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
91 if v:version < 700 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
92 finish |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
93 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
94 if ! has('diff') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
95 call confirm('patchreview.vim plugin needs (G)VIM built with +diff support to work.') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
96 finish |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
97 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
98 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
99 " load only once |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
100 if (! exists('g:patchreview_debug') && exists('g:loaded_patchreview')) || &compatible |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
101 finish |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
102 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
103 let g:loaded_patchreview="0.2.1" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
104 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
105 let s:msgbufname = '-PatchReviewMessages-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
106 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
107 function! <SID>Debug(str) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
108 if exists('g:patchreview_debug') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
109 Pecho 'DEBUG: ' . a:str |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
110 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
111 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
112 command! -nargs=+ -complete=expression Debug call s:Debug(<args>) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
113 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
114 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
115 function! <SID>PR_wipeMsgBuf() "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
116 let winnum = bufwinnr(s:msgbufname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
117 if winnum != -1 " If the window is already open, jump to it |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
118 let cur_winnr = winnr() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
119 if winnr() != winnum |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
120 exe winnum . 'wincmd w' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
121 exe 'bw' |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
122 exe cur_winnr . 'wincmd w' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
123 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
124 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
125 endfunction |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
126 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
127 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
128 function! <SID>Pecho(...) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
129 " Usage: Pecho(msg, [return_to_original_window_flag]) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
130 " default return_to_original_window_flag = 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
131 " |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
132 let cur_winnr = winnr() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
133 let winnum = bufwinnr(s:msgbufname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
134 if winnum != -1 " If the window is already open, jump to it |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
135 if winnr() != winnum |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
136 exe winnum . 'wincmd w' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
137 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
138 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
139 let bufnum = bufnr(s:msgbufname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
140 if bufnum == -1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
141 let wcmd = s:msgbufname |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
142 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
143 let wcmd = '+buffer' . bufnum |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
144 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
145 exe 'silent! botright 5split ' . wcmd |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
146 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
147 setlocal modifiable |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
148 setlocal buftype=nofile |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
149 setlocal bufhidden=delete |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
150 setlocal noswapfile |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
151 setlocal nowrap |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
152 setlocal nobuflisted |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
153 if a:0 != 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
154 silent! $put =a:1 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
155 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
156 exe ':$' |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
157 setlocal nomodifiable |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
158 if a:0 > 1 && a:2 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
159 exe cur_winnr . 'wincmd w' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
160 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
161 endfunction |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
162 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
163 command! -nargs=+ -complete=expression Pecho call s:Pecho(<args>) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
164 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
165 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
166 function! <SID>PR_checkBinary(BinaryName) "{{{ |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
167 " Verify that BinaryName is specified or available |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
168 if ! exists('g:patchreview_' . a:BinaryName) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
169 if executable(a:BinaryName) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
170 let g:patchreview_{a:BinaryName} = a:BinaryName |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
171 return 1 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
172 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
173 Pecho 'g:patchreview_' . a:BinaryName . ' is not defined and ' . a:BinaryName . ' command could not be found on path.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
174 Pecho 'Please define it in your .vimrc.' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
175 return 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
176 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
177 elseif ! executable(g:patchreview_{a:BinaryName}) |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
178 Pecho 'Specified g:patchreview_' . a:BinaryName . ' [' . g:patchreview_{a:BinaryName} . '] is not executable.' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
179 return 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
180 else |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
181 return 1 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
182 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
183 endfunction |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
184 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
185 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
186 function! <SID>PR_GetTempDirLocation(Quiet) "{{{ |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
187 if exists('g:patchreview_tmpdir') |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
188 if ! isdirectory(g:patchreview_tmpdir) || ! filewritable(g:patchreview_tmpdir) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
189 if ! a:Quiet |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
190 Pecho 'Temporary directory specified by g:patchreview_tmpdir [' . g:patchreview_tmpdir . '] is not accessible.' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
191 return 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
192 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
193 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
194 elseif exists("$TMP") && isdirectory($TMP) && filewritable($TMP) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
195 let g:patchreview_tmpdir = $TMP |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
196 elseif exists("$TEMP") && isdirectory($TEMP) && filewritable($TEMP) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
197 let g:patchreview_tmpdir = $TEMP |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
198 elseif exists("$TMPDIR") && isdirectory($TMPDIR) && filewritable($TMPDIR) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
199 let g:patchreview_tmpdir = $TMPDIR |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
200 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
201 if has("unix") |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
202 if isdirectory("/tmp") |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
203 let g:patchreview_tmpdir = "/tmp" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
204 elseif isdirectory(expand("~/tmp")) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
205 let g:patchreview_tmpdir = expand("~/tmp") |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
206 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
207 elseif has("win32") |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
208 if isdirectory('c:\\tmp') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
209 let g:patchreview_tmpdir = 'c:\\tmp' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
210 elseif isdirectory('c:\\temp') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
211 let g:patchreview_tmpdir = 'c:\\temp' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
212 elseif isdirectory('c:\\windows\\temp') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
213 let g:patchreview_tmpdir = 'c:\\windows\\temp' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
214 elseif isdirectory($USERPROFILE . '\Local Settings\Temp') # NOTE : No \ issue here |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
215 let g:patchreview_tmpdir = $USERPROFILE . '\Local Settings\Temp' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
216 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
217 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
218 if !exists('g:patchreview_tmpdir') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
219 if ! a:Quiet |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
220 Pecho 'Could not figure out a temporary directory to use. Please specify g:patchreview_tmpdir in your .vimrc.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
221 endif |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
222 return 0 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
223 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
224 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
225 let g:patchreview_tmpdir = expand(g:patchreview_tmpdir, ':p') |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
226 let g:patchreview_tmpdir = g:patchreview_tmpdir . '/' |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
227 let g:patchreview_tmpdir = substitute(g:patchreview_tmpdir, '\\', '/', 'g') |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
228 let g:patchreview_tmpdir = substitute(g:patchreview_tmpdir, '/\+$', '/', '') |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
229 if has('win32') |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
230 let g:patchreview_tmpdir = substitute(g:patchreview_tmpdir, '/', '\\', 'g') |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
231 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
232 return 1 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
233 endfunction |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
234 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
235 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
236 function! <SID>ExtractDiffsNative(...) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
237 " Sets g:patches = {'reason':'', 'patch':[ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
238 " { |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
239 " 'filename': filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
240 " 'type' : '+' | '-' | '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
241 " 'content' : patch text for this file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
242 " }, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
243 " ... |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
244 " ]} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
245 let g:patches = {'reason' : '', 'patch' : []} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
246 " TODO : User pointers into lines list rather then use collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
247 if a:0 == 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
248 let g:patches['reason'] = "ExtractDiffsNative expects at least a patchfile argument" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
249 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
250 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
251 let patchfile = expand(a:1, ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
252 if a:0 > 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
253 let patch = a:2 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
254 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
255 if ! filereadable(patchfile) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
256 let g:patches['reason'] = "File " . patchfile . " is not readable" |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
257 return |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
258 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
259 unlet! filterdiffcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
260 let filterdiffcmd = '' . g:patchreview_filterdiff . ' --list -s ' . patchfile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
261 let fileslist = split(system(filterdiffcmd), '[\r\n]') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
262 for filewithchangetype in fileslist |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
263 if filewithchangetype !~ '^[!+-] ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
264 Pecho '*** Skipping review generation due to unknown change for [' . filewithchangetype . ']' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
265 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
266 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
267 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
268 unlet! this_patch |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
269 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
270 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
271 unlet! relpath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
272 let relpath = substitute(filewithchangetype, '^. ', '', '') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
273 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
274 let this_patch['filename'] = relpath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
275 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
276 if filewithchangetype =~ '^! ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
277 let this_patch['type'] = '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
278 elseif filewithchangetype =~ '^+ ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
279 let this_patch['type'] = '+' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
280 elseif filewithchangetype =~ '^- ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
281 let this_patch['type'] = '-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
282 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
283 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
284 unlet! filterdiffcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
285 let filterdiffcmd = '' . g:patchreview_filterdiff . ' -i ' . relpath . ' ' . patchfile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
286 let this_patch['content'] = split(system(filterdiffcmd), '[\n\r]') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
287 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
288 Debug "Patch collected for " . relpath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
289 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
290 endfunction |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
291 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
292 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
293 function! <SID>ExtractDiffsPureVim(...) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
294 " Sets g:patches = {'reason':'', 'patch':[ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
295 " { |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
296 " 'filename': filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
297 " 'type' : '+' | '-' | '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
298 " 'content' : patch text for this file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
299 " }, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
300 " ... |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
301 " ]} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
302 let g:patches = {'reason' : '', 'patch' : []} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
303 " TODO : User pointers into lines list rather then use collect |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
304 if a:0 == 0 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
305 let g:patches['reason'] = "ExtractDiffsPureVim expects at least a patchfile argument" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
306 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
307 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
308 let patchfile = expand(a:1, ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
309 if a:0 > 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
310 let patch = a:2 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
311 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
312 if ! filereadable(patchfile) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
313 let g:patches['reason'] = "File " . patchfile . " is not readable" |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
314 return |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
315 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
316 call s:PR_wipeMsgBuf() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
317 let collect = [] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
318 let linum = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
319 let lines = readfile(patchfile) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
320 let linescount = len(lines) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
321 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
322 while linum < linescount |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
323 let line = lines[linum] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
324 let linum += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
325 if State() == 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
326 let mat = matchlist(line, '^--- \([^\t]\+\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
327 if ! empty(mat) && mat[1] != '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
328 State 'MAYBE_UNIFIED_DIFF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
329 let p_first_file = mat[1] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
330 let collect = [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
331 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
332 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
333 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
334 let mat = matchlist(line, '^\*\*\* \([^\t]\+\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
335 if ! empty(mat) && mat[1] != '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
336 State 'MAYBE_CONTEXT_DIFF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
337 let p_first_file = mat[1] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
338 let collect = [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
339 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
340 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
341 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
342 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
343 elseif State() == 'MAYBE_CONTEXT_DIFF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
344 let mat = matchlist(line, '^--- \([^\t]\+\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
345 if empty(mat) || mat[1] == '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
346 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
347 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
348 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
349 Debug 'Back to square one ' . line() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
350 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
351 let p_second_file = mat[1] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
352 if p_first_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
353 if p_second_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
354 let g:patches['reason'] = "Malformed diff found at line " . linum |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
355 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
356 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
357 let p_type = '+' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
358 let filepath = p_second_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
359 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
360 if p_second_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
361 let p_type = '-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
362 let filepath = p_first_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
363 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
364 let p_type = '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
365 let filepath = p_first_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
366 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
367 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
368 State 'EXPECT_15_STARS' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
369 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
370 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
371 elseif State() == 'EXPECT_15_STARS' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
372 if line !~ '^*\{15}$' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
373 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
374 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
375 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
376 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
377 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
378 State 'EXPECT_CONTEXT_CHUNK_HEADER_1' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
379 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
380 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
381 elseif State() == 'EXPECT_CONTEXT_CHUNK_HEADER_1' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
382 let mat = matchlist(line, '^\*\*\* \(\d\+,\)\?\(\d\+\) \*\*\*\*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
383 if empty(mat) || mat[1] == '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
384 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
385 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
386 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
387 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
388 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
389 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
390 State 'SKIP_CONTEXT_STUFF_1' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
391 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
392 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
393 elseif State() == 'SKIP_CONTEXT_STUFF_1' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
394 if line !~ '^[ !+].*$' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
395 let mat = matchlist(line, '^--- \(\d\+\),\(\d\+\) ----$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
396 if ! empty(mat) && mat[1] != '' && mat[2] != '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
397 let goal_count = mat[2] - mat[1] + 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
398 let c_count = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
399 State 'READ_CONTEXT_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
400 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
401 Debug line . State() . " Goal count set to " . goal_count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
402 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
403 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
404 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
405 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
406 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
407 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
408 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
409 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
410 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
411 elseif State() == 'READ_CONTEXT_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
412 let c_count += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
413 if c_count == goal_count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
414 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
415 State 'BACKSLASH_OR_CRANGE_EOF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
416 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
417 else " goal not met yet |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
418 let mat = matchlist(line, '^\([\\!+ ]\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
419 if empty(mat) || mat[1] == '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
420 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
421 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
422 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
423 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
424 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
425 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
426 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
427 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
428 elseif State() == 'BACKSLASH_OR_CRANGE_EOF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
429 if line =~ '^\\ No newline.*$' " XXX: Can we go to another chunk from here?? |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
430 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
431 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
432 let this_patch['filename'] = filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
433 let this_patch['type'] = p_type |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
434 let this_patch['content'] = collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
435 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
436 Debug "Patch collected for " . filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
437 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
438 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
439 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
440 if line =~ '^\*\{15}$' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
441 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
442 State 'EXPECT_CONTEXT_CHUNK_HEADER_1' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
443 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
444 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
445 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
446 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
447 let this_patch['filename'] = filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
448 let this_patch['type'] = p_type |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
449 let this_patch['content'] = collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
450 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
451 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
452 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
453 Debug "Patch collected for " . filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
454 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
455 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
456 elseif State() == 'MAYBE_UNIFIED_DIFF' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
457 let mat = matchlist(line, '^+++ \([^\t]\+\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
458 if empty(mat) || mat[1] == '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
459 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
460 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
461 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
462 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
463 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
464 let p_second_file = mat[1] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
465 if p_first_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
466 if p_second_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
467 let g:patches['reason'] = "Malformed diff found at line " . linum |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
468 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
469 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
470 let p_type = '+' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
471 let filepath = p_second_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
472 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
473 if p_second_file == '/dev/null' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
474 let p_type = '-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
475 let filepath = p_first_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
476 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
477 let p_type = '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
478 let filepath = p_first_file |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
479 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
480 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
481 State 'EXPECT_UNIFIED_RANGE_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
482 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
483 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
484 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
485 elseif State() == 'EXPECT_UNIFIED_RANGE_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
486 let mat = matchlist(line, '^@@ -\(\d\+,\)\?\(\d\+\) +\(\d\+,\)\?\(\d\+\) @@$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
487 if ! empty(mat) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
488 let old_goal_count = mat[2] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
489 let new_goal_count = mat[4] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
490 let o_count = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
491 let n_count = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
492 Debug "Goal count set to " . old_goal_count . ', ' . new_goal_count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
493 State 'READ_UNIFIED_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
494 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
495 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
496 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
497 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
498 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
499 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
500 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
501 elseif State() == 'READ_UNIFIED_CHUNK' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
502 if o_count == old_goal_count && n_count == new_goal_count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
503 if line =~ '^\\.*$' " XXX: Can we go to another chunk from here?? |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
504 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
505 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
506 let this_patch['filename'] = filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
507 let this_patch['type'] = p_type |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
508 let this_patch['content'] = collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
509 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
510 Debug "Patch collected for " . filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
511 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
512 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
513 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
514 let mat = matchlist(line, '^@@ -\(\d\+,\)\?\(\d\+\) +\(\d\+,\)\?\(\d\+\) @@$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
515 if ! empty(mat) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
516 let old_goal_count = mat[2] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
517 let new_goal_count = mat[4] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
518 let o_count = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
519 let n_count = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
520 Debug "Goal count set to " . old_goal_count . ', ' . new_goal_count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
521 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
522 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
523 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
524 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
525 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
526 let this_patch['filename'] = filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
527 let this_patch['type'] = p_type |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
528 let this_patch['content'] = collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
529 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
530 Debug "Patch collected for " . filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
531 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
532 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
533 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
534 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
535 else " goal not met yet |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
536 let mat = matchlist(line, '^\([\\+ -]\).*$') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
537 if empty(mat) || mat[1] == '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
538 let linum -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
539 State 'START' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
540 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
541 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
542 let chr = mat[1] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
543 if chr == '+' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
544 let n_count += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
545 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
546 if chr == ' ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
547 let o_count += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
548 let n_count += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
549 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
550 if chr == '-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
551 let o_count += 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
552 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
553 let collect += [line] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
554 Debug line . State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
555 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
556 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
557 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
558 let g:patches['reason'] = "Internal error: Do not use the plugin anymore and if possible please send the diff or patch file you tried it with to Manpreet Singh <junkblocker@yahoo.com>" |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
559 return |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
560 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
561 endwhile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
562 "Pecho State() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
563 if (State() == 'READ_CONTEXT_CHUNK' && c_count == goal_count) || (State() == 'READ_UNIFIED_CHUNK' && n_count == new_goal_count && o_count == old_goal_count) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
564 let this_patch = {} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
565 let this_patch['filename'] = filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
566 let this_patch['type'] = p_type |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
567 let this_patch['content'] = collect |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
568 let g:patches['patch'] += [this_patch] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
569 Debug "Patch collected for " . filepath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
570 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
571 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
572 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
573 "}}} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
574 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
575 function! State(...) " For easy manipulation of diff extraction state "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
576 if a:0 != 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
577 let s:STATE = a:1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
578 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
579 if ! exists('s:STATE') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
580 let s:STATE = 'START' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
581 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
582 return s:STATE |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
583 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
584 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
585 com! -nargs=+ -complete=expression State call State(<args>) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
586 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
587 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
588 function! <SID>PatchReview(...) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
589 let s:save_shortmess = &shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
590 let s:save_aw = &autowrite |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
591 let s:save_awa = &autowriteall |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
592 set shortmess=aW |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
593 call s:PR_wipeMsgBuf() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
594 let s:reviewmode = 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
595 call s:_GenericReview(a:000) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
596 let &autowriteall = s:save_awa |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
597 let &autowrite = s:save_aw |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
598 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
599 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
600 "}}} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
601 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
602 function! <SID>_GenericReview(argslist) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
603 " diff mode: |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
604 " arg1 = patchfile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
605 " arg2 = strip count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
606 " patch mode: |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
607 " arg1 = patchfile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
608 " arg2 = strip count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
609 " arg3 = directory |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
610 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
611 " VIM 7+ required |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
612 if version < 700 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
613 Pecho 'This plugin needs VIM 7 or higher' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
614 return |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
615 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
616 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
617 " +diff required |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
618 if ! has('diff') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
619 Pecho 'This plugin needs VIM built with +diff feature.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
620 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
621 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
622 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
623 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
624 if s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
625 let patch_R_option = ' -t -R ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
626 elseif s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
627 let patch_R_option = '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
628 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
629 Pecho 'Fatal internal error in patchreview.vim plugin' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
630 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
631 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
632 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
633 " Check passed arguments |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
634 if len(a:argslist) == 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
635 Pecho 'PatchReview command needs at least one argument specifying a patchfile path.' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
636 return |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
637 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
638 let StripCount = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
639 if len(a:argslist) >= 1 && ((s:reviewmode == 'patch' && len(a:argslist) <= 3) || (s:reviewmode == 'diff' && len(a:argslist) == 2)) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
640 let PatchFilePath = expand(a:argslist[0], ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
641 if ! filereadable(PatchFilePath) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
642 Pecho 'File [' . PatchFilePath . '] is not accessible.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
643 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
644 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
645 if len(a:argslist) >= 2 && s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
646 let s:SrcDirectory = expand(a:argslist[1], ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
647 if ! isdirectory(s:SrcDirectory) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
648 Pecho '[' . s:SrcDirectory . '] is not a directory' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
649 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
650 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
651 try |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
652 " Command line has already escaped the path |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
653 exe 'cd ' . s:SrcDirectory |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
654 catch /^.*E344.*/ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
655 Pecho 'Could not change to directory [' . s:SrcDirectory . ']' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
656 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
657 endtry |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
658 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
659 if s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
660 " passed in by default |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
661 let StripCount = eval(a:argslist[1]) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
662 elseif s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
663 let StripCount = 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
664 " optional strip count |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
665 if len(a:argslist) == 3 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
666 let StripCount = eval(a:argslist[2]) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
667 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
668 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
669 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
670 if s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
671 Pecho 'PatchReview command needs at most three arguments: patchfile path, optional source directory path and optional strip count.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
672 elseif s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
673 Pecho 'DiffReview command accepts no arguments.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
674 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
675 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
676 endif |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
677 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
678 " Verify that patch command and temporary directory are available or specified |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
679 if ! s:PR_checkBinary('patch') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
680 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
681 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
682 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
683 let retval = s:PR_GetTempDirLocation(0) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
684 if ! retval |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
685 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
686 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
687 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
688 " Requirements met, now execute |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
689 let PatchFilePath = fnamemodify(PatchFilePath, ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
690 if s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
691 Pecho 'Patch file : ' . PatchFilePath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
692 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
693 Pecho 'Source directory: ' . getcwd() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
694 Pecho '------------------' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
695 if s:PR_checkBinary('filterdiff') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
696 Debug "Using filterdiff" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
697 call s:ExtractDiffsNative(PatchFilePath) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
698 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
699 Debug "Using own diff extraction (slower)" |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
700 call s:ExtractDiffsPureVim(PatchFilePath) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
701 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
702 for patch in g:patches['patch'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
703 if patch.type !~ '^[!+-]$' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
704 Pecho '*** Skipping review generation due to unknown change [' . patch.type . ']', 1 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
705 continue |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
706 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
707 unlet! relpath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
708 let relpath = patch.filename |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
709 " XXX: svn diff and hg diff produce different kind of outputs, one requires |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
710 " XXX: stripping but the other doesn't. We need to take care of that |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
711 let stripmore = StripCount |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
712 let StrippedRelativeFilePath = relpath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
713 while stripmore > 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
714 " strip one |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
715 let StrippedRelativeFilePath = substitute(StrippedRelativeFilePath, '^[^\\\/]\+[^\\\/]*[\\\/]' , '' , '') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
716 let stripmore -= 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
717 endwhile |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
718 if patch.type == '!' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
719 if s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
720 let msgtype = 'Patch modifies file: ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
721 elseif s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
722 let msgtype = 'File has changes: ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
723 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
724 elseif patch.type == '+' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
725 if s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
726 let msgtype = 'Patch adds file : ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
727 elseif s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
728 let msgtype = 'New file : ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
729 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
730 elseif patch.type == '-' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
731 if s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
732 let msgtype = 'Patch removes file : ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
733 elseif s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
734 let msgtype = 'Removed file : ' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
735 endif |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
736 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
737 let bufnum = bufnr(relpath) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
738 if buflisted(bufnum) && getbufvar(bufnum, '&mod') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
739 Pecho 'Old buffer for file [' . relpath . '] exists in modified state. Skipping review.', 1 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
740 continue |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
741 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
742 let tmpname = substitute(relpath, '/', '_', 'g') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
743 let tmpname = substitute(tmpname, '\\', '_', 'g') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
744 let tmpname = g:patchreview_tmpdir . 'PatchReview.' . tmpname . '.' . strftime('%Y%m%d%H%M%S') |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
745 if has('win32') |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
746 let tmpname = substitute(tmpname, '/', '\\', 'g') |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
747 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
748 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
749 " write patch for patch.filename into tmpname |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
750 call writefile(patch.content, tmpname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
751 if patch.type == '+' && s:reviewmode == 'patch' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
752 let inputfile = '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
753 let patchcmd = '!' . g:patchreview_patch . patch_R_option . ' -o "' . tmpname . '.file" "' . inputfile . '" < "' . tmpname . '"' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
754 elseif patch.type == '+' && s:reviewmode == 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
755 let inputfile = '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
756 unlet! patchcmd |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
757 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
758 let inputfile = expand(StrippedRelativeFilePath, ':p') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
759 let patchcmd = '!' . g:patchreview_patch . patch_R_option . ' -o "' . tmpname . '.file" "' . inputfile . '" < "' . tmpname . '"' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
760 endif |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
761 if exists('patchcmd') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
762 let v:errmsg = '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
763 Debug patchcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
764 silent exe patchcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
765 if v:errmsg != '' || v:shell_error |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
766 Pecho 'ERROR: Could not execute patch command.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
767 Pecho 'ERROR: ' . patchcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
768 Pecho 'ERROR: ' . v:errmsg |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
769 Pecho 'ERROR: Diff skipped.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
770 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
771 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
772 endif |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
773 let s:origtabpagenr = tabpagenr() |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
774 silent! exe 'tabedit ' . StrippedRelativeFilePath |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
775 if exists('patchcmd') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
776 silent! exe 'vert diffsplit ' . tmpname . '.file' |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
777 else |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
778 silent! exe 'vnew' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
779 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
780 if filereadable(tmpname . '.file.rej') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
781 silent! exe 'topleft 5split ' . tmpname . '.file.rej' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
782 Pecho msgtype . '*** REJECTED *** ' . relpath, 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
783 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
784 Pecho msgtype . ' ' . relpath, 1 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
785 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
786 silent! exe 'tabn ' . s:origtabpagenr |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
787 endfor |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
788 Pecho '-----' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
789 Pecho 'Done.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
790 |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
791 endfunction |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
792 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
793 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
794 function! <SID>PatchReviewCleanup() "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
795 let retval = s:PR_GetTempDirLocation(1) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
796 if retval && exists('g:patchreview_tmpdir') && isdirectory(g:patchreview_tmpdir) && filewritable(g:patchreview_tmpdir) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
797 let zefilestr = globpath(g:patchreview_tmpdir, 'PatchReview.*') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
798 let fileslist = split(zefilestr, '\m[\r\n]\+') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
799 for thefile in fileslist |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
800 call delete(thefile) |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
801 endfor |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
802 endif |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
803 endfunction |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
804 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
805 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
806 function! <SID>DiffReview(...) "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
807 let s:save_shortmess = &shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
808 set shortmess=aW |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
809 call s:PR_wipeMsgBuf() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
810 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
811 let vcsdict = { |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
812 \'Mercurial' : {'dir' : '.hg', 'binary' : 'hg', 'diffargs' : 'diff' , 'strip' : 1}, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
813 \'Bazaar-NG' : {'dir' : '.bzr', 'binary' : 'bzr', 'diffargs' : 'diff' , 'strip' : 0}, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
814 \'monotone' : {'dir' : '_MTN', 'binary' : 'mtn', 'diffargs' : 'diff --unified', 'strip' : 0}, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
815 \'Subversion' : {'dir' : '.svn', 'binary' : 'svn', 'diffargs' : 'diff' , 'strip' : 0}, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
816 \'cvs' : {'dir' : 'CVS', 'binary' : 'cvs', 'diffargs' : '-q diff -u' , 'strip' : 0}, |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
817 \} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
818 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
819 unlet! s:theDiffCmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
820 unlet! l:vcs |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
821 if ! exists('g:patchreview_diffcmd') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
822 for key in keys(vcsdict) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
823 if isdirectory(vcsdict[key]['dir']) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
824 if ! s:PR_checkBinary(vcsdict[key]['binary']) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
825 Pecho 'Current directory looks like a ' . vcsdict[key] . ' repository but ' . vcsdist[key]['binary'] . ' command was not found on path.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
826 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
827 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
828 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
829 let s:theDiffCmd = vcsdict[key]['binary'] . ' ' . vcsdict[key]['diffargs'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
830 let strip = vcsdict[key]['strip'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
831 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
832 Pecho 'Using [' . s:theDiffCmd . '] to generate diffs for this ' . key . ' review.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
833 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
834 let l:vcs = vcsdict[key]['binary'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
835 break |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
836 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
837 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
838 continue |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
839 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
840 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
841 else |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
842 let s:theDiffCmd = g:patchreview_diffcmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
843 let strip = 0 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
844 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
845 if ! exists('s:theDiffCmd') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
846 Pecho 'Please define g:patchreview_diffcmd and make sure you are in a VCS controlled top directory.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
847 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
848 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
849 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
850 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
851 let retval = s:PR_GetTempDirLocation(0) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
852 if ! retval |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
853 Pecho 'DiffReview aborted.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
854 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
855 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
856 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
857 let outfile = g:patchreview_tmpdir . 'PatchReview.diff.' . strftime('%Y%m%d%H%M%S') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
858 let cmd = '!' . s:theDiffCmd . ' > "' . outfile . '"' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
859 let v:errmsg = '' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
860 silent exe cmd |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
861 if v:errmsg == '' && exists('l:vcs') && l:vcs == 'cvs' && v:shell_error == 1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
862 " Ignoring CVS non-error |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
863 elseif v:errmsg != '' || v:shell_error |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
864 Pecho 'Could not execute [' . s:theDiffCmd . ']' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
865 Pecho v:errmsg |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
866 Pecho 'Diff review aborted.' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
867 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
868 return |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
869 endif |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
870 let s:reviewmode = 'diff' |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
871 call s:_GenericReview([outfile, strip]) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
872 let &shortmess = s:save_shortmess |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
873 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
874 "}}} |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
875 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
876 " End user commands "{{{ |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
877 "============================================================================ |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
878 " :PatchReview |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
879 command! -nargs=* -complete=file PatchReview call s:PatchReview (<f-args>) |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
880 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
881 " :DiffReview |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
882 command! -nargs=0 DiffReview call s:DiffReview() |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
883 |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
884 " :PatchReviewCleanup |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
885 command! -nargs=0 PatchReviewCleanup call s:PatchReviewCleanup () |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
886 command! -nargs=0 DiffReviewCleanup call s:PatchReviewCleanup () |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
887 "}}} |
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
888 |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
889 " Development "{{{ |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
890 if exists('g:patchreview_debug') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
891 " Tests |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
892 function! <SID>PRExtractTestNative(...) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
893 "let patchfiles = glob(expand(a:1) . '/?*') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
894 "for fname in split(patchfiles) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
895 call s:PR_wipeMsgBuf() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
896 let fname = a:1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
897 call s:ExtractDiffsNative(fname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
898 for patch in g:patches['patch'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
899 for line in patch.content |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
900 Pecho line |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
901 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
902 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
903 "endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
904 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
905 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
906 function! <SID>PRExtractTestVim(...) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
907 "let patchfiles = glob(expand(a:1) . '/?*') |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
908 "for fname in split(patchfiles) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
909 call s:PR_wipeMsgBuf() |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
910 let fname = a:1 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
911 call s:ExtractDiffsPureVim(fname) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
912 for patch in g:patches['patch'] |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
913 for line in patch.content |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
914 Pecho line |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
915 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
916 endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
917 "endfor |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
918 endfunction |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
919 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
920 command! -nargs=+ -complete=file PRTestVim call s:PRExtractTestVim(<f-args>) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
921 command! -nargs=+ -complete=file PRTestNative call s:PRExtractTestNative(<f-args>) |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
922 endif |
2350
091d555653a4
contrib: patch review plugin for vim 7.0
Manpreet Singh <junkblocker@yahoo.com>
parents:
diff
changeset
|
923 "}}} |
10545
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
924 |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
925 " modeline |
b9e4a67329cd
Updated contrib/vim/patchreview.* to version 0.2.1
Manpreet Singh <junkblocker@yahoo.com>
parents:
2350
diff
changeset
|
926 " vim: set et fdl=0 fdm=marker fenc=latin ff=unix ft=vim sw=2 sts=0 ts=2 textwidth=78 nowrap : |