Permalink
Browse files

Updating vundle

  • Loading branch information...
1 parent d4b93ef commit cd726fccd4199cd8ac49b3954be48ad8bed52c11 @spicycode committed Aug 7, 2012
View
@@ -33,6 +33,7 @@ set matchpairs+=<:> " Also match angle brackets
" Mouse:
set mousehide " Hide mouse pointer on insert mode.
+set mouse=
" Text:
View
@@ -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
@@ -33,11 +33,14 @@ sign define Vu_todate text=. texthl=Comment
sign define Vu_new text=+ texthl=Comment
sign define Vu_updated text=* texthl=Comment
sign define Vu_deleted text=- texthl=Comment
+sign define Vu_helptags text=* texthl=Comment
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
@@ -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'
@@ -61,6 +65,8 @@ func! vundle#installer#run(func_name, name, ...) abort
echo n.' already installed'
elseif 'deleted' == status
echo n.' deleted'
+ elseif 'helptags' == status
+ echo n.' regenerated'
elseif 'error' == status
echohl Error
echo 'Error processing '.n
@@ -101,7 +107,7 @@ endf
func! vundle#installer#docs() abort
call vundle#installer#helptags(g:bundles)
- return 'updated'
+ return 'helptags'
endf
func! vundle#installer#helptags(bundles) abort
@@ -198,16 +204,20 @@ endf
func! s:sync(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/', 1)
- if isdirectory(git_dir)
+ if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1))
if !(a:bang) | return 'todate' | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
if (has('win32') || has('win64'))
let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = '"'.cmd.'"' " enclose in quotes
endif
+
+ let get_current_sha = 'cd '.shellescape(a:bundle.path()).' && git rev-parse HEAD'
+ let initial_sha = s:system(get_current_sha)[0:15]
else
let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
+ let initial_sha = ''
endif
let out = s:system(cmd)
@@ -220,12 +230,17 @@ func! s:sync(bang, bundle) abort
return 'error'
end
- if out =~# 'Cloning into '
+ if empty(initial_sha)
return 'new'
- elseif out =~# 'up-to-date'
+ endif
+
+ let updated_sha = s:system(get_current_sha)[0:15]
+
+ if initial_sha == updated_sha
return 'todate'
endif
+ call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle])
return 'updated'
endf
@@ -33,6 +33,50 @@ func! s:view_log()
wincmd P | wincmd H
endf
+func! s:create_changelog() abort
+ 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 cmd = 'cd '.shellescape(bundle.path()).
+ \ ' && git log --pretty=format:"%s %an, %ar" --graph '.
+ \ initial_sha.'..'.updated_sha
+
+ if (has('win32') || has('win64'))
+ let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
+ let cmd = '"'.cmd.'"' " enclose in quotes
+ endif
+
+ let updates = system(cmd)
+
+ 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/'.initial_sha.'...'.updated_sha)
+ endif
+
+ 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 +124,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 <buffer> q :silent bd!<CR>
nnoremap <buffer> D :exec 'Delete'.getline('.')<CR>
@@ -91,6 +136,7 @@ func! vundle#scripts#view(title, headers, results)
nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')<CR>
nnoremap <buffer> l :VundleLog<CR>
+ nnoremap <buffer> u :VundleChangelog<CR>
nnoremap <buffer> h :h vundle<CR>
nnoremap <buffer> ? :norm h<CR>
@@ -117,7 +163,7 @@ func! s:fetch_scripts(to)
let temp = shellescape(tempname())
let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.shellescape(a:to)
if (has('win32') || has('win64'))
- let cmd = substitute(cmd, 'mv -f ', 'mv /Y ') " change force flag
+ let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag
let cmd = '"'.cmd.'"' " enclose in quotes so && joined cmds work
end
else
@@ -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.
View
@@ -23,3 +23,4 @@ Bundle "wookiehangover/jshint.vim"
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'mrtazz/molokai.vim'
Bundle 'Lokaltog/vim-powerline'
+Bundle 'juvenn/mustache.vim'

0 comments on commit cd726fc

Please sign in to comment.