Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create Changelog when performing BundleInstall! #162

Merged
merged 6 commits into from

3 participants

Matt Furden gmarik Stan Angeloff
Matt Furden

Keeps track of the current commit before performing an update and adds all commits pulled in the update to a Changelog, accessible via pressing 'u' after BundleInstall! completes.

Found myself going to github to see what was changed every time I saw a + next to a bundle name when updating.
This eliminates that need by making all the changes a keystroke away.

Matt Furden

Discovered an issue with Bundles that don't exist yet, will reopen when resolved.

Matt Furden zolrath closed this
Matt Furden zolrath reopened this
Matt Furden

Resolved the issue with Bundles that lacked a .git directory.

gmarik
Owner

Hey @zolrath
Interesting idea!
I'll play with it and get back to you...

Matt Furden

I just went through in an attempt to make my code fit better with yours, single quoted strings instead of double quoted and whatnot. I noticed you use if..endif most of the time but there are a few instances of if...end.

I'll only push the changes related to the Changelog for now but if you'd like I can submit the if...endif standardization as a separate pull request?

Matt Furden zolrath 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.
0956084
Stan Angeloff

Love the idea, I was going to suggest doing it only for GitHub repos by using the /compare facility. I would normally go into the 'Log' view after :BundleInstall!<CR>, git rid of all Current branch... then for each remaining update I have recorded a macro to transform into something like this.

Looking forward to what comes out of this.

Matt Furden

How does this work for you @StanAngeloff ?

Updated Bundle: ctrlp.vim
Compare at: https://github.com/kien/ctrlp.vim/compare/863996ce26...master
  * Update help   Kien N, 12 hours ago
  * Tweak mru and buffer sorting   Kien N, 18 hours ago
  * Don't need to check pathmode   Kien N, 28 hours ago
  * Save bookmarks before exiting   Kien N, 29 hours ago
  * Use a few curly braces variables   Kien N, 29 hours ago

@gmarik, Have you had a chance to try out the newer delayed implementation?

Stan Angeloff

I would find that very helpful, yes. Only concern is having to diff against master which may not be the default repo branch?

Perhaps storing git rev-parse HEAD before and after the update to obtain the SHA of the commits?

Matt Furden zolrath Add GitHub Compare link to Changelog.
If the Bundle is hosted on GitHub include link to compare the commit range
visually on GitHub.
769feb9
gmarik

i don't think the above 3 lines are needed here , as return 'updated'(:227) means that there were changes made.
You can probably just add it tog:updated_bundles

The only problem with return 'updated' is that both new Bundles and Updated Bundles return 'updated'
The check for git rev-list vundle_update returning a v:shell_error makes sure that we don't get garbage output with new bundles, though comparing the two commits is entirely unnecessary.

Without checking for v:shell_error:

Updated Bundle: ZoomWin
Compare at: https://github.com/vim-scripts/ZoomWin/compare/fatal: amb...HEAD
  fatal: ambiguous argument 'vundle_update..HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions
Owner

I see, maybe we need to add new status then, so we can distinguish betwen new/updates

Added a new status in the newest commit.

gmarik

Can we also have :ChangeLog not depend on g:vundle_changelog?

Since we have tags :ChangeLog may be generated any time (therefore do not depend on :BundleInstall)

My first pass simply went through and compared all the vundle_update tags to HEAD and built a Changelog for the modified Bundles but it took significantly longer to build the Changelog. I thought it had frozen the first time I ran that version, which doesn't seem like a good user experience.
Thoughts?

Owner

yeah, this will require making it unbuffered (write updates to the window itself instead of array).
Can't be 100% positive if it's possible tho )

gmarik
Owner

Nothing else I guess.

Let me know what you think!
Thank you!

I implemented the new and updated status changes in the newest commit!
If you'd like to look at the previous implementation that iterated over each Bundle looking for updates with the tags I've included both versions in a gist: https://gist.github.com/2409649

As is I would prefer to go with the version that builds an updated_bundle list as we update Bundles so the user has a fluid experience.

Owner

Please merge latest Vundle and let me know what you think!

Owner

As for gist, i'm ok going with updated_bundles as initial version, since we've minimized extra work down to tag creation during installation process...

and others added some commits
gmarik add `new` status 8c4e0a4
Matt Furden zolrath 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.
e999886
Matt Furden zolrath 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.
a52d4b9
Matt Furden zolrath 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.
f84fee8
gmarik gmarik merged commit eb9eba2 into from
gmarik
Owner

