Commits

ZyX_I  committed 7400c2f

ftplugin/aurumstatus: Added AuStatus RFVdiff and FVdiff mappings. Ref #6

  • Participants
  • Parent commits f06f265

Comments (0)

Files changed (7)

File README.markdown

   - 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#line852-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line856-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#line736-0)), 
+Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line740-0)), 
 all mappings are customizable.
 
 

File doc/aurum.txt

                                                         *g:frawormap_AuStatus*
                  *g:frawormap_AuStatus_Open*   *g:frawormap_AuStatus_ROpen*
                  *g:frawormap_AuStatus_RFdiff* *g:frawormap_AuStatus_Fdiff*
+                 *g:frawormap_AuStatus_FVdiff* *g:frawormap_AuStatus_RFVdiff*
                  *g:frawormap_AuStatus_Diff*   *g:frawormap_AuStatus_vDiff*
                  *g:frawormap_AuStatus_Rdiff*  *g:frawormap_AuStatus_vRdiff*
                  *g:frawormap_AuStatus_Vdiff*  *g:frawormap_AuStatus_RVdiff*
                  *g:frawormap_AuStatus_vForget*    *aurum-m-AuStatus_vForget*
                      *aurum-m-AuStatus_Open*       *aurum-m-AuStatus_ROpen*
                      *aurum-m-AuStatus_RFdiff*     *aurum-m-AuStatus_Fdiff*
+                     *aurum-m-AuStatus_FVdiff*     *aurum-m-AuStatus_RFVdiff*
                      *aurum-m-AuStatus_Diff*       *aurum-m-AuStatus_vDiff*
                      *aurum-m-AuStatus_Rdiff*      *aurum-m-AuStatus_vRdiff*
                      *aurum-m-AuStatus_Vdiff*      *aurum-m-AuStatus_RVdiff*
     RFdiff   gd   View changes introduced by first revision
     Fdiff    gc   View diff between two revisions (or working directory state 
                   and first revision)
+    RFVdiff  gD   Like RFdiff, but show them in multiple tabs using |vimdiff|
+    FVdiff   gC   Like Fdiff,  but show them in multiple tabs using |vimdiff|
     Diff      d   Like RFdiff, but show only current file
     vDiff     d   Like RFdiff, but shows files selected in visual mode
     Rdiff     c   Like Fdiff, but show only current file

File ftplugin/aurumstatus.vim

                 \index(s:noacttypes[a:action], bvar.types[curline])!=-1
         return ''
     endif
