From 09560847cad32de2d0aeccb6e599d9bc1fa6e70e Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Wed, 4 Apr 2012 19:26:13 -0700 Subject: [PATCH 1/6] Create Changelog when performing BundleInstall! Keeps track of the current commit with a vundle_update tag before perfoming an update and adds all commits pulled in the update to a Changelog accessible via pressing 'u' after BundleInstall! completes. --- README.md | 12 ++++++------ autoload/vundle.vim | 2 ++ autoload/vundle/installer.vim | 15 +++++++++++++++ autoload/vundle/scripts.vim | 29 +++++++++++++++++++++++++++++ doc/vundle.txt | 3 ++- 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9b44641..9de30ce 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Bundle 'git://git.wincent.com/command-t.git' " ... - filetype plugin indent on " required! + filetype plugin indent on " required! " " Brief help " :BundleList - list configured bundles @@ -62,7 +62,7 @@ *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/`. - + 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! ) @@ -145,7 +145,7 @@ see [wiki](/gmarik/vundle/wiki) [all available vim scripts]:http://vim-scripts.org/vim/scripts.html [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 -[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L135-157 -[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L167-179 -[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L183-209 +[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L128-134 +[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L136-158 +[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#L184-210 diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 096f7cc..b81650a 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -37,6 +37,8 @@ endif func! vundle#rc(...) abort 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_changelog = ['Updated Bundles:'] call vundle#config#init() endf diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index e2a8291..f1e6dbf 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -204,6 +204,7 @@ 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 @@ -222,6 +223,7 @@ func! s:sync(bang, bundle) abort return 'todate' end + call s:add_to_updated_bundle_list(a:bundle) return 'updated' endf @@ -229,6 +231,19 @@ 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') +endfunc + +func! s:add_to_updated_bundle_list(bundle) abort + let current_commit = s:system('cd '.shellescape(a:bundle.path()).' && git rev-list HEAD') + let initial_commit = s:system('cd '.shellescape(a:bundle.path()).' && git rev-list vundle_update') + if (0 == v:shell_error) && (initial_commit != current_commit) + call add(g:updated_bundles, a:bundle) + endif +endfunc + func! s:log(str) abort let fmt = '%y%m%d %H:%M:%S' call add(g:vundle_log, '['.strftime(fmt).'] '.a:str) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 324c281..1d4b185 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -33,6 +33,33 @@ func! s:view_log() wincmd P | wincmd H endf +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) + 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) return map(copy(a:names), ' printf("Bundle ' ."'%s'".'", v:val) ') endf @@ -80,6 +107,7 @@ func! vundle#scripts#view(title, headers, results) com! -buffer -nargs=0 VundleLog call s:view_log() + com! -buffer -nargs=0 VundleChangelog call s:view_changelog() nnoremap q :silent bd! nnoremap D :exec 'Delete'.getline('.') @@ -91,6 +119,7 @@ func! vundle#scripts#view(title, headers, results) nnoremap I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '') nnoremap l :VundleLog + nnoremap u :VundleChangelog nnoremap h :h vundle nnoremap ? :norm h diff --git a/doc/vundle.txt b/doc/vundle.txt index 3049fc9..57e7260 100644 --- a/doc/vundle.txt +++ b/doc/vundle.txt @@ -132,6 +132,7 @@ run > :BundleInstall! " NOTE: bang(!) installs or updates configured scripts. +press u after updates complete to see the changelog of all updated bundles. 4.4 SEARCHING ~ *vundle-scripts-search* *BundleSearch* @@ -175,7 +176,7 @@ confirms removal of unused script-dirs from `.vim/bundle/`. *BundleClean!* > - :BundleClean! + :BundleClean! removes unused dirs with no questions. From 769feb9fff1ef87c5607fd7a1c4c6b31d7960128 Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Tue, 17 Apr 2012 02:51:29 -0700 Subject: [PATCH 2/6] Add GitHub Compare link to Changelog. If the Bundle is hosted on GitHub include link to compare the commit range visually on GitHub. --- autoload/vundle/scripts.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 1d4b185..642f21e 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -35,11 +35,15 @@ endf func! s:create_changelog() abort for bundle in g:updated_bundles + let update_sha = system('cd '.shellescape(bundle.path()).' && git rev-list -1 vundle_update')[0:9] 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" + 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) From 8c4e0a4a318859c7214b7b3c19568ff6bd891c22 Mon Sep 17 00:00:00 2001 From: gmarik Date: Tue, 17 Apr 2012 20:12:11 -0500 Subject: [PATCH 3/6] add `new` status --- autoload/vundle.vim | 3 ++- autoload/vundle/installer.vim | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index b81650a..3bd67c5 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -30,7 +30,8 @@ if (has('signs')) sign define Vu_error text=! texthl=Error sign define Vu_active text=> texthl=Comment sign define Vu_todate text=. texthl=Comment -sign define Vu_updated text=+ texthl=Comment +sign define Vu_new text=+ texthl=Comment +sign define Vu_updated text=* texthl=Comment sign define Vu_deleted text=- texthl=Comment endif diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index f1e6dbf..5b36f5e 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -53,8 +53,10 @@ func! vundle#installer#run(func_name, name, ...) abort redraw - if 'updated' == status + if 'new' == status echo n.' installed' + elseif 'updated' == status + echo n.' updated' elseif 'todate' == status echo n.' already installed' elseif 'deleted' == status @@ -219,9 +221,11 @@ func! s:sync(bang, bundle) abort return 'error' end - if out =~# 'up-to-date' + if out =~# 'Cloning into ' + return 'new' + elseif out =~# 'up-to-date' return 'todate' - end + endif call s:add_to_updated_bundle_list(a:bundle) return 'updated' From e999886db5cf69cdbbdf58b847c2fc93193e1213 Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Wed, 18 Apr 2012 01:19:25 -0700 Subject: [PATCH 4/6] Use 'new' & 'updated' to build updated_bundle list Distinction between `new` and `updated` simplifies the process of adding a bundle to the updated_bundle list. --- autoload/vundle/installer.vim | 10 +--------- autoload/vundle/scripts.vim | 4 +++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 5b36f5e..f3da3f0 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -227,7 +227,7 @@ func! s:sync(bang, bundle) abort return 'todate' endif - call s:add_to_updated_bundle_list(a:bundle) + call add(g:updated_bundles, a:bundle) return 'updated' endf @@ -240,14 +240,6 @@ func! s:add_update_tag(bundle) abort \ ' && git tag -a vundle_update -m "Last Vundle Update" -f') endfunc -func! s:add_to_updated_bundle_list(bundle) abort - let current_commit = s:system('cd '.shellescape(a:bundle.path()).' && git rev-list HEAD') - let initial_commit = s:system('cd '.shellescape(a:bundle.path()).' && git rev-list vundle_update') - if (0 == v:shell_error) && (initial_commit != current_commit) - call add(g:updated_bundles, a:bundle) - endif -endfunc - func! s:log(str) abort let fmt = '%y%m%d %H:%M:%S' call add(g:vundle_log, '['.strftime(fmt).'] '.a:str) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 642f21e..0139e06 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -35,15 +35,17 @@ endf func! s:create_changelog() abort for bundle in g:updated_bundles - let update_sha = system('cd '.shellescape(bundle.path()).' && git rev-list -1 vundle_update')[0:9] 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) From a52d4b91f40023f14dfe47254d697c0edb9fa9f1 Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Wed, 18 Apr 2012 22:28:05 -0700 Subject: [PATCH 5/6] 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') From f84fee88394131b5eed3dc7f00cf06545505e63e Mon Sep 17 00:00:00 2001 From: Matt Furden Date: Thu, 19 Apr 2012 13:59:45 -0700 Subject: [PATCH 6/6] Add message on how to view changelog after Update. If no errors exist, the status-line will inform users how to view the Changelog after BundleUpdate! is completed. --- autoload/vundle/installer.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index b7ed7c2..054f5a2 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -29,6 +29,10 @@ func! s:process(bang, cmd) let msg = 'With errors; press l to view log' endif + if 'updated' == g:vundle_last_status && empty(msg) + let msg = 'Bundles updated; press u to view changelog' + endif + " goto next one exec ':+1'