Thank you! )

Stan Angeloff

I just updated to master and on BundleInstall! I get a lot of these:

Processing 'XXX/YYY'

Error detected while processing function vundle#installer#new..<SNR>100_process..vundle#installer#run..vundle#installer#install..<SNR>100_sync..<SNR>10
0_add_to_updated_bundles:
line    2:
E684: list index out of range: 1
E15: Invalid expression: git_pull_shas[1]
Error detected while processing function vundle#installer#new..<SNR>100_process:
line   13:
E121: Undefined variable: g:vundle_last_status
E15: Invalid expression: 'error' == g:vundle_last_status
line   17:
E121: Undefined variable: g:vundle_last_status
E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)

" Then a lot, lot of these for each bundle.

Processing 'XXX/YYY'
E684: list index out of range: 1
E15: Invalid expression: git_pull_shas[1]

When I print the result of the git pull command, it is:

Current branch master is up to date.

whereas the code is looking for up-to-date. I don't have additional locales (other than British English) installed on my machine, but it seems like using something like LANG=fr LC_ALL=fr vim -c 'BundleInstall!' would also break as all messages would be printed in French.

I've never done much VimScripting, but will submit a patch as a follow-up reply.

gmarik gmarik referenced this pull request from a commit
gmarik Safeguard when no matches
- addresses #162 issues
faf8dd3
gmarik
Owner

just pushed fix.

Before changing to ref-list solution, would like to know how git pull output differs.

@StanAngeloff, what git version you have?

This goes beyond :ChangeLog issue, as Vundle relies on output heavily.

UPD:
ok, understand the whole thing now after rereading your msg...
@StanAngeloff thanks for bringing it up.

Stan Angeloff

Using a blank Vagrant Ubuntu 10.04-x86-64 box here are some details about the environment and output:

$ sudo apt-get install git-core
$ uname -a
Linux lucid64 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux
$ git --version
git version 1.7.0.4
$ git clone git://github.com/gmarik/vundle.git
$ cd vundle
$ git pull
Already up-to-date.

Here is the same on my base Ubuntu 11.10 machine:

$ uname -a
Linux stan-inspiron 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ git --version
git version 1.7.5.4
$ git clone git://github.com/gmarik/vundle.git
$ cd vundle
$ git pull
Current branch master is up to date.

Let me know if I can help any further.

EDIT: I believe in my case it's also down to ~/.gitconfig where I have branch.autosetuprebase = always which means all git pulls would be rebases.

I wasn't able to force git to change command output by changing LANG or LC_ALL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. Matt Furden

    Create Changelog when performing BundleInstall!

    zolrath authored
    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.
Commits on Apr 17, 2012
  1. Matt Furden

    Add GitHub Compare link to Changelog.

    zolrath authored
    If the Bundle is hosted on GitHub include link to compare the commit range
    visually on GitHub.
Commits on Apr 18, 2012
  1. Matt Furden

    add `new` status

    authored zolrath committed
  2. Matt Furden

    Use 'new' & 'updated' to build updated_bundle list

    zolrath authored
    Distinction between `new` and `updated` simplifies the process
    of adding a bundle to the updated_bundle list.
Commits on Apr 19, 2012
  1. Matt Furden

    Get initial/updated shas from `git pull` output.

    zolrath authored
    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.
  2. Matt Furden

    Add message on how to view changelog after Update.

    zolrath authored
    If no errors exist, the status-line will inform users how to view the
    Changelog after BundleUpdate! is completed.
This page is out of date. Refresh to see the latest.
12 README.md
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
5 autoload/vundle.vim
View
@@ -30,13 +30,16 @@ 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
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
23 autoload/vundle/installer.vim
View
@@ -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'
@@ -53,8 +57,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
@@ -218,10 +224,13 @@ 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_bundles(out, a:bundle)
return 'updated'
endf
@@ -229,6 +238,14 @@ func! s:system(cmd) abort
return system(a:cmd)
endf
+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
let fmt = '%y%m%d %H:%M:%S'
call add(g:vundle_log, '['.strftime(fmt).'] '.a:str)
38 autoload/vundle/scripts.vim
View
@@ -33,6 +33,42 @@ 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 updates = system('cd '.shellescape(bundle.path()).
+ \ ' && 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"
+ 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 +116,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 +128,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>
3  doc/vundle.txt
View
@@ -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.
Something went wrong with that request. Please try again.