Skip to content

Instantly share code, notes, and snippets.

@zolrath
Created April 17, 2012 22:51
Show Gist options
  • Save zolrath/2409649 to your computer and use it in GitHub Desktop.
Save zolrath/2409649 to your computer and use it in GitHub Desktop.
Changelog Generation Methods
" Takes less than a second.
func! s:create_changelog() abort
for bundle in g:updated_bundles
let updates = system('cd '.shellescape(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph'.
\ ' vundle_update..HEAD')
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
if bundle.uri =~ "https://github.com"
let update_sha = system('cd '.shellescape(bundle.path()).' && git rev-list -1 vundle_update')[0:9]
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.update_sha.'...HEAD')
endif
for update in split(updates, '\n')
let update = substitute(update, '\s\+$', '', '')
call add(g:vundle_changelog, ' '.update)
endfor
endfor
endf
" Takes just over 5 seconds
func! s:create_slow_changelog() abort
for bundle in g:bundles
let updates = system('cd '.shellescape(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph'.
\ ' vundle_update..HEAD')
if (len(updates) > 0) && (0 == v:shell_error)
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
if bundle.uri =~ "https://github.com"
let update_sha = system('cd '.shellescape(bundle.path()).' && git rev-list -1 vundle_update')[0:9]
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.update_sha.'...HEAD')
endif
for update in split(updates, '\n')
let update = substitute(update, '\s\+$', '', '')
call add(g:vundle_changelog, ' '.update)
endfor
endif
endfor
endf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment