Get initial/updated shas from git pull output.

Instead of creating a vundle_update tag to compare changes between update
and HEAD we now use the output from `git pull` to get initial/updated shas.
This commit is contained in:
Matt Furden 2012-04-18 22:28:05 -07:00
parent e999886db5
commit a52d4b91f4
2 changed files with 15 additions and 10 deletions

View File

@ -206,7 +206,6 @@ func! s:sync(bang, bundle) abort
let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = '"'.cmd.'"' " enclose in quotes
endif
call s:add_update_tag(a:bundle)
else
let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
endif
@ -227,7 +226,7 @@ func! s:sync(bang, bundle) abort
return 'todate'
endif
call add(g:updated_bundles, a:bundle)
call s:add_to_updated_bundles(out, a:bundle)
return 'updated'
endf
@ -235,9 +234,12 @@ func! s:system(cmd) abort
return system(a:cmd)
endf
func! s:add_update_tag(bundle) abort
call s:system('cd '.shellescape(a:bundle.path()).
\ ' && git tag -a vundle_update -m "Last Vundle Update" -f')
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

View File

@ -34,16 +34,19 @@ func! s:view_log()
endf
func! s:create_changelog() abort
for bundle in g:updated_bundles
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 '.
\ ' vundle_update..HEAD')
\ initial_sha.'..'.updated_sha)
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')
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha)
endif
for update in split(updates, '\n')