ZyX_I avatar ZyX_I committed 9d17788

ftplugin/aurumannotate: Added FVdiff and RFVdiff mappings. Fixes #6

Comments (0)

Files changed (5)

 
   - 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#line589-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#line595-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#line860-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line866-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#line744-0)), 
+Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line750-0)), 
 all mappings are customizable.
 
 
     Local mappings (mgid=AuAnnotate, without leader by default) (current 
     revision=revision under cursor):                  *g:frawormap_AuAnnotate*
              *g:frawormap_AuAnnotate_Enter*  *g:frawormap_AuAnnotate_Fdiff*
-             *g:frawormap_AuAnnotate_RFdiff* *g:frawormap_AuAnnotate_Diff*
+             *g:frawormap_AuAnnotate_RFdiff* *g:frawormap_AuAnnotate_FVdiff*
+             *g:frawormap_AuAnnotate_Diff*   *g:frawormap_AuAnnotate_RFVdiff*
              *g:frawormap_AuAnnotate_Rdiff*  *g:frawormap_AuAnnotate_Annotate*
              *g:frawormap_AuAnnotate_RVdiff* *g:frawormap_AuAnnotate_Open*
              *g:frawormap_AuAnnotate_Update* *g:frawormap_AuAnnotate_Next*
              *g:frawormap_AuAnnotate_Prev*       *aurum-m-AuAnnotate_Prev*
                  *aurum-m-AuAnnotate_Enter*      *aurum-m-AuAnnotate_Fdiff*
-                 *aurum-m-AuAnnotate_RFdiff*     *aurum-m-AuAnnotate_Diff*
+                 *aurum-m-AuAnnotate_RFdiff*     *aurum-m-AuAnnotate_FVdiff*
+                 *aurum-m-AuAnnotate_Diff*       *aurum-m-AuAnnotate_RFVdiff*
                  *aurum-m-AuAnnotate_Rdiff*      *aurum-m-AuAnnotate_Annotate*
                  *aurum-m-AuAnnotate_RVdiff*     *aurum-m-AuAnnotate_Open*
                  *aurum-m-AuAnnotate_Update*     *aurum-m-AuAnnotate_Next*
     Mapname  LHS  Description ~
     Enter    <CR> View changes between file and current revision (|vimdiff|)
+    FVdiff   gD   View diff between working directory and current revision 
+                  (using |vimdiff| in multiple tabs)
+    RFVdiff  gC   View diff between current revision and its first parent 
+                  (using |vimdiff| in multiple tabs)
     Fdiff    gd   View diff between working directory and current revision
-    RFdiff   gc   View diff between current revision and its parent
+    RFdiff   gc   View diff between current revision and its first parent
     Diff      d   View diff between file and current revision
     Rdiff     c   Like Fdiff, but view only changes made to annotated file
     Vdiff     D   Same as Enter

ftplugin/aurumannotate.vim

 setlocal nomodeline
 execute frawor#Setup('0.0', {'@aurum/repo': '2.0',
             \             '@aurum/bufvars': '0.0',
-            \             '@aurum/vimdiff': '0.0',
+            \             '@aurum/vimdiff': '0.2',
             \            '@aurum/annotate': '0.0',
             \                '@aurum/edit': '1.0',
             \                 '@/mappings': '0.0',
     "▶2 Various *diff actions
     if a:action[-4:] is# 'diff'
         if a:action[:2] is# 'rev'
-            let rev1=get(bvar.repo.functions.getcs(bvar.repo, hex).parents,0,'')
+            let cs1=bvar.repo.functions.getcs(bvar.repo, hex)
+            if empty(cs1.parents)
+                return
+            endif
+            let rev1=cs1.parents[0]
         elseif bvar.rev isnot# bvar.repo.functions.getworkhex(bvar.repo)
             let rev1=bvar.rev
         else
             setlocal noscrollbind
         endif
         if a:action[-7:-5] is# 'vim'
