Browse Source

Move create_changelog to installer.vim

... to get make_git_command in reach,
and keep that command in the scope of installer.vim
pull/720/head
Guillaume Maudoux 10 years ago
parent
commit
f59bbf59ff
2 changed files with 33 additions and 33 deletions
  1. +32
    -0
      autoload/vundle/installer.vim
  2. +1
    -33
      autoload/vundle/scripts.vim

+ 32
- 0
autoload/vundle/installer.vim View File

@ -75,6 +75,38 @@ func! s:process(bang, cmd)
endf
" ---------------------------------------------------------------------------
" Parse the output from git log after an update to create a change log for the
" user.
" ---------------------------------------------------------------------------
func! vundle#installer#create_changelog() abort
let changelog = ['Updated Plugins:']
for bundle_data in g:vundle#updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
let bundle = bundle_data[2]
let cmd = s:make_git_command(bundle, ['log', '--pretty=format:%s %an, %ar',
\ '--graph', initial_sha.'..'.updated_sha ])
let updates = system(cmd)
call add(changelog, '')
call add(changelog, 'Updated Plugin: '.bundle.name)
if bundle.uri =~ "https://github.com"
call add(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(changelog, ' '.update)
endfor
endfor
return changelog
endf
" ---------------------------------------------------------------------------
" Call another function in the different Vundle windows.
"


+ 1
- 33
autoload/vundle/scripts.vim View File

@ -73,38 +73,6 @@ func! s:view_log()
endf
" ---------------------------------------------------------------------------
" Parse the output from git log after an update to create a change log for the
" user.
" ---------------------------------------------------------------------------
func! s:create_changelog() abort
let changelog = ['Updated Plugins:']
for bundle_data in g:vundle#updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
let bundle = bundle_data[2]
let cmd = s:make_git_command(bundle, ['log', '--pretty=format:"%s %an, %ar"',
\ '--graph', initial_sha.'..'.updated_sha ])
let updates = system(cmd)
call add(changelog, '')
call add(changelog, 'Updated Plugin: '.bundle.name)
if bundle.uri =~ "https://github.com"
call add(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(changelog, ' '.update)
endfor
endfor
return changelog
endf
" ---------------------------------------------------------------------------
" View the change log after an update or installation.
" ---------------------------------------------------------------------------
@ -116,7 +84,7 @@ func! s:view_changelog()
if bufloaded(s:changelog_file)
execute 'silent bdelete' s:changelog_file
endif
call writefile(s:create_changelog(), s:changelog_file)
call writefile(vundle#installer#create_changelog(), s:changelog_file)
execute 'silent pedit' s:changelog_file
set bufhidden=wipe
setl buftype=nofile


Loading…
Cancel
Save