Commits

ZyX_I committed c86fe13

@aurum/drivers/git: Fixed rf-diff() when diffoptions contain dates:0
Removed trailing empty line from rf-diff() output
@aurum/log: Fixed skipping changesets in git code
Fixed skipping stat/patch/files/changes
doc: Fixed summary

  • Participants
  • Parent commits de6d737

Comments (0)

Files changed (5)

-*aurum.txt* Plugin for dealing with source files under mercurial control
+*aurum.txt* Plugin for dealing with source files under various VCS control
 ==============================================================================
 CONTENTS                                                      *aurum-contents*
     1. Intro                                             |aurum-intro|

plugin/aurum/drivers/common/utils.vim

     let r={}
     call map(filter(copy(a:difftrans), 'has_key(opts, v:key)'),
             \'extend(r, {v:val : opts[v:key]})')
-    if has_key(opts, 'dates')
-        let r.nodates=!opts.dates
+    if has_key(opts, 'dates') && has_key(a:difftrans, 'dates')
+        let r[a:difftrans.dates]=!opts.dates
     endif
     return r
 endfunction

plugin/aurum/drivers/git.vim

     endif
     let r=s:F.git(a:repo, 'diff', args, kwargs, 1,
                 \ 'difff', a:rev1, a:rev2, join(a:files, ', '))
-    return r+['']
+    return r
 endfunction
 "▶1 git.diffre :: _, opts → Regex
 let s:diffre='\m^diff --git \v((\")?%s\/.{-}\2) \2%s\/'

plugin/aurum/drivers/mercurial.vim

             \ 'numlines': 'unified',
             \ 'showfunc': 'show_function',
             \  'alltext': 'text',
+            \    'dates': 'nodates',
         \}
 if s:usepythondriver "▶2
 function s:hg.diff(repo, rev1, rev2, files, opts)

plugin/aurum/log.vim

     let graph=s:F.glog.graph_init(a:css, a:showparents, a:opts)
     let show_header=1
     let r={'text': [], 'specials': {}, 'rectangles': [], 'csstarts': {}}
-    for cs in a:css
-        let skip=has_key(a:opts.skipchangesets, cs.hex)
-        if skip
-            let text={'text': [], 'special': {}, 'block_r': [[0, 0], [0, 0]]}
-        else
-            let text=a:opts.templatefunc(cs, a:opts)
-            let text.block_r=[[0, 0],
-                        \     [len(text.text)-1,
-                        \      max(map(copy(text.text), 'len(v:val)'))]]
-        endif
+    for cs in filter(copy(a:css), 'has_key(graph.addchangesets, v:val.hex)')
+        let text=a:opts.templatefunc(cs, a:opts)
+        let text.block_r=[[0, 0],
+                    \     [len(text.text)-1,
+                    \      max(map(copy(text.text), 'len(v:val)'))]]
         let text=s:F.glog.show_log(graph, cs, text)
         let r.text+=text.text
-        if !skip
-            let text.block_r[0][0]+=len(r.text)
-            let text.block_r[1][0]+=len(r.text)
-            let r.specials[cs.hex]=text.special
-            let r.rectangles+=[text.block_r+[cs.hex]]
-            let r.csstarts[cs.hex]=text.block_r[0][0]
-        endif
+        let text.block_r[0][0]+=len(r.text)
+        let text.block_r[1][0]+=len(r.text)
+        let r.specials[cs.hex]=text.special
+        let r.rectangles+=[text.block_r+[cs.hex]]
+        let r.csstarts[cs.hex]=text.block_r[0][0]
     endfor
     return r
 endfunction
         let lmeta=len(meta)
         if lmeta
             let kw=meta[0][0]
+            let lkw=meta[-1][0]
         endif
         "▶3 Skip line under certain conditions
-        if lmeta==1 && !s:kwexpr[meta[0][0]][0]
+        if !lmeta
+        elseif lmeta==1 && !s:kwexpr[meta[0][0]][0]
             if index(s:kwpempt, kw)!=-1
                 let addedif=1
                 let func+=['if !empty(a:cs.'.kw.')']
                 continue
             endif
             let func+=['let special.'.meta[0][0].'_l=[len(text), 0]']
-        elseif !lmeta
-        elseif kw is# 'patch' || kw is# 'stat'
+        elseif lkw is# 'patch' || lkw is# 'stat'
             let addedif=1
             let func+=['if exists("diff")']
-        elseif kw is# 'files' || kw is# 'changes'
+        elseif lkw is# 'files' || lkw is# 'changes'
             let addedif=1
             let func+=['if !empty(a:cs.'.kw.')']
         endif
                     let j+=1
                 endfor
                 "▶3 Skip meta if required
-                " XXX When adding more rules do not forget about addedif
                 if kw is# 'rev' && !hasrevisions && arg.0 isnot# 'keep'
                     continue
                 endif
                 "▶3 Add complex multiline statement
+                let addedif2=0
                 if ke[0]==2
+                    "▶4 Add missing if’s
+                    if !addedif
+                        if kw is# 'stat'
+                            let addedif2=1
+                            let func+=['if exists("diff")']
+                        elseif kw is# 'files' || kw is# 'changes'
+                            let addedif2=1
+                            let func+=['if !empty(a:cs.'.kw.')']
+                        endif
+                    endif
+                    "▲4
                     let expr=substitute(expr, '@<@', 'lstr', 'g')
                     let func+=['let lstr=remove(text, -1)',
                                 \'let [ntext, sp]='.expr]+
                                 \'call extend(special, sp)']
                 "▶3 Add simple multiline statement
                 elseif ke[0]
+                    "▶4 Add missing if’s
+                    if !addedif && kw is# 'patch'
+                        let addedif2=1
+                        let func+=['if exists("diff")']
+                    endif
+                    "▲4
                     let func+=['let ntext='.expr,
                                 \'call map(ntext, '.
                                 \         'string(remove(text, -1)).".v:val")']+
                     endif
                 endif
                 "▲3
+                if addedif2
+                    let func+=['endif']
+                endif
             endif
         endfor
         if addedif
     let foundfirst=0
     let lastnoskip=-1
     let i=opts.revs[0]
+    let requires_sort=get(a:repo, 'requires_sort', 1)
     for cs in css
         let skip=0
         "▶3 `branch', `merges', `search', `user', `revision'
             endif
         endif
         "▲3
-        if skip
+        if requires_sort
+            if skip
+                let opts.skipchangesets[cs.hex]=cs
+            endif
+        elseif skip
             if foundfirst
                 let opts.skipchangesets[cs.hex]=cs
             endif
         else
             if foundfirst
-                let lastnoskip=i
+                let lastnoskip=cs.hex
             else
                 let foundfirst=1
-                let firstnoskip=i
+                let firstnoskip=cs.hex
             endif
         endif
         let i+=1