Merge pull request #162 from zolrath/master

Create Changelog when performing BundleInstall!
This commit is contained in:
gmarik 2012-04-19 14:10:20 -07:00
commit eb9eba26b7
5 changed files with 61 additions and 7 deletions

View File

@ -41,7 +41,7 @@
Bundle 'git://git.wincent.com/command-t.git' Bundle 'git://git.wincent.com/command-t.git'
" ... " ...
filetype plugin indent on " required! filetype plugin indent on " required!
" "
" Brief help " Brief help
" :BundleList - list configured bundles " :BundleList - list configured bundles
@ -62,7 +62,7 @@
*Windows users* see [Vundle for Windows](https://github.com/gmarik/vundle/wiki/Vundle-for-Windows) *Windows users* see [Vundle for Windows](https://github.com/gmarik/vundle/wiki/Vundle-for-Windows)
Installing requires [Git] and triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to `~/.vim/bundle/`. Installing requires [Git] and triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to `~/.vim/bundle/`.
4. Consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T44EJZX8RBUWY) 4. Consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T44EJZX8RBUWY)
[*Thank you*](http://j.mp/rSbm01) for supporting this project! ) [*Thank you*](http://j.mp/rSbm01) for supporting this project! )
@ -145,7 +145,7 @@ see [wiki](/gmarik/vundle/wiki)
[all available vim scripts]:http://vim-scripts.org/vim/scripts.html [all available vim scripts]:http://vim-scripts.org/vim/scripts.html
[install]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L110-124 [install]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L110-124
[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L128-133 [update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L128-134
[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L135-157 [search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L136-158
[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L167-179 [clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L168-180
[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L183-209 [interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L184-210

View File

@ -38,6 +38,8 @@ endif
func! vundle#rc(...) abort func! vundle#rc(...) abort
let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1)
let g:updated_bundles = []
let g:vundle_log = [] let g:vundle_log = []
let g:vundle_changelog = ['Updated Bundles:']
call vundle#config#init() call vundle#config#init()
endf endf

View File

@ -29,6 +29,10 @@ func! s:process(bang, cmd)
let msg = 'With errors; press l to view log' let msg = 'With errors; press l to view log'
endif endif
if 'updated' == g:vundle_last_status && empty(msg)
let msg = 'Bundles updated; press u to view changelog'
endif
" goto next one " goto next one
exec ':+1' exec ':+1'
@ -226,6 +230,7 @@ func! s:sync(bang, bundle) abort
return 'todate' return 'todate'
endif endif
call s:add_to_updated_bundles(out, a:bundle)
return 'updated' return 'updated'
endf endf
@ -233,6 +238,14 @@ func! s:system(cmd) abort
return system(a:cmd) return system(a:cmd)
endf endf
func! s:add_to_updated_bundles(out, bundle) abort
let git_pull_shas = matchlist(a:out, 'Updating \(\w\+\)..\(\w\+\)')
let initial_sha = git_pull_shas[1]
let updated_sha = git_pull_shas[2]
call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle])
endfunc
func! s:log(str) abort func! s:log(str) abort
let fmt = '%y%m%d %H:%M:%S' let fmt = '%y%m%d %H:%M:%S'
call add(g:vundle_log, '['.strftime(fmt).'] '.a:str) call add(g:vundle_log, '['.strftime(fmt).'] '.a:str)

View File

@ -33,6 +33,42 @@ func! s:view_log()
wincmd P | wincmd H wincmd P | wincmd H
endf endf
func! s:create_changelog() abort
for bundle_data in g:updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
let bundle = bundle_data[2]
let updates = system('cd '.shellescape(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph '.
\ initial_sha.'..'.updated_sha)
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
if bundle.uri =~ "https://github.com"
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha)
endif
for update in split(updates, '\n')
let update = substitute(update, '\s\+$', '', '')
call add(g:vundle_changelog, ' '.update)
endfor
endfor
endf
func! s:view_changelog()
call s:create_changelog()
if !exists('g:vundle_changelog_file')
let g:vundle_changelog_file = tempname()
endif
call writefile(g:vundle_changelog, g:vundle_changelog_file)
silent pedit `=g:vundle_changelog_file`
wincmd P | wincmd H
endf
func! vundle#scripts#bundle_names(names) func! vundle#scripts#bundle_names(names)
return map(copy(a:names), ' printf("Bundle ' ."'%s'".'", v:val) ') return map(copy(a:names), ' printf("Bundle ' ."'%s'".'", v:val) ')
endf endf
@ -80,6 +116,7 @@ func! vundle#scripts#view(title, headers, results)
com! -buffer -nargs=0 VundleLog call s:view_log() com! -buffer -nargs=0 VundleLog call s:view_log()
com! -buffer -nargs=0 VundleChangelog call s:view_changelog()
nnoremap <buffer> q :silent bd!<CR> nnoremap <buffer> q :silent bd!<CR>
nnoremap <buffer> D :exec 'Delete'.getline('.')<CR> nnoremap <buffer> D :exec 'Delete'.getline('.')<CR>
@ -91,6 +128,7 @@ func! vundle#scripts#view(title, headers, results)
nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')<CR> nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')<CR>
nnoremap <buffer> l :VundleLog<CR> nnoremap <buffer> l :VundleLog<CR>
nnoremap <buffer> u :VundleChangelog<CR>
nnoremap <buffer> h :h vundle<CR> nnoremap <buffer> h :h vundle<CR>
nnoremap <buffer> ? :norm h<CR> nnoremap <buffer> ? :norm h<CR>

View File

@ -132,6 +132,7 @@ run >
:BundleInstall! " NOTE: bang(!) :BundleInstall! " NOTE: bang(!)
installs or updates configured scripts. installs or updates configured scripts.
press u after updates complete to see the changelog of all updated bundles.
4.4 SEARCHING ~ 4.4 SEARCHING ~
*vundle-scripts-search* *BundleSearch* *vundle-scripts-search* *BundleSearch*
@ -175,7 +176,7 @@ confirms removal of unused script-dirs from `.vim/bundle/`.
*BundleClean!* *BundleClean!*
> >
:BundleClean! :BundleClean!
removes unused dirs with no questions. removes unused dirs with no questions.