ZyX_I avatar ZyX_I committed 96825d6

Slightly reduced number of shell calls for non-python driver

Comments (0)

Files changed (8)

ftplugin/aurumannotate.vim

                 let dfile=file
             endif
             let existed=s:_r.run('silent edit', 'diff', bvar.repo, rev1, rev2,
-                        \        ((a:0 && a:1)?(''):(dfile)))
+                        \        ((a:0 && a:1)?([]):([dfile])), {})
         endif
     "▶2 `open' action
     elseif a:action is# 'open'

ftplugin/aurumstatus.vim

     elseif a:action is# 'revopen'
         call s:_r.run('silent edit', 'file', bvar.repo, rev1, file)
     elseif a:action is# 'fulldiff'
-        call s:_r.run('silent edit', 'diff', bvar.repo, rev1, rev2)
+        call s:_r.run('silent edit', 'diff', bvar.repo, rev1, rev2, [], {})
     elseif a:action is# 'revfulldiff'
-        call s:_r.run('silent edit', 'diff', bvar.repo, rev1)
+        call s:_r.run('silent edit', 'diff', bvar.repo, rev1,  '',  [], {})
     elseif a:action is# 'revvimdiff' || a:action is# 'vimdiff'
         let file1=s:_r.fname('file', bvar.repo, rev1, file)
         if empty(rev2) || a:action is# 'vimdiff'
         call map(copy(files), 'bvar.repo.functions.forget(bvar.repo, v:val)')
         silent edit!
     elseif a:action is# 'diff'
-        call s:_r.run('silent edit', 'diff', bvar.repo, rev1,  '',  files)
+        call s:_r.run('silent edit', 'diff', bvar.repo, rev1,  '',  files, {})
     elseif a:action is# 'revdiff'
-        call s:_r.run('silent edit', 'diff', bvar.repo, rev1, rev2, files)
+        call s:_r.run('silent edit', 'diff', bvar.repo, rev1, rev2, files, {})
     endif
 endfunction
 let s:_augroups+=['AuStatusCommit']

plugin/aurum/edit.vim

     endif
     file
 endfunction
+"▶1 checkcmd :: command → _ + :throw?
+function s:F.checkcmd(command)
+    if !has_key(s:commands, a:command)
+        call FraworLoad('@aurum/'.a:command)
+        if !has_key(s:commands, a:command)
+            call s:_f.throw('ucmd', a:command)
+        endif
+    endif
+endfunction
 "▶1 auefunc
 let s:okeys={
             \'list': 'map(split(opts[o],";"), "s:F.ounescape(v:val)")',
             \ 'num': '+opts[o]',
             \ 'str': 's:F.ounescape(opts[o])',
         \}
-" FIXME This code is creating repository object for the second time
 function s:auefunc.function(rw)
     " XXX On windows all forward slashes are transformed to backward in @%,
     "     all backward are transformed to forward in <amatch>
     if command is# 'copy' && a:rw>=0
         return s:F.copy(a:rw, tail)
     endif
-    if !has_key(s:commands, command)
-        call FraworLoad('@aurum/'.command)
-        if !has_key(s:commands, command)
-            call s:_f.throw('ucmd', command)
-        endif
-    endif
+    call s:F.checkcmd(command)
     "▶2 Launch bvar.write if applicable
     if a:rw==-1 && has_key(s:_r.bufvars,buf)            &&
                 \  has_key(s:_r.bufvars[buf], 'amatch') &&
 function s:F.run(vcommand, command, repo, ...)
     let file=call(s:F.fname, [a:command, a:repo]+a:000, {})
     let existed=bufexists(file)
-    if 0 && type(a:repo)==type({}) && has_key(s:commands, a:command) &&
-                \a:vcommand=~#'\v%(sil%[ent]\ )?%(edit|view)'
+    call s:F.checkcmd(a:command)
+    if type(a:repo)==type({}) && a:vcommand=~#'\v%(sil%[ent]\ )?%(edit|view)'
         try
             let savedei=&eventignore
             set eventignore+=BufReadCmd
             let &eventignore=savedei
         endtry
         setlocal modifiable noreadonly
-        " TODO Check how this interacts with changes made after repository
-        "      object was created
-        " FIXME Populate this with missing arguments
+        " FIXME Check how this interacts with changes made after repository
+        "       object was created
         silent call s:F.runcmd(s:commands[a:command], file, [0, a:repo]+a:000)
         if a:vcommand[:2] isnot# 'sil'
             file

