Commits

ZyX_I committed f06f265

@aurum/diff: Added AuDiff FVdiff mapping. Ref #6
@aurum/cmdutils: Made last argument to getrrf non-numeric and thus more understandable

Comments (0)

Files changed (12)

 
   - Partially committing changes ([:AuRecord](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line356-0)).
 
-  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line587-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line157-0)).
+  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line589-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line157-0)).
 
   - Viewing uncommited changes in a vimdiff, as well as changes between 
     specific revisions ([:AuVimDiff](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line396-0)). It is also possible to open multiple 
   - Viewing working directory status ([:AuStatus](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line360-0)).
 
   - Commiting changes ([:AuCommit](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line98-0)), commit messages are remembered in case of 
-    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line845-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line852-0)).
 
   - Obtaining various URL’s out of remote repository URL (like URL of the HTML 
     version of the current file with URL fragment pointing to the current line 
 
   - Frontends for various other VCS commands.
 
-Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line729-0)), 
+Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line736-0)), 
 all mappings are customizable.
 
 
     all changes.
     Local mappings (mgid=AuDiff, without leader by default):
                                                           *g:frawormap_AuDiff*
-                         *g:frawormap_AuDiff_Next* *g:frawormap_AuDiff_Prev*
+                         *g:frawormap_AuDiff_Next* *g:frawormap_AuDiff_FVdiff*
+                         *g:frawormap_AuDiff_Prev* *g:frawormap_AuDiff_Vdiff*
                          *g:frawormap_AuDiff_Open* *g:frawormap_AuDiff_Update*
-                         *g:frawormap_AuDiff_Vdiff*    *aurum-m-AuDiff_Vdiff*
-                             *aurum-m-AuDiff_Next*     *aurum-m-AuDiff_Prev*
+                             *aurum-m-AuDiff_Next*     *aurum-m-AuDiff_FVdiff*
+                             *aurum-m-AuDiff_Prev*     *aurum-m-AuDiff_Vdiff*
                              *aurum-m-AuDiff_Open*     *aurum-m-AuDiff_Update*
     Mapname  LHS  Description ~
     Next      K   Change all revisions specified to aurum://diff to their 
                   and fallback to {rev2} version. If {rev1} is not empty, it 
                   will open {rev1} version.
     Vdiff     D   View diff section under cursor using |vimdiff|.
+    FVdiff    gD  View the whole diff in a multiple tabs using |vimdiff|.
 
     Note These mappings are defined only when buffer is created using 
          |:AuDiff| command or Prev/Next above mappings.
     if a:0==0
         let target='.'
         let files=[repo.functions.reltorepo(repo,
-                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3])]
+                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3])]
     elseif a:0==1 && isdirectory(a:1)
         let target=a:1
         let files=[repo.functions.reltorepo(repo,
-                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3])]
+                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3])]
     elseif a:0>1 && get(a:opts, 'rightrepl', 0)
         let patterns=map(a:000[:-2], 's:_r.globtopat('.
                     \                'repo.functions.reltorepo(repo,v:val), 1)')
     elseif a:0==2 && !isdirectory(a:2) && filewritable(a:1)
         let fst=a:1
         if fst is# ':'
-            let fst=s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3]
+            let fst=s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3]
         endif
         let moves = {repo.functions.reltorepo(repo, fst):
                     \repo.functions.reltorepo(repo, a:2)}
         endif
         let files=s:F.filterfiles(repo, globs, allfiles)
         if hascur
-            let files+=[s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3]]
+            let files+=[s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3]]
         endif
     endif
     if exists('files')
     if hascur
         let rrfopts={'repo': repo.path}
         let files+=[repo.functions.reltorepo(repo,
-                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3])]
+                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3])]
     endif
     for key in filter(['forget', 'remove', 'ignore'], 'eval(v:val)')
         call map(copy(files), 'repo.functions[key](repo, v:val)')
     if hascur
         let rrfopts={'repo': repo.path}
         let files+=[repo.functions.reltorepo(repo,
-                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', -1)[3])]
+                    \s:_r.cmdutils.getrrf(rrfopts, 'nocurf', 'getfile')[3])]
     endif
     call map(copy(files), 'repo.functions.add(repo, v:val)')
 endfunction
     let utype=get(opts, 'url', 'html')
     if utype is# 'html' || utype is# 'annotate' || utype is# 'raw'
                 \       || utype is# 'filehist'