-    if !(a:action is# 'commit' || a:action is# 'track' || a:action is# 'forget')
+    if !(a:action is# 'commit' || a:action is# 'track' || a:action is# 'forget'
+                \|| a:action[-11:] is# 'fullvimdiff')
         if isrecord
             let [lwnr, rwnr, swnr]=bvar.getwnrs()
             execute lwnr.'wincmd w'
         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,  '',  [], {})
+    elseif a:action is# 'fullvimdiff'
+        execute 'AuVimDiff full '.((empty(rev2) || empty(rev1))?
+                    \                   ('curfile '):
+                    \                   ('')).rev1.' '.rev2
+    elseif a:action is# 'revfullvimdiff'
+        let cs1=bvar.repo.functions.getcs(bvar.repo, rev1)
+        if !empty(cs1.parents)
+            let fileglob=escape(s:_r.os.path.join(bvar.repo.path, '**'), ' ')
+            execute 'AuVimDiff full files '.fileglob.' noonlymodified '.
+                        \' '.rev1.' '.cs1.parents[0]
+        endif
     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'
                             \   'execute "autocmd AuStatusCommit '.
                             \                    'BufEnter <buffer='.buf.'> '.
                             \                    'nested '.
-                            \               'execute \"autocmd! AuStatusCommit '.
-                            \                           'BufEnter '
+                            \              'execute \"autocmd! AuStatusCommit '.
+                            \                          'BufEnter '
                             \                           '<buffer='.buf.'>\" | '.
-                            \                   'silent edit!" | '.
+                            \              'silent edit!" | '.
                             \'endif'
             augroup END
         endif
 endfunction
 "▲2
 call s:_f.mapgroup.add('AuStatus', {
-            \    'Exit': {'lhs':  'X',   'rhs': ':<C-u>bwipeout!<CR>'    },
-            \    'Open': {'lhs': '<CR>', 'rhs': s:F.getrhs(       'open')},
-            \   'ROpen': {'lhs':  'o',   'rhs': s:F.getrhs(    'revopen')},
-            \  'RFdiff': {'lhs': 'gd',   'rhs': s:F.getrhs('revfulldiff')},
-            \   'Fdiff': {'lhs': 'gc',   'rhs': s:F.getrhs(   'fulldiff')},
-            \    'Diff': {'lhs':  'd',   'rhs': s:F.getrhs(       'diff')},
-            \   'vDiff': {'lhs':  'd',   'rhs': s:F.getrhs(       'diff', 1),
+            \    'Exit': {'lhs':  'X',   'rhs': ':<C-u>bwipeout!<CR>'       },
+            \    'Open': {'lhs': '<CR>', 'rhs': s:F.getrhs(          'open')},
+            \   'ROpen': {'lhs':  'o',   'rhs': s:F.getrhs(       'revopen')},
+            \ 'RFVdiff': {'lhs': 'gD',   'rhs': s:F.getrhs('revfullvimdiff')},
+            \  'FVdiff': {'lhs': 'gC',   'rhs': s:F.getrhs(   'fullvimdiff')},
+            \  'RFdiff': {'lhs': 'gd',   'rhs': s:F.getrhs(   'revfulldiff')},
+            \   'Fdiff': {'lhs': 'gc',   'rhs': s:F.getrhs(      'fulldiff')},
+            \    'Diff': {'lhs':  'd',   'rhs': s:F.getrhs(          'diff')},
+            \   'vDiff': {'lhs':  'd',   'rhs': s:F.getrhs(          'diff', 1),
             \             'mode': 'v'},
-            \   'Rdiff': {'lhs':  'c',   'rhs': s:F.getrhs(    'revdiff')},
-            \  'vRdiff': {'lhs':  'c',   'rhs': s:F.getrhs(    'revdiff', 1),
+            \   'Rdiff': {'lhs':  'c',   'rhs': s:F.getrhs(       'revdiff')},
+            \  'vRdiff': {'lhs':  'c',   'rhs': s:F.getrhs(       'revdiff', 1),
             \             'mode': 'v'},
-            \   'Vdiff': {'lhs':  'D',   'rhs': s:F.getrhs(    'vimdiff')},
-            \  'RVdiff': {'lhs':  'C',   'rhs': s:F.getrhs( 'revvimdiff')},
-            \'Annotate': {'lhs':  'a',   'rhs': s:F.getrhs(   'annotate')},
-            \  'Commit': {'lhs':  'i',   'rhs': s:F.getrhs(     'commit')},
-            \ 'vCommit': {'lhs':  'i',   'rhs': s:F.getrhs(     'commit', 1),
+            \   'Vdiff': {'lhs':  'D',   'rhs': s:F.getrhs(       'vimdiff')},
+            \  'RVdiff': {'lhs':  'C',   'rhs': s:F.getrhs(    'revvimdiff')},
+            \'Annotate': {'lhs':  'a',   'rhs': s:F.getrhs(      'annotate')},
+            \  'Commit': {'lhs':  'i',   'rhs': s:F.getrhs(        'commit')},
+            \ 'vCommit': {'lhs':  'i',   'rhs': s:F.getrhs(        'commit', 1),
             \             'mode': 'v'},
-            \   'Track': {'lhs':  'A',   'rhs': s:F.getrhs(      'track')},
-            \  'vTrack': {'lhs':  'A',   'rhs': s:F.getrhs(      'track', 1),
+            \   'Track': {'lhs':  'A',   'rhs': s:F.getrhs(         'track')},
+            \  'vTrack': {'lhs':  'A',   'rhs': s:F.getrhs(         'track', 1),
             \             'mode': 'v'},
-            \  'Forget': {'lhs':  'R',   'rhs': s:F.getrhs(     'forget')},
-            \ 'vForget': {'lhs':  'R',   'rhs': s:F.getrhs(     'forget', 1),
+            \  'Forget': {'lhs':  'R',   'rhs': s:F.getrhs(        'forget')},
+            \ 'vForget': {'lhs':  'R',   'rhs': s:F.getrhs(        'forget', 1),
             \             'mode': 'v'},
             \}, {'func': s:F.runmap, 'silent': 1, 'mode': 'n'})
 "▶1

File plugin/aurum/cmdutils.vim

         if a:failmsg isnot 0
             call s:_f.throw(a:failmsg)
         endif
+    elseif a:act is# 'getfiles'
+        let r.files=a:bvar.files
     else
         let r.file=a:bvar.files[line('.')-1]
     endif
                 unlet repo
                 let repo=s:_r.repo.get(file)
             endif
-            if a:act isnot# 'getfiles' && repo isnot 0
+            if repo isnot 0
                 let file=repo.functions.reltorepo(repo, file)
             endif
             let files+=[file]
             if type(repo)!=type({})
                 call s:_f.throw('nrepo')
             endif
-            let file=repo.functions.reltorepo(repo, file)
+            if file isnot 0
+                let file=repo.functions.reltorepo(repo, file)
+            endif
         endif
         "▶2 rev
         if a:act is# 'getfiles'

File plugin/aurum/vimdiff.vim

         \}
 let s:_messages={
             \'nodfile': 'Failed to deduce which file to diff with',
+            \ 'cndiff': 'Can’t show diff for file %s',
             \ 'nodrev': 'Unsure what revision should be diffed with',
         \}
 let s:lastfullid=0
     "▶2 repo and revisions
     let full=get(a:opts, 'full', 0)
     let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 0,
-                \                                      ((full)?('get'):
+                \                                      ((full)?('getfiles'):
                 \                                              ('open')))
     call s:_r.cmdutils.checkrepo(repo)
     let revs=[]
             let files2={}
             "▶3 Current file
             if len(filepats)!=len(a:opts.files)
-                if file isnot# 0 && has_key(files, file)
-                    let files2[file]=remove(files, file)
+                if !empty(file)
+                    if has_key(files, file[0])
+                        let files2[file[0]]=remove(files, file[0])
+                    else
+                        call s:_f.throw('cndiff', file[0])
+                    endif
                 else
                     call s:_f.throw('nodfile')
                 endif
                             \'extend(files2, {v:val : remove(files, v:val)})')
             endfor
             let files=files2
+        elseif !empty(file)
+            let files2={}
+            for f in filter(copy(file), 'has_key(files, v:val)')
+                let files2[f]=remove(files, f)
+            endfor
+            let files=files2
         endif
         "▲2
         let s:lastfullid+=1

File test/statmaps.in

 /^M
 o:WW
 :bwipeout!
+:W{{{1 gC
+:R AuStatus
+gC:WTabs
+,X:bwipeout!
 :W{{{1 gc
 :R AuStatus
 /^M
 :call WriteFile('d: '.&diff)
 :bwipeout!
 :bwipeout!
+:W{{{1 gD
+:R AuStatus
+gD:WTabs
+,X:bwipeout!
 :W{{{1 gd
 :R AuStatus
 /^M

File test/statmaps.ok

 *1: %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
 {{{1 o
 *1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+{{{1 gC
+ 1#1: 
+ 1*2: aurum://status:%ETMPDIR%%-test%-statmapsrepo:
+*2*1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
+*2#2: %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
 {{{1 gc
 *1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 c
 *1: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:nohglinesrev.lst
 #2: %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
 d: 1
+{{{1 gD
+ 1#1: 
+ 1*2: aurum://status:%ETMPDIR%%-test%-statmapsrepo:
+ 2*1: 
+ 2#2: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:.hgignore
+*3*1: 
+*3#2: aurum://file:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:directory%-file
 {{{1 gd
 *1: aurum://diff:%ETMPDIR%%-test%-statmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:::
 {{{1 d