plugin/aurum/status.vim

 endfunction
 let s:_augroups+=['AuStatusNoInsert']
 "▶1 statfunc
+let s:defcmd='silent botright new'
 function s:statfunc.function(repopath, opts)
     if has_key(a:opts, 'files') && a:repopath is# ':'
         let repo=s:_r.repo.get(a:opts.files[0])
     if has_key(a:opts, 'files')
         call map(a:opts.files, 'repo.functions.reltorepo(repo, v:val)')
     endif
-    let statf=s:_r.fname('status', repo, a:opts)
-    let cmd='silent botright new'
     if has_key(a:opts, 'cmd')
-        let cmd=a:opts.cmd
+        call s:_r.run(a:opts.cmd, 'status', repo, a:opts)
+    elseif s:_f.getoption('usestatwin') &&
+                \!empty(filter(tabpagebuflist(),
+                \              'bufname(v:val)=~#''\v^aurum:(.)\1status'''))
+        let statf=s:_r.fname('status', repo, a:opts)
+        if bufexists(statf) && bufwinnr(statf)!=-1
+            execute bufwinnr(statf).'wincmd w'
+            silent edit
+        else
+            call s:_r.run(s:defcmd, 'status', repo, a:opts)
+        endif
     else
-        if s:_f.getoption('usestatwin') && bufexists(statf)
-            let swnr=bufwinnr(statf)
-            if swnr!=-1
-                execute swnr.'wincmd w'
-                let cmd='silent edit'
-            endif
-        endif
+        call s:_r.run(s:defcmd, 'status', repo, a:opts)
     endif
-    execute cmd fnameescape(statf)
     if !has_key(a:opts, 'cmd')
         let lnum=line('$')
         if winnr('$')>1 && ((winheight(0)>lnum) ||

test/annotatemaps.ok

 *1: aurum://file:%ETMPDIR%%-test%-testrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
 #2: aurum://file:%ETMPDIR%%-test%-testrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
 {{{1 d
-*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh
+*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh:
 {{{1 c
-*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:chgrepo.zsh
+*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:chgrepo.zsh:
 {{{1 gd
-*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::
+*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:::
 {{{1 gc
-*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:
+*1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2::
 {{{1 K/J
 #1: aurum://annotate:%ETMPDIR%%-test%-annotatemapsrepo:0e6e0adf281b423193f9dce097ab1df4f91215f7:chgrepo.zsh
 *2: aurum://file:%ETMPDIR%%-test%-annotatemapsrepo:0e6e0adf281b423193f9dce097ab1df4f91215f7:chgrepo.zsh
 {{{1 o
 *1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 {{{1 gc
-*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:
+*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 c
-*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst
+*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 C
 *1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 #2: %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
 d: 1
 {{{1 gd
-*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62
+*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 d
-*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst
+*1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 D
 *1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 #2: %TMPDIR%/test/statmapsrepo/nohglinesrev.lst

test/wine/annotatemaps.ok

 *1: aurum:\\file:%ETMPDIR%%+test%+testrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
 #2: aurum:\\file:%ETMPDIR%%+test%+testrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
 {{{1 d
-*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh
+*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh:
 {{{1 c
-*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:chgrepo.zsh
+*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:chgrepo.zsh:
 {{{1 gd
-*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::
+*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:::
 {{{1 gc
-*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:
+*1: aurum:\\diff:%ETMPDIR%%+test%+annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2::
 {{{1 K/J
 #1: aurum:\\annotate:%ETMPDIR%%+test%+annotatemapsrepo:0e6e0adf281b423193f9dce097ab1df4f91215f7:chgrepo.zsh
 *2: aurum:\\file:%ETMPDIR%%+test%+annotatemapsrepo:0e6e0adf281b423193f9dce097ab1df4f91215f7:chgrepo.zsh

test/wine/statmaps.ok

 {{{1 o
 *1: aurum:\\file:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 {{{1 gc
-*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:
+*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 c
-*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst
+*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 C
 *1: aurum:\\file:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 #2: %TMPDIR%\test\statmapsrepo\nohglinesrev.lst
 d: 1
 {{{1 gd
-*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62
+*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 d
-*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst
+*1: aurum:\\diff:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 D
 *1: aurum:\\file:%ETMPDIR%%+test%+statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 #2: %TMPDIR%\test\statmapsrepo\nohglinesrev.lst
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.