-        let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'nocurf', 0)
+        let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'nocurf',
+                    \                                      'get')
         call s:_r.cmdutils.checkrepo(repo)
         let file=s:F.urlescape(file)
         if rev is 0

plugin/aurum/annotate.vim

 " TODO Investigate why wiping out annotate buffer causes consumption of next
 "      character under wine
 function s:annfunc.function(opts)
-    let [hasannbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'noafile', 1)
+    let [hasannbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'noafile',
+                \                                         'annotate')
     if repo is 0
         return
     endif

plugin/aurum/cmdutils.vim

     endif
     return file
 endfunction
-"▶1 rrf buffer functions :: bvar, opts, ann, failmsg → scope
+"▶1 rrf buffer functions :: bvar, opts, act, failmsg → scope
 let s:rrf={}
 "▶2 rrf.file : bvar → (repo, rev, file)
-function s:rrf.file(bvar, opts, ann, failmsg)
+function s:rrf.file(bvar, opts, act, failmsg)
     return {'hasbuf': 1,
            \  'repo': a:bvar.repo,
            \   'rev': a:bvar.rev,
            \  'file': a:bvar.file,}
 endfunction
 "▶2 rrf.copy : bvar → (file), file → (repo), 0 → (rev)
-function s:rrf.copy(bvar, opts, ann, failmsg)
+function s:rrf.copy(bvar, opts, act, failmsg)
     let r={}
-    if a:ann==-1
+    if a:act is# 'getfile'
         let r.file=a:bvar.file
     else
         let r.repo=s:_r.repo.get(s:_r.os.path.dirname(a:bvar.file))
     return r
 endfunction
 "▶2 rrf.status : bvar → (repo, rev), . → (file)
-function s:rrf.status(bvar, opts, ann, failmsg)
+function s:rrf.status(bvar, opts, act, failmsg)
     let r={}
     let r.repo=a:bvar.repo
     let  r.rev=get(a:bvar.opts, 'rev1', 0)
     else
         let r.file=a:bvar.files[line('.')-1]
     endif
-    if a:ann>=0
+    if a:act is# 'annotate' || a:act is# 'open'
         topleft new
     endif
     return r
 endfunction
 "▶2 rrf.diff : bvar → (repo, rev, file(s))
-function s:rrf.diff(bvar, opts, ann, failmsg)
+function s:rrf.diff(bvar, opts, act, failmsg)
     let r={}
     let r.repo=a:bvar.repo
     let  r.rev=empty(a:bvar.rev2) ? a:bvar.rev1 : a:bvar.rev2
-    " XXX Maybe it should pull in all filenames instead when ann=-2?
+    " XXX Maybe it should pull in all filenames instead when act='getfiles'?
     let r.file=s:F.getdifffile(a:bvar)
     if r.file is 0 && a:failmsg isnot 0
         return 0
     endif
-    if a:ann>=0
+    if a:act is# 'annotate' || a:act is# 'open'
         leftabove vnew
     endif
     return r
 endfunction
 "▶2 rrf.commit : bvar → (repo, file(s))
-function s:rrf.commit(bvar, opts, ann, failmsg)
+function s:rrf.commit(bvar, opts, act, failmsg)
     let r={}
     let r.repo=a:bvar.repo
-    if a:ann==-2
+    if a:act is# 'getfiles'
         let r.files=a:bvar.files
     else
         let r.file=s:F.getfile(a:bvar.files)
         if r.file is 0 && a:failmsg isnot 0
             return 0
         endif
-        if a:ann>=0
+        if a:act is# 'annotate' || a:act is# 'open'
             topleft new
         endif
     endif
     return r
 endfunction
 "▶2 rrf.annotate : bvar → (repo), . → (rev, file)
-function s:rrf.annotate(bvar, opts, ann, failmsg)
+function s:rrf.annotate(bvar, opts, act, failmsg)
     let r={}
     let r.repo=a:bvar.repo
-    if a:ann==-2
+    if a:act is# 'getfiles'
         let r.file=a:bvar.file
     else
         let r.file=a:bvar.files[line('.')-1]
         if !has_key(a:opts, 'rev')
             let r.rev=a:bvar.revisions[line('.')-1]
             if r.rev is# r.repo.functions.getrevhex(r.repo, a:bvar.rev)
