File: diff-to-logmsg.vim

package info (click to toggle)
subversion 1.4.2dfsg1-3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,284 kB
  • ctags: 32,888
  • sloc: ansic: 406,472; python: 38,378; sh: 15,438; cpp: 9,604; ruby: 8,313; perl: 5,308; java: 4,576; lisp: 3,860; xml: 3,298; makefile: 856
file content (46 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
" diff-to-logmsg.vim by Ph. Marek <philipp.marek@bmlv.gv.at>
" 
" Usage is as follows:
"
"   diff -urp subversion.orig subversion.mine > patch
" or 
"   svn diff --diff-cmd=diff --extensions="-up" [TARGET...] > patch
"
" (the -p tells diff to output the function names), then
"
"   vi patch
"   :source diff_to_logmsg.vim
"
" and voila!  Just the documentation has to be written.
"
" Note from Julian Foad:
"   It ought to be noted that the generated list of function names
"   is only as accurate as the output of "diff -p", which is not very
"   accurate - e.g. for changes to a doc string appearing before a 
"   function, it generally outputs the name of the _previous_ function.


" goto start of patch and insert the header (until the .)
:0
insert
[[[


]]]


.


" search for file and function names and put them before the ]]]
:g/^\(---\|@@\)/normal ""yygg/]]]kk""p


" change the copied lines to the wanted scheme
:0
:1;/]]]/ s#--- \([^\t ]\+\).\+#\r* \1#e
:1;/]]]/ s#@@ .\+ @@.*\<\(\w\+\) *(.*#  (\1): #e
" all lines without function names are ignored
:1;/]]]/ g#@@ .\+#normal dd
" remove duplicates
:1;/]]]/ !uniq