From a52d4b91f40023f14dfe47254d697c0edb9fa9f1 Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Wed, 18 Apr 2012 22:28:05 -0700 Subject: [PATCH] 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. --- autoload/vundle/installer.vim | 12 +++++++----- autoload/vundle/scripts.vim | 13 ++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index f3da3f0..b7ed7c2 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -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 diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 0139e06..0766033 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -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') + \ ' && 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" - 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')