Commits

ZyX_I committed 74f9124

@%aurum/vimdiff: Cleaned up buffer closing code (both autocmd and mapping)
Added support for multiple diff targets in _r.vimdiff.split
Made :AuVimDiff always use _r.vimdiff.split
Some fixes to vimdiff closing code
ftplugin/*: Made ftplugins use new [fnameargs] calling convention
tests: Improved cmd-vimdiff tests (now renamed to cmd+maps-vimdiff)
Fixes #66

Comments (0)

Files changed (18)

autoload/aurum/file.vim

             let rev=bvar.repo.functions.getnthparent(bvar.repo, bvar.rev, 1).hex
             let file=s:_r.fname('file', bvar.repo, rev, bvar.file)
             let cmd.=':call call(<SNR>'.s:_sid.'_Eval("s:_r.vimdiff.split"), '.
-                        \       '['.string(file).", 0], {})\n:wincmd p\n"
+                        \       '['.string(file).", 0], {})\n"
         endif
     elseif a:action is# 'diff' || a:action is# 'revdiff'
         let opts='repo '.escape(bvar.repo.path, ' ')

autoload/aurum/vimdiff.vim

 "▶1 
 scriptencoding utf-8
-execute frawor#Setup('1.0', {'@%aurum/cmdutils': '4.0',
+execute frawor#Setup('1.1', {'@%aurum/cmdutils': '4.0',
             \                    '@%aurum/edit': '1.3',
             \                          '@aurum': '1.0',
             \                      '@/mappings': '0.0',
 let s:lastfullid=0
 "▶1 restore
 function s:F.restore(dbvar)
+    if empty(t:auvimdiff_diffbufvars)
+        unlet t:auvimdiff_diffbufvars
+        unlet t:auvimdiff_origbufvar
+        unlet t:auvimdiff_prevbuffers
+    endif
     augroup AuVimDiff
         autocmd! BufEnter,BufWipeOut <buffer>
     augroup END
-    unlet t:auvimdiff_diffbufvar
-    unlet t:auvimdiff_origbufvar
-    unlet t:auvimdiff_prevbuffers
     let hastickchange=0
+    if has_key(a:dbvar, 'diffsaved')
+        let buf=bufnr('%')
+        for [option, value] in items(a:dbvar.diffsaved)
+            call setbufvar(buf, '&'.option, value)
+        endfor
+    endif
     if !has_key(a:dbvar, 'changedtick') ||
                 \b:changedtick!=a:dbvar.changedtick
         let hastickchange=1
 "▶1 diffrestore
 let s:F.diffrestore={}
 "▶2 diffrestore.onotherenter
-function s:F.diffrestore.onotherenter(buf, dbvar, ddbvar)
+function s:F.diffrestore.onotherenter(buf, abuf, dbvar, ddbvars)
     if has_key(a:dbvar, 'bufnr')
         if bufexists(a:dbvar.bufnr)
             return
         else
-            call s:F.diffrestore.onwipe(a:buf, a:dbvar, a:ddbvar)
+            call s:F.diffrestore.onwipe(a:buf, a:abuf, a:dbvar, a:ddbvars)
         endif
     endif
-    return s:F.restore(a:ddbvar)
+    let ddbvar=remove(a:ddbvars, a:abuf)
+    return s:F.restore(a:ddbvars[a:abuf])
 endfunction
 "▶2 diffrestore.onenter
-function s:F.diffrestore.onenter(buf, dbvar, ddbvar)
-    if has_key(a:dbvar, 'diffbuf')
-        if bufexists(a:dbvar.diffbuf)
-            return
-        else
-            call s:F.diffrestore.onotherwipe(a:buf, a:dbvar, a:ddbvar)
-        endif
+function s:F.diffrestore.onenter(buf, abuf, dbvar, ddbvars)
+    if !empty(filter(copy(a:dbvar.diffbufs), 'bufwinnr(v:val)!=-1'))
+        return
     endif
-    return s:F.restore(a:ddbvar)
+    return s:F.restore(a:dbvar)
 endfunction
 "▶2 diffrestore.onotherwipe
-function s:F.diffrestore.onotherwipe(buf, dbvar, ddbvar)
-    for [option, value] in items(a:dbvar.diffsaved)
-        call setbufvar(a:buf, '&'.option, value)
-    endfor
-    unlet a:dbvar.diffbuf
-    unlet a:ddbvar.bufnr
-    if bufnr('%')==a:buf
-        call s:F.diffrestore.onenter(a:buf, a:dbvar, a:ddbvar)
-    endif
+function s:F.diffrestore.onotherwipe(buf, abuf, dbvar, ddbvars)
+    call filter(a:dbvar.diffbufs, 'v:val isnot '.a:abuf)
+    unlet a:ddbvars[a:abuf]
 endfunction
 "▶2 diffrestore.onwipe
-function s:F.diffrestore.onwipe(buf, dbvar, ddbvar)
-    let dbuf=a:ddbvar.bufnr
-    unlet a:dbvar.bufnr
-    unlet a:ddbvar.srcbuf
-    if a:ddbvar.existed
-        for [option, value] in items(a:ddbvar.diffsaved)
-            call setbufvar(a:ddbvar.bufnr, '&'.option, value)
-        endfor
-    else
-        if bufexists(dbuf)
-            call feedkeys("\<C-\>\<C-n>:bwipeout ".dbuf."\n", 'n')
-        endif
-        return
-    endif
-    if bufnr('%')==a:ddbvar.bufnr
-        call s:F.diffrestore.onotherenter(a:buf, a:dbvar, a:ddbvar)
+function s:F.diffrestore.onwipe(buf, abuf, dbvar, ddbvars)
+    call map(copy(a:ddbvars), 'remove(v:val, "srcbuf")')
+    let toremove=keys(filter(copy(a:ddbvars),
+                \            '!v:val.existed && bufexists(v:val.bufnr)'))
+    if !empty(toremove)
+        call feedkeys("\<C-\>\<C-n>:silent bwipeout ".join(toremove)."\n", 'n')
     endif
 endfunction
 "▶2 diffrestore.call
 function s:F.diffrestore.call(buf, func)
     if !bufexists(a:buf) || !exists('t:auvimdiff_origbufvar') ||
                 \t:auvimdiff_origbufvar.bufnr!=a:buf ||
-                \!exists('t:auvimdiff_diffbufvar')
+                \!exists('t:auvimdiff_diffbufvars')
         return
     endif
     let dbvar=t:auvimdiff_origbufvar
-    let ddbvar=t:auvimdiff_diffbufvar
-    return s:F.diffrestore[a:func](a:buf, dbvar, ddbvar)
+    let ddbvars=t:auvimdiff_diffbufvars
+    return s:F.diffrestore[a:func](a:buf, +expand('<abuf>'), dbvar, ddbvars)
 endfunction
 "▶1 findwindow
 function s:F.findwindow()
         endif
     endfor
 endfunction
+"▶1 open :: cmd, target::Either path fnameargs → existed::Bool
+function s:F.open(cmd, target)
+    if type(a:target)==type('')
+        let r=bufexists(a:target)
+        execute 'silent' a:cmd fnameescape(a:target)
+        return r
+    else
+        return call(s:_r.mrun, ['silent '.a:cmd]+a:target, {})
+    endif
+endfunction
 "▶1 diffsplit
-function s:F.diffsplit(difftarget, usewin)
+function s:F.diffsplit(difftargets, usewin)
+    "▶2 Open new tab if current already has diffsplit
     if !empty(filter(range(1, winnr('$')), 'getwinvar(v:val, "&diff")'))
         tab split
     endif
+    "▶2 Compatibility: allow one difftarget appear as string
+    if type(a:difftargets)==type('')
+        let difftargets=[a:difftargets]
+    else
+        let difftargets=a:difftargets
+    endif
+    "▲2
     let buf=bufnr('%')
-    let t:auvimdiff_origbufvar={'bufnr': buf}
-    let t:auvimdiff_diffbufvar={}
-    let existed=bufexists(a:difftarget)
+    let t:auvimdiff_origbufvar={'bufnr': buf, 'diffbufs': []}
+    let t:auvimdiff_diffbufvars={}
     let dbvar=t:auvimdiff_origbufvar
-    let ddbvar=t:auvimdiff_diffbufvar
-    let filetype=&filetype
+    let dbvar.changedtick=b:changedtick
     call s:F.save(buf, dbvar)
     call s:_f.mapgroup.map('AuVimDiff', buf)
     let vertical=(stridx(&diffopt, 'vertical')!=-1)
     let splitcmd=((vertical)?('v'):('')).'split'
-    "▶2 `usewin' option support
-    " Uses left/right or upper/lower window if it has similar dimensions
-    if (a:usewin==-1 ? s:_f.getoption('vimdiffusewin') : a:usewin)
-                \&& winnr('$')>1
+    let filetype=&filetype
+    diffthis
+    let i=0
+    for difftarget in difftargets
+        let ddbvar={}
+        "▶2 Open other buffer, respecting “usewin” option
+        " Uses left/right or upper/lower window if it has similar dimensions
+        if (!i && (a:usewin==-1 ? s:_f.getoption('vimdiffusewin') : a:usewin))
+                    \&& winnr('$')>1 && s:F.findwindow()
+            let prevbuf=s:_r.prevbuf()
+            let existed=s:F.open('edit', difftarget)
+        else
+            let existed=s:F.open(splitcmd, difftarget)
+        endif
+        "▲2
+        let dbuf=bufnr('%')
+        if existed
+            call s:F.save(dbuf, ddbvar)
+        else
+            setlocal bufhidden=wipe
+        endif
         diffthis
-        if s:F.findwindow()
-            let prevbuf=s:_r.prevbuf()
-            execute 'silent edit' fnameescape(a:difftarget)
-        else
-            execute 'silent' splitcmd fnameescape(a:difftarget)
+        if &filetype isnot# filetype
+            let ddbvar.filetype=&filetype
+            let &filetype=filetype
         endif
-    else
-        diffthis
-        execute 'silent' splitcmd fnameescape(a:difftarget)
-    endif
-    "▲2
-    if existed
-        call s:F.save(dbuf, ddbvar)
-    endif
-    diffthis
+        let t:auvimdiff_diffbufvars[dbuf]=ddbvar
+        let t:auvimdiff_prevbuffers={dbuf : 0}
+        let ddbvar.bufnr=dbuf
+        let ddbvar.srcbuf=buf
+        let ddbvar.existed=existed
+        if exists('prevbuf')
+            let ddbvar.prevbuf=prevbuf
+            let t:auvimdiff_prevbuffers[dbuf]=prevbuf
+        endif
+        let dbvar.diffbufs+=[dbuf]
+        call s:_f.mapgroup.map('AuVimDiff', dbuf)
+        augroup AuVimDiff
+            execute 'autocmd BufEnter   <buffer='.dbuf.'> '.
+                        \':call s:F.diffrestore.call('.buf.', "onotherenter")'
+            execute 'autocmd BufWipeOut <buffer='.dbuf.'> '.
+                        \':call s:F.diffrestore.call('.buf.', "onotherwipe")'
+        augroup END
+        let i+=1
+    endfor
     execute bufwinnr(buf).'wincmd w'
     call cursor(dbvar.cursor)
-    wincmd p
-    if &filetype isnot# filetype
-        let ddbvar.filetype=&filetype
-        let &filetype=filetype
-    endif
-    let dbuf=bufnr('%')
-    let t:auvimdiff_prevbuffers={dbuf : 0}
-    let t:auvimdiff_diffbufvar.bufnr=dbuf
-    let ddbvar.srcbuf=buf
-    let ddbvar.existed=existed
-    if exists('prevbuf')
-        let ddbvar.prevbuf=prevbuf
-        let t:auvimdiff_prevbuffers[dbuf]=prevbuf
-    endif
-    let dbvar.diffbuf=dbuf
-    let dbvar.changedtick=b:changedtick
-    call s:_f.mapgroup.map('AuVimDiff', dbuf)
     augroup AuVimDiff
-        execute 'autocmd BufEnter   <buffer> '.
-                    \':call s:F.diffrestore.call('.buf.', "onotherenter")'
-        execute 'autocmd BufWipeOut <buffer> '.
-                    \':call s:F.diffrestore.call('.buf.', "onotherwipe")'
         execute 'autocmd BufEnter   <buffer='.buf.'> '.
                     \':call s:F.diffrestore.call('.buf.', "onenter")'
         execute 'autocmd BufWipeOut <buffer='.buf.'> '.
                     \"endif\n"
         return cmd
     "▶2 diffsplit() was not used
-    elseif !exists('t:auvimdiff_diffbufvar') ||
+    elseif !exists('t:auvimdiff_diffbufvars') ||
                 \!exists('t:auvimdiff_origbufvar') ||
-                \(buf!=t:auvimdiff_diffbufvar.bufnr &&
+                \(!has_key(t:auvimdiff_diffbufvars, buf) &&
                 \ buf!=t:auvimdiff_origbufvar.bufnr)
         if &diff && exists('t:auvimdiff_prevbuffers')
             for dbuf in map(filter(range(1, winnr('$')),
     endif
     "▲2
     let dbvar=t:auvimdiff_origbufvar
-    let ddbvar=t:auvimdiff_diffbufvar
     let isorig=(buf==dbvar.bufnr)
     call s:_f.mapgroup.unmap('AuVimDiff', buf)
     let cmd.=":diffoff!\n"
     "▶2 Original buffer
-    if isorig
-        if bufexists(dbvar.diffbuf)
-            call s:_f.mapgroup.unmap('AuVimDiff', dbvar.diffbuf)
-            if bufwinnr(dbvar.diffbuf)!=-1
-                if has_key(ddbvar, 'prevbuf') && bufexists(ddbvar.prevbuf)
-                    let cmd.=':'.bufwinnr(dbvar.diffbuf)."wincmd w\n".
-                                \':buffer '.ddbvar.prevbuf."\n".
-                                \"\<C-w>p"
-                endif
-                if !ddbvar.existed
-                    let cmd.=':if bufexists('.dbvar.diffbuf.') | '.
-                                \   'bwipeout '.dbvar.diffbuf.' | '.
-                                \"endif\n"
-                endif
-            else
-                let cmd.=':if bufexists('.dbvar.diffbuf.') | '.
-                            \   'bwipeout '.dbvar.diffbuf.' | '.
+    for ddbvar in filter(values(t:auvimdiff_diffbufvars),
+                \        'bufexists(v:val.bufnr)')
+        call s:_f.mapgroup.unmap('AuVimDiff', ddbvar.bufnr)
+        let bwnr=bufwinnr(ddbvar.bufnr)
+        if bwnr!=-1
+            if has_key(ddbvar, 'prevbuf') && bufexists(ddbvar.prevbuf)
+                let cmd.=':'.bwnr."wincmd w\n".
+                            \':buffer '.ddbvar.prevbuf."\n".
+                            \"\<C-w>p"
+            endif
+            if !ddbvar.existed
+                let cmd.=':if bufexists('.ddbvar.bufnr.') | '.
+                            \   'bwipeout '.ddbvar.bufnr.' | '.
                             \"endif\n"
             endif
-        endif
-        let cmd.=':call <SNR>'.s:_sid."_Eval(".
-                    \               "'s:F.diffrestore.call(".buf.", ".
-                    \                                     "''onotherwipe'')')\n"
-    "▶2 Opened buffer
-    else
-        if has_key(ddbvar, 'prevbuf') && bufexists(ddbvar.prevbuf)
-            let cmd.=':buffer '.ddbvar.prevbuf."\n"
-        endif
-        if bufexists(ddbvar.srcbuf)
-            call s:_f.mapgroup.unmap('AuVimDiff', ddbvar.srcbuf)
-            if bufwinnr(ddbvar.srcbuf)!=-1
-                let cmd.=':'.bufwinnr(ddbvar.srcbuf)."wincmd w\n"
-            endif
-        endif
-        if !ddbvar.existed
-            let cmd.=':if bufexists('.buf.') | '.
-                        \   'bwipeout '.buf.' | '.
+        else
+            let cmd.=':if bufexists('.ddbvar.bufnr.') | '.
+                        \   'bwipeout '.ddbvar.bufnr.' | '.
                         \"endif\n"
         endif
-        let cmd.=':call <SNR>'.s:_sid."_Eval(".
-                    \               "'s:F.diffrestore.call(".ddbvar.srcbuf.", ".
-                    \                                     "''onotherwipe'')')\n"
+    endfor
+    "▶2 Opened buffer
+    if bufexists(dbvar.bufnr)
+        call s:_f.mapgroup.unmap('AuVimDiff', dbvar.bufnr)
+        if bufwinnr(dbvar.bufnr)!=-1
+            let cmd.=':'.bufwinnr(ddbvar.srcbuf)."wincmd w\n"
+        endif
     endif
     "▲2
     return cmd
         let t:auvimdiff_prevbuffers[bufnr('%')]=prevbuf
         let fbuf=bufnr('%')
     endif
-    call s:_f.mapgroup.map('AuVimDiff', fbuf)
     "▶2 Open subsequent buffers
-    let i=0
-    for rev in a:revs[1:]
-        if rev is 0
-            let f=a:file
-        else
-            let f=s:_r.fname('file', a:repo, rev, a:file)
-        endif
-        if !i && a:hasbuf && len(a:revs)==2
-            let existed=bufexists(f)
-            call s:F.diffsplit(f, a:usewin)
-            if !existed
-                setlocal bufhidden=wipe
-            endif
-        else
-            if !i && a:usewin && winnr('$')>1
-                diffthis
-                if s:F.findwindow()
-                    let prevbuf=s:_r.prevbuf()
-                    execute 'silent edit' fnameescape(f)
-                    diffthis
-                    let t:auvimdiff_prevbuffers[bufnr('%')]=prevbuf
-                else
-                    execute 'silent diffsplit' fnameescape(f)
-                    let t:auvimdiff_prevbuffers[bufnr('%')]=0
-                endif
-            else
-                execute 'silent diffsplit' fnameescape(f)
-                let t:auvimdiff_prevbuffers[bufnr('%')]=0
-            endif
-            call s:_f.mapgroup.map('AuVimDiff', bufnr('%'))
-        endif
-        let i+=1
-    endfor
+    let difftargets=map(a:revs[1:],
+                \'((v:val is 0)?'.
+                \   '(a:file):'.
+                \   '(["file", a:repo, v:val, a:file]))')
+    call s:F.diffsplit(difftargets, a:usewin)
     "▲2
     return fbuf
 endfunction
     0.1: Added full, untracked, onlymodified and files options to |:AuVimDiff|
     0.2: Added _r.vimdiff.full.
     1.0: Renamed g:aurum_usewin option to |g:aurum_vimdiffusewin|.
+    1.1: Made _r.vimdiff.split accept multiple difftargets and a list of 
+         _r.fname args as a single difftarget
 @%aurum/log:
     0.1: Added |aurum-style-git| and |aurum-style-gitoneline| log styles, 
          added skipping of $rev if |aurum-repo.hasrevisions| is false, made it 

ftplugin/aurumannotate.vim

 setlocal noswapfile
 setlocal nomodeline
 execute frawor#Setup('0.0', {'@%aurum/bufvars': '0.0',
-            \                '@%aurum/vimdiff': '1.0',
+            \                '@%aurum/vimdiff': '1.1',
             \               '@%aurum/annotate': '1.0',
             \               '@%aurum/cmdutils': '4.0',
             \               '@%aurum/maputils': '0.0',
                     setlocal bufhidden=wipe
                     unlet existed
                 endif
-                call s:_r.vimdiff.split(s:_r.fname('file',bvar.repo,rev2,file),
-                            \           -1)
-                if empty(rev1)
-                    wincmd p
-                endif
+                call s:_r.vimdiff.split([['file', bvar.repo, rev2, file]], -1)
             endif
         else
             if empty(rev1)

ftplugin/aurumlog.vim

             \                '@%aurum/maputils': '0.0',
             \                 '@%aurum/bufvars': '0.0',
             \                    '@%aurum/edit': '1.0',
-            \                 '@%aurum/vimdiff': '1.0',
+            \                 '@%aurum/vimdiff': '1.1',
             \                            '@/os': '0.0',
             \                      '@/mappings': '0.0',})
 let s:_messages={
     if a:0 && a:1
         execute 'silent edit'
                     \ fnameescape(s:_r.os.path.join(a:bvar.repo.path, a:file))
-        call s:_r.vimdiff.split(s:_r.fname('file',a:bvar.repo,a:hex,a:file), 0)
+        call s:_r.vimdiff.split([['file', a:bvar.repo, a:hex, a:file]], 0)
     elseif !empty(cs.parents)
         call s:_r.run('silent edit', 'file', a:bvar.repo, a:hex, a:file)
-        call s:_r.vimdiff.split(s:_r.fname('file', a:bvar.repo, cs.parents[0],
-                    \                      a:file), 0)
+        call s:_r.vimdiff.split([['file', a:bvar.repo, cs.parents[0], a:file]],
+                    \           0)
     else
         call s:_f.throw('nopars', a:hex)
     endif

ftplugin/aurumstatus.vim

 setlocal noswapfile
 setlocal nomodeline
 execute frawor#Setup('0.0', {'@%aurum/bufvars': '0.0',
-            \                '@%aurum/vimdiff': '1.0',
+            \                '@%aurum/vimdiff': '1.1',
             \               '@%aurum/cmdutils': '4.0',
             \                   '@%aurum/edit': '1.2',
             \                 '@%aurum/commit': '1.0',
             else
                 call call(s:_r.run, ['silent view']+fargs2, {})
             endif
-            call s:_r.vimdiff.split(call(s:_r.fname, fargs1, {}), -1)
+            call s:_r.vimdiff.split([fargs1], -1)
         endif
     elseif a:action is# 'annotate'
         call s:_r.mrun('silent edit', 'file', bvar.repo, rev1, file)

test/cmd+maps-vimdiff.in

+:W{{{1 status
+:R AuStatus
+/^M
+:AuVimDiff
+:WW
+:bwipeout!
+:bwipeout!
+:bwipeout!
+:bwipeout!
+:W{{{1 file
+:AuVimDiff file hgtestrepo/nohglinesrev.lst
+:WW
+:bwipeout!
+:bwipeout!
+:W{{{1 file+rev
+:AuVimDiff file hgtestrepo/chgrepo.zsh 18
+:WW
+:bwipeout!
+:bwipeout!
+:W{{{1 file+rev+rev
+:AuVimDiff file hgtestrepo/chgrepo.zsh 18 16
+:WW
+:bwipeout!
+:bwipeout!
+:W{{{1 file+rev+rev+curfile
+:AuVimDiff file hgtestrepo/chgrepo.zsh curfile 18 16
+:WW
+:bwipeout!
+:bwipeout!
+:bwipeout!
+:W{{{1 close mapping
+:R AuVimDiff file nohglinesrev.lst
+:WW
+,X:WW
+:bwipeout!
+:W{{{1 close mapping in other buffer
+:R AuVimDiff file nohglinesrev.lst
+:wincmd w
+,X:WW
+:bwipeout!
+:W{{{1 closing on other wipe
+:R AuVimDiff file nohglinesrev.lst
+:wincmd w
+:bwipeout!
+:WW
+:call WriteFile('diff: '.&diff)
+:bwipeout!
+:W{{{1 closing on wipe
+:R AuVimDiff file nohglinesrev.lst
+:bwipeout!
+:WW
+:W{{{1 closing on wipe if other existed
+:R AuFile : nohglinesrev.lst
+:R AuVimDiff file nohglinesrev.lst
+:bwipeout!
+:WW
+:bwipeout!
+:W{{{1 multiple revisions: other wipe
+:AuVimDiff file hgtestrepo/chgrepo.zsh curfile 18 16
+:wincmd k
+:bwipeout!
+:WW
+:call WriteFile('diff: '.&diff)
+:W{{{1 second wipe
+:wincmd k
+:bwipeout!
+:WW
+:call WriteFile('diff: '.&diff)
+:bwipeout!
+:W{{{1 multiple revisions: close mapping
+:AuVimDiff file hgtestrepo/chgrepo.zsh curfile 18 16
+,X:WW
+:bwipeout!
+:W{{{1 multiple revisions: close other mapping
+:AuVimDiff file hgtestrepo/chgrepo.zsh curfile 18 16
+:wincmd k
+,X:WW
+:bwipeout!
+:source addmessages.vim

test/cmd+maps-vimdiff.ok

+{{{1 status
+#1: aurum://file:%ETMPDIR%%-test%-cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%/test/cmd+maps-vimdiffrepo/nohglinesrev.lst
+ 3: 
+ 4: aurum://status:%ETMPDIR%%-test%-cmd+maps-vimdiffrepo:
+{{{1 file
+#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%/test/hgtestrepo/nohglinesrev.lst
+{{{1 file+rev
+#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+*2: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
+{{{1 file+rev+rev
+#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+*2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+{{{1 file+rev+rev+curfile
+#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+ 2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+*3: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
+{{{1 close mapping
+#1: aurum://file:%ETMPDIR%%-test%-cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%/test/cmd+maps-vimdiffrepo/nohglinesrev.lst
+*1: %TMPDIR%/test/cmd+maps-vimdiffrepo/nohglinesrev.lst
+{{{1 close mapping in other buffer
+*1: %TMPDIR%/test/cmd+maps-vimdiffrepo/nohglinesrev.lst
+{{{1 closing on other wipe
+*1: %TMPDIR%/test/cmd+maps-vimdiffrepo/nohglinesrev.lst
+diff: 0
+{{{1 closing on wipe
+*1: 
+{{{1 closing on wipe if other existed
+*1: aurum://file:%ETMPDIR%%-test%-cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+{{{1 multiple revisions: other wipe
+ 1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+*2: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
+diff: 1
+{{{1 second wipe
+*1: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
+diff: 0
+{{{1 multiple revisions: close mapping
+*1: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
+{{{1 multiple revisions: close other mapping
+*1: %TMPDIR%/test/hgtestrepo/chgrepo.zsh

test/cmd-vimdiff.in

-:W{{{1 status
-:R AuStatus
-/^M
-:AuVimDiff
-:WW
-:bwipeout!
-:bwipeout!
-:bwipeout!
-:bwipeout!
-:W{{{1 file
-:AuVimDiff file hgtestrepo/nohglinesrev.lst
-:WW
-:bwipeout!
-:bwipeout!
-:W{{{1 file+rev
-:AuVimDiff file hgtestrepo/chgrepo.zsh 18
-:WW
-:bwipeout!
-:bwipeout!
-:W{{{1 file+rev+rev
-:AuVimDiff file hgtestrepo/chgrepo.zsh 18 16
-:WW
-:bwipeout!
-:bwipeout!
-:W{{{1 file+rev+rev+curfile
-:AuVimDiff file hgtestrepo/chgrepo.zsh curfile 18 16
-:WW
-:bwipeout!
-:bwipeout!
-:bwipeout!
-:source addmessages.vim

test/cmd-vimdiff.ok

-{{{1 status
-#1: aurum://file:%ETMPDIR%%-test%-cmd-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2: %TMPDIR%/test/cmd-vimdiffrepo/nohglinesrev.lst
- 3: 
- 4: aurum://status:%ETMPDIR%%-test%-cmd-vimdiffrepo:
-{{{1 file
-#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2: %TMPDIR%/test/hgtestrepo/nohglinesrev.lst
-{{{1 file+rev
-#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-*2: %TMPDIR%/test/hgtestrepo/chgrepo.zsh
-{{{1 file+rev+rev
-#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
-*2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-{{{1 file+rev+rev+curfile
-#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
- 2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-*3: %TMPDIR%/test/hgtestrepo/chgrepo.zsh

test/gentests-setuptestrepos.zsh

 unxz svntestreposerver.tar.xz
 
 for test in cmd-annotate-buffers cmd+maps-commit cmd-record cmd-status \
-            maps-status cmd-vimdiff cmd-diff cmd-update opts-remembermsg \
+            maps-status cmd+maps-vimdiff cmd-diff cmd-update opts-remembermsg \
             opts-vimdiffusewin cmd-vimdiff-full cmdaus
 do
     ln -s util-add-modified-repo.zsh $test.pre

test/maps-annotate.ok

 #1: aurum://file:%ETMPDIR%%-test%-maps-annotaterepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
 *2: %TMPDIR%/test/maps-annotaterepo/chgrepo.zsh
 {{{1 C
-*1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
-#2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
+#1: aurum://file:%ETMPDIR%%-test%-hgtestrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
+*2: aurum://file:%ETMPDIR%%-test%-hgtestrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
 {{{1 d
 *1: aurum://diff:%ETMPDIR%%-test%-maps-annotaterepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh:
 {{{1 c
 :W{{{1 D
 :R AuLog
 / 1:\x\x\x
-D:call WriteFile(bufname('%'), 'w$: '.winnr('$'))
+D:WW
 :bwipeout!
 :bwipeout!
 :W{{{1 C
 :R AuLog
 / 2:\x\x\x
-C:call WriteFile(bufname('%'), 'w$: '.winnr('$'))
+C:WW
 :bwipeout!
 :bwipeout!
 :W{{{1 o+files
 aurum://diff:%ETMPDIR%%-test%-maps-logrepo::dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh:
 w$: 1
 {{{1 D
-aurum://file:%ETMPDIR%%-test%-maps-logrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
-w$: 2
+#1: aurum://file:%ETMPDIR%%-test%-maps-logrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
+*2: %TMPDIR%/test/maps-logrepo/crepo.zsh
 {{{1 C
-aurum://file:%ETMPDIR%%-test%-maps-logrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
-w$: 2
+#1: aurum://file:%ETMPDIR%%-test%-maps-logrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
+*2: aurum://file:%ETMPDIR%%-test%-maps-logrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
 {{{1 o+files
 aurum://file:%ETMPDIR%%-test%-maps-logrepo:504f74154456dbb0e9441326514e42ce66279e62:.hgignore
 {{{1 o

test/maps-status.ok

 {{{1 c
 *1: aurum://diff:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 C
-*1: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-#2: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:d8140c0b7b0b670bafe0891bcf0c4582092de884:nohglinesrev.lst
+#1: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:d8140c0b7b0b670bafe0891bcf0c4582092de884:nohglinesrev.lst
 d: 1
 {{{1 2C
  1#1: 
 {{{1 d
 *1: aurum://diff:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62::nohglinesrev.lst:
 {{{1 D
-*1: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-#2: %TMPDIR%/test/maps-statusrepo/nohglinesrev.lst
+#1: aurum://file:%ETMPDIR%%-test%-maps-statusrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%/test/maps-statusrepo/nohglinesrev.lst
 d: 1
 {{{1 2D
  1#1: 

test/wine/cmd+maps-vimdiff.ok

+{{{1 status
+#1: aurum:\\file:%ETMPDIR%%+test%+cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%\test\cmd+maps-vimdiffrepo\nohglinesrev.lst
+ 3: 
+ 4: aurum:\\status:%ETMPDIR%%+test%+cmd+maps-vimdiffrepo:
+{{{1 file
+#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%\test\hgtestrepo\nohglinesrev.lst
+{{{1 file+rev
+#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+*2: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
+{{{1 file+rev+rev
+#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+*2: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+{{{1 file+rev+rev+curfile
+#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+ 2: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
+*3: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
+{{{1 close mapping
+#1: aurum:\\file:%ETMPDIR%%+test%+cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2: %TMPDIR%\test\cmd+maps-vimdiffrepo\nohglinesrev.lst
+*1: %TMPDIR%\test\cmd+maps-vimdiffrepo\nohglinesrev.lst
+{{{1 close mapping in other buffer
+*1: %TMPDIR%\test\cmd+maps-vimdiffrepo\nohglinesrev.lst
+{{{1 closing on other wipe
+*1: %TMPDIR%\test\cmd+maps-vimdiffrepo\nohglinesrev.lst
+diff: 0
+{{{1 closing on wipe
+*1: 
+{{{1 closing on wipe if other existed
+*1: aurum:\\file:%ETMPDIR%%+test%+cmd+maps-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+{{{1 multiple revisions: other wipe
+ 1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
+*2: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
+diff: 1
+{{{1 second wipe
+*1: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
+diff: 0
+{{{1 multiple revisions: close mapping
+*1: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
+{{{1 multiple revisions: close other mapping
+*1: %TMPDIR%\test\hgtestrepo\chgrepo.zsh

test/wine/cmd-vimdiff.ok

-{{{1 status
-#1: aurum:\\file:%ETMPDIR%%+test%+cmd-vimdiffrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2: %TMPDIR%\test\cmd-vimdiffrepo\nohglinesrev.lst
- 3: 
- 4: aurum:\\status:%ETMPDIR%%+test%+cmd-vimdiffrepo:
-{{{1 file
-#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2: %TMPDIR%\test\hgtestrepo\nohglinesrev.lst
-{{{1 file+rev
-#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-*2: %TMPDIR%\test\hgtestrepo\chgrepo.zsh
-{{{1 file+rev+rev
-#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
-*2: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-{{{1 file+rev+rev+curfile
-#1: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:462a1e95be86f96aaf6d7360f6f770826c3eb641:chgrepo.zsh
- 2: aurum:\\file:%ETMPDIR%%+test%+hgtestrepo:f44a21859e57e4abc6155da804d08dd5069e798e:chgrepo.zsh
-*3: %TMPDIR%\test\hgtestrepo\chgrepo.zsh

test/wine/vimdiff-full.ok

-{{{1 full
- 1*1: 
-*2*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-{{{1 ,X
-*1*1: 
-{{{1 noonlymodified
- 1*1: 
- 2*1: 
- 2#2: %TMPDIR%\test\vimdiff-fullrepo\addeddef
- 3*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:hglines2.lst
- 3#2: 
-*4*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*4#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-{{{1 untracked
- 1*1: 
- 2*1: 
- 2#2: %TMPDIR%\test\vimdiff-fullrepo\addeddef
- 3*1: 
- 3#2: %TMPDIR%\test\vimdiff-fullrepo\hglinesrev.lst
- 4*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:hglines2.lst
- 4#2: 
- 5*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
- 5#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-*6*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglines.lst
-*6#2: 
-{{{1 noonlymodified files *.lst
- 1*1: 
- 2*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
- 2#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-*3*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:hglines2.lst
-*3#2: 
-{{{1 files :
- 1*1: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-*2*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst
-{{{1 files repo/*.lst
- 1*1: 
-*2*1: aurum:\\file:%ETMPDIR%%+test%+vimdiff-fullrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
-*2#2: %TMPDIR%\test\vimdiff-fullrepo\nohglinesrev.lst