Permalink
Browse files

Fixed bisect, it was not limiting activated plugins at all

Added test for bisection (still needing plugins with dependencies bisection testing)
  • Loading branch information...
ZyX-I committed Oct 28, 2012
1 parent 9a4cc5f commit 5781f5d571f0ba95058a86c4d7836c64d867e4d0
Showing with 39 additions and 6 deletions.
  1. +15 −5 autoload/vam.vim
  2. 0 test/bisect.in
  3. +1 −0 test/bisect.ok
  4. +22 −0 test/bisect.vim
  5. +1 −1 test/vimrc
View
@@ -196,6 +196,10 @@ fun! vam#ActivateRecursively(list_of_names, ...)
" source plugin/* files ?
let rtp = vam#PluginRuntimePath(name)
call add(opts['new_runtime_paths'], rtp)
+ let opts.path_plugins[rtp] = name
+ if !empty(get(opts, 'requested_by'))
+ let opts.are_dependencies[name] = 1
+ endif
let s:c['activated_plugins'][name] = 1
@@ -251,12 +255,16 @@ fun! vam#ActivateAddons(...) abort
let topLevel = !has_key(opts, 'new_runtime_paths')
" add new_runtime_paths state if not present in opts yet
- let new_runtime_paths = get(opts, 'new_runtime_paths',[])
- let to_be_activated = get(opts, 'to_be_activated', {})
+ let new_runtime_paths = get(opts, 'new_runtime_paths', [])
+ let to_be_activated = get(opts, 'to_be_activated', {})
+ let path_plugins = get(opts, 'path_plugins', {})
+ let are_dependencies = get(opts, 'are_dependencies', {})
- let opts['new_runtime_paths'] = new_runtime_paths
- let opts['to_be_activated'] = to_be_activated
+ let opts.new_runtime_paths = new_runtime_paths
+ let opts.to_be_activated = to_be_activated
+ let opts.path_plugins = path_plugins
+ let opts.are_dependencies = are_dependencies
for a in args[0]
let to_be_activated[a] = 1
@@ -267,7 +275,9 @@ fun! vam#ActivateAddons(...) abort
if topLevel
if exists('g:vam_plugin_whitelist')
- call filter(to_be_activated, 'index(g:vam_plugin_whitelist, v:val) >= 0')
+ call filter(to_be_activated, 'index(g:vam_plugin_whitelist, v:key) != -1 || has_key(are_dependencies, v:key)')
+ call filter(path_plugins, 'has_key(to_be_activated, v:val)')
+ call filter(new_runtime_paths, 'has_key(path_plugins, v:val)')
end
" deferred tasks:
" - add addons to runtimepath
View
No changes.
View
@@ -0,0 +1 @@
+The plugin vam-addon-2 or one of its dependencies is likely to cause the problem
View
@@ -0,0 +1,22 @@
+let addons=map(range(4), '"vam-addon-".v:val')
+for addon in addons
+ let addpath=g:vim_addon_manager.plugin_root_dir.'/'.addon.'/plugin'
+ call mkdir(addpath, 'p')
+ call writefile(['let g:v'.addon[-1:].'=1'], addpath.'/plugin.vim')
+endfor
+call vam#ActivateAddons(addons)
+
+let $MYVIMRC=$TESTDIR.'/'.g:curtest.'-vimrc'
+call writefile(readfile(fnamemodify($TESTDIR, ':h').'/vimrc', 'b')+
+ \ ['call vam#ActivateAddons('.string(addons).')'],
+ \ $MYVIMRC)
+
+while getchar(1)
+ call getchar(0)
+endwhile
+call feedkeys('YYYYYYYY', 't')
+redir => g:messages
+execute 'AddonsBisect '.v:progname.' --cmd let\ g:noexe=1 --cmd let\ g:curtest='.string(g:curtest).' -c if\ exists("g:v2")|BADVAMBisect|else|OKVAMBisect|endif'
+redir END
+let msglines=split(g:messages, "\n")
+call WriteFile(filter(msglines[:-2], 'v:val =~ "\\v^E\\d+\\:"')+msglines[-1:])
View
@@ -51,6 +51,6 @@ function Try(cmd)
endtry
endfunction
command -nargs=1 Try :call Try(<q-args>)
-if filereadable(g:curtest.'.vim')
+if !exists('g:noexe') && filereadable(g:curtest.'.vim')
source `=g:curtest.".vim"`
endif

0 comments on commit 5781f5d

Please sign in to comment.