Gentoo Archives: gentoo-commits

From: Tim Harder <radhermit@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-syntax:master commit in: /, plugin/
Date: Tue, 02 Feb 2016 17:03:07
Message-Id: 1454432544.48378a55c6c58ebdd8f5ac532046d704d8015b22.radhermit@gentoo
1 commit: 48378a55c6c58ebdd8f5ac532046d704d8015b22
2 Author: Tim Harder <radhermit <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 2 16:57:37 2016 +0000
4 Commit: Tim Harder <radhermit <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 2 17:02:24 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=48378a55
7
8 drop bugzilla bugsummary plugin
9
10 You can extract more info using a custom mapping that calls pybugz or
11 similar. Also, this isn't specifically gentoo syntax related.
12
13 Fixes #4.
14
15 Makefile | 1 -
16 plugin/bugsummary.vim | 157 --------------------------------------------------
17 2 files changed, 158 deletions(-)
18
19 diff --git a/Makefile b/Makefile
20 index d82f206..a585b64 100644
21 --- a/Makefile
22 +++ b/Makefile
23 @@ -30,7 +30,6 @@ files_indent = \
24 indent/gentoo-metadata.vim
25
26 files_plugin = \
27 - plugin/bugsummary.vim \
28 plugin/gentoo-common.vim \
29 plugin/newebuild.vim \
30 plugin/newmetadata.vim \
31
32 diff --git a/plugin/bugsummary.vim b/plugin/bugsummary.vim
33 deleted file mode 100644
34 index 00d4a24..0000000
35 --- a/plugin/bugsummary.vim
36 +++ /dev/null
37 @@ -1,157 +0,0 @@
38 -" Vim plugin
39 -" Purpose: Display summary information about a bugzilla bug
40 -" Author: Ciaran McCreesh <ciaranm@g.o>
41 -" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh
42 -" Licence: You may redistribute this under the same terms as Vim itself
43 -"
44 -" The following commands are provided:
45 -" :BugSummary 12345
46 -" :BugDetails 12345
47 -" In addition, a normal mode map of <Leader>bug (<Leader> defaults to
48 -" backslash, see :help <Leader>) which calls :BugDetails on the bug under the
49 -" cursor.
50 -"
51 -" Configuration options:
52 -" :let g:bugsummary_browser="firefox '%s'"
53 -
54 -if &compatible || v:version < 603 || exists("g:loaded_bugsummary")
55 - finish
56 -endif
57 -
58 -let g:loaded_bugsummary=1
59 -
60 -fun! <SID>strip(s)
61 - return substitute(a:s, "\\n", "", "g")
62 -endfun
63 -
64 -fun! <SID>tidy(s)
65 - let l:s = a:s
66 - let l:s = substitute(l:s, "&lt;", "<", "g")
67 - let l:s = substitute(l:s, "&gt;", ">", "g")
68 - let l:s = substitute(l:s, "&apos;", "\'", "g")
69 - let l:s = substitute(l:s, "&quot;", "\"", "g")
70 - let l:s = substitute(l:s, "&amp;", "\\&", "g")
71 - return l:s
72 -endfun
73 -
74 -fun! <SID>extract(a, b)
75 - return <SID>tidy(matchstr(a:a, '\(<' . a:b . '>\)\@<=[^<]*\(</' . a:b . '>\)\@='))
76 -endfun
77 -
78 -fun! <SID>echomenu(s)
79 - let l:s = a:s . "|"
80 - let l:p = stridx(a:s, "|")
81 - echo " "
82 - echo "menu: "
83 - while -1 != l:p
84 - echohl Special
85 - echon "[" . strpart(l:s, 0, 1) . "]"
86 - echohl Keyword
87 - echon strpart(l:s, 1, l:p - 1)
88 - echon " "
89 - let l:s = strpart(l:s, l:p + 1)
90 - let l:p = stridx(l:s, "|")
91 - endwhile
92 - echohl
93 -endfun
94 -
95 -fun! <SID>GetBugSummary(id, detailed)
96 - try
97 - let l:c="wget -O - -o /dev/null 'http://bugs.gentoo.org/show_bug.cgi?id=" . a:id . "\&ctype=xml'"
98 - let l:r = system(l:c)
99 - let l:x_bug_id = <SID>extract(l:r, 'bug_id')
100 - let l:x_bug_desc = <SID>extract(l:r, 'short_desc')
101 - let l:x_bug_from = <SID>extract(l:r, 'reporter')
102 - let l:x_bug_to = <SID>extract(l:r, 'assigned_to')
103 - let l:x_bug_stat = <SID>extract(l:r, 'bug_status')
104 - let l:x_bug_res = <SID>extract(l:r, 'resolution')
105 - if -1 == match(l:x_bug_desc, '\S')
106 - throw "Couldn't get summary for bug " . l:x_bug_id
107 - else
108 - echohl Keyword
109 - echo "Bug #" . <SID>strip(l:x_bug_id)
110 - echohl
111 - echon ': ' . <SID>strip(l:x_bug_stat) . " " . <SID>strip(l:x_bug_res)
112 - echo " " . <SID>strip(l:x_bug_desc)
113 - echo " "
114 - echohl Preproc
115 - echon <SID>strip(l:x_bug_from)
116 - echohl
117 - echon " -> "
118 - echohl Preproc
119 - echon <SID>strip(l:x_bug_to)
120 - echohl
121 -
122 - if a:detailed
123 - call <SID>echomenu("return|browser|insert")
124 - let l:which=input("> ")
125 - if l:which == "b"
126 - if ! exists("g:bugsummary_browser")
127 - throw "You should set g:bugsummary_browser first (:help g:bugsummary_browser)"
128 - else
129 - let l:cmd=substitute(g:bugsummary_browser, "%s",
130 - \ 'http://bugs.gentoo.org/show_bug.cgi?id=' . a:id, "g")
131 - call system(l:cmd)
132 - if v:shell_error != 0
133 - throw "Couldn't run " . l:cmd
134 - endif
135 - endif
136 - elseif l:which == "i"
137 - call <SID>echomenu("number|link|details")
138 - let l:which = input("> ")
139 - if l:which == "l"
140 - exec "normal i<http://bugs.gentoo.org/show_bug.cgi?id=" . l:x_bug_id . ">"
141 - elseif l:which == "d"
142 - exec "normal oBug #" . l:x_bug_id . ": " . l:x_bug_stat . " " . l:x_bug_res
143 - exec "normal o" . l:x_bug_desc
144 - exec "normal o" . l:x_bug_from . " -> " . l:x_bug_to
145 - exec "normal o"
146 - else
147 - exec "normal iBug #" . l:x_bug_id
148 - endif
149 - endif
150 - endif
151 - endif
152 -
153 - catch
154 - echo " "
155 - echohl Error
156 - echo v:exception
157 - echohl
158 - call input("--- Hit Return ---")
159 - endtry
160 -endfun
161 -
162 -fun! <SID>FindGetBugSummary(str, col)
163 - try
164 - let l:col = a:col - 2
165 - while l:col > 0 && (-1 != match(strpart(a:str, l:col, 1), '\d'))
166 - let l:col = l:col - 1
167 - endwhile
168 - let l:str = strpart(a:str, l:col)
169 - let l:i = match(l:str, '\d')
170 - if l:i == -1
171 - throw "Couldn't find a bug number"
172 - else
173 - let l:str = strpart(l:str, l:i)
174 - let l:i = match(l:str, '\D\|$')
175 - let l:str = strpart(l:str, 0, l:i)
176 - if match(l:str, '\d') != -1
177 - call <SID>GetBugSummary(l:str, 1)
178 - else
179 - throw "Couldn't find a bug number"
180 - endif
181 - endif
182 - catch
183 - echohl Error
184 - echo v:exception
185 - echohl
186 - call input("--- Hit Return ---")
187 - endtry
188 -endfun
189 -
190 -command! -nargs=1 BugSummary :call <SID>GetBugSummary(<args>, 0)
191 -command! -nargs=1 BugDetails :call <SID>GetBugSummary(<args>, 1)
192 -nmap <Leader>bug :call <SID>FindGetBugSummary(getline("."), col("."))<CR>
193 -
194 -" vim: set et : "