-            if empty(rev1)
-                let file1=s:_r.os.path.join(bvar.repo.path, bvar.file)
-                let existed=bufexists(file1)
-                if filereadable(file1)
-                    execute 'silent edit' fnameescape(file1)
+            if a:0 && a:1
+                return s:_r.vimdiff.full(bvar.repo,
+                            \            [(empty(rev1)?(0):(rev1)), rev2],
+                            \            0, [], 0)
+            else
+                if empty(rev1)
+                    let file1=s:_r.os.path.join(bvar.repo.path, bvar.file)
+                    let existed=bufexists(file1)
+                    if filereadable(file1)
+                        execute 'silent edit' fnameescape(file1)
+                    else
+                        call s:_f.throw('norfile', file1)
+                    endif
                 else
-                    call s:_f.throw('norfile', file1)
+                    try
+                        let existed=s:_r.run('silent edit', 'file', bvar.repo,
+                                    \        rev1, file)
+                    catch /\V\^Frawor:\[^:]\+:nofile:/
+                        call s:_f.throw('nofile', file, rev1)
+                    endtry
                 endif
-            else
-                try
-                    let existed=s:_r.run('silent edit', 'file', bvar.repo, rev1,
-                                \        file)
-                catch /\V\^Frawor:\[^:]\+:nofile:/
-                    call s:_f.throw('nofile', file, rev1)
-                endtry
-            endif
-            if existed
-                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
+                if existed
+                    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
             endif
         else
             if empty(rev1)
 "▲2
 call s:_f.mapgroup.add('AuAnnotate', {
             \    'Enter': {'lhs': '<CR>', 'rhs': s:F.getrhs(   'vimdiff'   )},
+            \   'FVdiff': {'lhs': 'gD',   'rhs': s:F.getrhs(   'vimdiff', 1)},
+            \  'RFVdiff': {'lhs': 'gC',   'rhs': s:F.getrhs('revvimdiff', 1)},
             \    'Fdiff': {'lhs': 'gd',   'rhs': s:F.getrhs(      'diff', 1)},
             \   'RFdiff': {'lhs': 'gc',   'rhs': s:F.getrhs('rev'.'diff', 1)},
             \     'Diff': {'lhs':  'd',   'rhs': s:F.getrhs(      'diff'   )},

test/annotatemaps.in

 :0/\v^\s*2
 c:WW
 :bwipeout!
+:W{{{1 gD
+:R silent edit .hgtags | setlocal bufhidden=wipe
+:AuAnnotate | wincmd p
+G-gD:WTabs
+,X
+:bwipeout!
+:W{{{1 gC
+:R silent edit chgrepo.zsh | setlocal bufhidden=wipe
+:AuAnnotate | wincmd p
+:0/\v^\s*2
+gC:WTabs
+,X
+:bwipeout!
 :W{{{1 gd
 :R silent edit chgrepo.zsh | setlocal bufhidden=wipe
 :AuAnnotate | wincmd p

test/annotatemaps.ok

 *1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2::crepo.zsh:
 {{{1 c
 *1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:5a6a1bf999fad1f4547eeb887af54f31d11833f2:chgrepo.zsh:
+{{{1 gD
+ 1*1: %TMPDIR%/test/annotatemapsrepo/.hgtags
+*2*1: aurum://file:%ETMPDIR%%-test%-annotatemapsrepo:250ba7cd831ee91c3ba5bef1faebc38c5dbca5f8:.hgtags
+*2#2: %TMPDIR%/test/annotatemapsrepo/.hgtags
+{{{1 gC
+ 1*1: %TMPDIR%/test/annotatemapsrepo/chgrepo.zsh
+*2*1: aurum://file:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:crepo.zsh
+*2#2: aurum://file:%ETMPDIR%%-test%-annotatemapsrepo:dfe39aa48c6ddde158e42217548b531a45ff66e9:crepo.zsh
 {{{1 gd
 *1: aurum://diff:%ETMPDIR%%-test%-annotatemapsrepo:5a6a1bf999fad1f4547eeb887af54f31d11833f2:::
 {{{1 gc
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.