-                if a:ann!=1
+                if a:act isnot# 'annotate'
                     " Don't do the following if we are not annotating
                 elseif has_key(a:bvar, 'annbuf') &&
                             \bufwinnr(a:bvar.annbuf)!=-1
                 return 0
             endif
         endif
-        if a:ann>=0
+        if a:act is# 'annotate' || a:act is# 'open'
             if winnr('$')>1
-                wincmd c
+                close
             endif
             if has_key(a:bvar, 'annbuf') && bufwinnr(a:bvar.annbuf)!=-1
                 execute bufwinnr(a:bvar.annbuf).'wincmd w'
     return r
 endfunction
 "▶2 rrf.log : bvar → repo, . → (rev), 0 → (file)
-function s:rrf.log(bvar, opts, ann, failmsg)
+function s:rrf.log(bvar, opts, act, failmsg)
     return {'repo': a:bvar.repo,
            \ 'rev': a:bvar.getblock(a:bvar)[2],
            \'file': 0,}
 endfunction
 "▲2
-"▶1 getrrf :: opts, failmsg, ann + buf → (hasbuf, repo, rev, file)
+"▶1 getrrf :: opts, failmsg, act + buf → (hasbuf, repo, rev, file)
 let s:rrffailresult=[0, 0, 0, 0]
-function s:F.getrrf(opts, failmsg, ann)
+function s:F.getrrf(opts, failmsg, act)
     let hasbuf=0
     let file=0
     "▶2 a:opts.file file → (repo?)
     if has_key(a:opts, 'file') && a:opts.file isnot# ':'
-        if a:ann!=-1 && a:opts.repo is# ':'
+        if a:act isnot# 'getfile' && a:opts.repo is# ':'
             let repo=s:_r.repo.get(s:_r.os.path.dirname(a:opts.file))
             let file=repo.functions.reltorepo(repo, a:opts.file)
         else
         if index(a:opts.files, ':')!=-1
             let newopts=copy(a:opts)
             unlet newopts.files
-            let [repo, rev, file]=s:F.getrrf(newopts, 'nocurf', -1)[1:]
+            let [repo, rev, file]=s:F.getrrf(newopts, 'nocurf', 'getfile')[1:]
             if repo is 0
                 unlet repo
                 let repo=s:_r.repo.get(file)
             endif
-            if a:ann!=-2 && repo isnot 0
+            if a:act isnot# 'getfiles' && repo isnot 0
                 let file=repo.functions.reltorepo(repo, file)
             endif
             let files+=[file]
                 \has_key(s:_r.bufvars[bufnr('%')], 'command')
         let bvar=s:_r.bufvars[bufnr('%')]
         if has_key(s:rrf, bvar.command)
-            let res=call(s:rrf[bvar.command], [bvar,a:opts,a:ann,a:failmsg], {})
+            let res=call(s:rrf[bvar.command], [bvar,a:opts,a:act,a:failmsg], {})
             if res is 0
                 return s:rrffailresult
             else
         endif
     "▶2 buf → (repo, file), (rev=0)
     elseif filereadable(expand('%'))
-        if a:ann==-1
+        if a:act is# 'getfile'
             let file=expand('%')
         else
             let repo=s:_r.repo.get(':')
         call repo.functions.updatechangesets(repo)
     endif
     "▲2
-    if a:ann!=-1
+    if a:act isnot# 'getfile'
         "▶2 repo
         if !exists('repo')
             let repo=s:_r.repo.get(a:opts.repo)
             let file=repo.functions.reltorepo(repo, file)
         endif
         "▶2 rev
-        if a:ann==-2
+        if a:act is# 'getfiles'
             let rev=0
         elseif has_key(a:opts, 'rev')
             let oldrev=0
         "▲2
     endif
     return [hasbuf, exists('repo') ? repo : 0, rev,
-                \((a:ann==-2)?
+                \((a:act is# 'getfiles')?
                 \   ((exists('files'))?
                 \       (files):
                 \   ((file is 0)?

plugin/aurum/commit.vim

     endif
     let [repo, rev, files]=s:_r.cmdutils.getrrf(rrfopts,
                 \                               ((a:0)?(0):('nocfile')),
-                \                               -2)[1:]
+                \                               'getfiles')[1:]
     call s:_r.cmdutils.checkrepo(repo)
     let status=repo.functions.status(repo)
     "▶2 Get file list

plugin/aurum/diff.vim

                     \                       'index(filelist, v:val)==-1')
     endfor
     if hascur
-        let curfile=s:_r.cmdutils.getrrf({'repo': ':'}, 'nocurf', -1)[3]
+        let curfile=s:_r.cmdutils.getrrf({'repo': ':'}, 'nocurf', 'getfile')[3]
         let curfile=repo.functions.reltorepo(repo, curfile)
         if index(csfiles, curfile)!=-1 && index(filelist, curfile)==-1
             let filelist+=[curfile]
                     \'close | '.
                     \'wincmd p | '.
                     \"endif\n"
+    elseif a:action is# 'fullvimdiff'
+        let cmd.=':AuVimDiff noonlymodified full '
+        if !empty(bvar.files)
+            let cmd.=join(map(copy(bvar.files), '"files ".'.
+                        \'escape(s:_r.cmdutils.globescape(v:val), " ")'))
+        endif
+        if empty(bvar.rev1)
+            let cmd.='curfile'
+        else
+            let cmd.=bvar.rev1
+        endif
+        let cmd.=' '.bvar.rev2."\n"
     endif
     return cmd
 endfunction
 call s:_f.mapgroup.add('AuDiff', {
-            \  'Next': {'lhs': 'K', 'rhs': ['next'    ]},
-            \  'Prev': {'lhs': 'J', 'rhs': ['previous']},
-            \'Update': {'lhs': 'U', 'rhs': ['update'  ]},
-            \  'Exit': {'lhs': 'X', 'rhs': ['exit'    ]},
-            \  'Open': {'lhs': 'o', 'rhs': ['open'    ]},
-            \ 'Vdiff': {'lhs': 'D', 'rhs': ['vimdiff' ]},
+            \  'Next': {'lhs':  'K', 'rhs': ['next'       ]},
+            \  'Prev': {'lhs':  'J', 'rhs': ['previous'   ]},
+            \'Update': {'lhs':  'U', 'rhs': ['update'     ]},
+            \  'Exit': {'lhs':  'X', 'rhs': ['exit'       ]},
+            \  'Open': {'lhs':  'o', 'rhs': ['open'       ]},
+            \ 'Vdiff': {'lhs':  'D', 'rhs': ['vimdiff'    ]},
+            \'FVdiff': {'lhs': 'gD', 'rhs': ['fullvimdiff']},
         \}, {'func': s:F.rundiffmap, 'silent': 1, 'mode': 'n', 'dontmap': 1,})
 "▶1 diff resource
 let s:diff= {'arguments': 2,

plugin/aurum/file.vim

     if a:file isnot 0 && a:file isnot# ':'
         let opts.file=a:file
     endif
-    let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(opts, 'noffile', 0)
+    let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(opts, 'noffile', 'open')
     if repo is 0
         return
     endif

plugin/aurum/log.vim

     let opts=copy(a:opts)
     if has_key(opts, 'files')
         if opts.files[0] is# ':'
-            let curfile=s:_r.cmdutils.getrrf(opts, 'nocurf', -1)[3]
+            let curfile=s:_r.cmdutils.getrrf(opts, 'nocurf', 'getfile')[3]
             if curfile is 0
                 call remove(opts.files, 0)
             else

plugin/aurum/vimdiff.vim

 " TODO exclude binary files from full diff
 function s:vimdfunc.function(opts, ...)
     "▶2 repo and revisions
-    let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 0, 0)
+    let full=get(a:opts, 'full', 0)
+    let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 0,
+                \                                      ((full)?('get'):
+                \                                              ('open')))
     call s:_r.cmdutils.checkrepo(repo)
     let revs=[]
     if rev isnot 0

test/audiffmaps.in

 D:call WriteFile(winnr('$'), expand('%:p'), bufname(winbufnr(winnr('#'))))
 :bwipeout
 :bwipeout
+:R AuDiff rev1 2
+gD:WTabs

test/audiffmaps.ok

 2
 %TMPDIR%/test/audiffmapsrepo/crepo.zsh
 aurum://file:%ETMPDIR%%-test%-audiffmapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
+ 1*1: aurum://diff:%ETMPDIR%%-test%-audiffmapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:dfe39aa48c6ddde158e42217548b531a45ff66e9::
+*2*1: aurum://file:%ETMPDIR%%-test%-audiffmapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
+*2#2: aurum://file:%ETMPDIR%%-test%-audiffmapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
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.