Commits

ZyX_I committed a65a7be Merge

Merge
Fixes #9

Comments (0)

Files changed (3)

plugin/aurum/log.vim

 "▶2 graph.update :: graph, cs → + graph
 function s:F.graph.update(cs)
     let self.cs=a:cs
-    let self.interesting_parents=filter(copy(a:cs.parents),
-                \                       '!has_key(self.skipchangesets, v:val)')
+    "▶3 Populate self.interesting_parents
+    let self.interesting_parents=[]
+    for parent in a:cs.parents
+        if has_key(self.addchangesets, parent)
+            let self.interesting_parents+=[parent]
+        elseif has_key(self.skipchangesets, parent)
+        elseif !s:iterfuncs.check.check(self.checkd,
+                    \              self.repo.functions.getcs(self.repo, parent))
+            let self.skipchangesets[parent]=1
+        else
+            let self.addchangesets[parent]=1
+            let self.interesting_parents+=[parent]
+        endif
+    endfor
+    "▲3
     let self.num_parents=len(self.interesting_parents)
     let self.prev_commit_index=self.commit_index
     call self.update_columns()
     let graph.repo=a:opts.repo
     let graph.workcss=a:showparents
     let graph.skipchangesets=a:opts.skipchangesets
+    let graph.addchangesets=a:opts.addchangesets
+    let graph.checkd=a:opts.checkd
     call extend(graph, s:F.graph)
     return graph
 endfunction
         let literfuncs=s:iterfuncs.hg
     endif
     "▶3 Initialize variables
-    let haslimit=has_key(a:opts, 'limit')
+    let haslimit=(has_key(a:opts, 'limit') && a:opts.limit)
     if haslimit
         let limit=a:opts.limit
     endif
     let csbuf=[]
     let reqprops=keys(a:opts.reqs)
     call filter(reqprops, 'index(a:repo.initprops, v:val)==-1')
+    let a:opts.skipchangesets={}
+    let skipchangesets=a:opts.skipchangesets
+    let a:opts.addchangesets={}
+    let addchangesets=a:opts.addchangesets
     "▶3 Initialize variables not required for reading
     if !a:read
         let specials={}
         let a:bvar.rectangles=rectangles
         let a:bvar.specials=specials
         let a:bvar.csstarts=csstarts
-        let a:opts.skipchangesets={}
         let didredraw=0
         let procinput=a:bvar.procinput
         let lastw0line=-1
         let lastline=0
     endif
     "▶3 Initialize iterator functions
+    let checkd=s:iterfuncs.check.start(a:repo, a:opts)
+    let a:opts.checkd=checkd
     let ld=literfuncs.start(a:repo,a:opts,[a:repo.functions.getworkhex(a:repo)])
     let csd=a:csiterfuncs.start(a:repo, a:opts)
-    let checkd=s:iterfuncs.check.start(a:repo, a:opts)
     "▲3
     while 1 && (!haslimit || limit)
         let cs=a:csiterfuncs.next(csd)
         if cs is 0 "▶3
             return r
         endif "▲3
-        let skip=!s:iterfuncs.check.check(checkd, cs)
+        let skip=!has_key(addchangesets, cs.hex) &&
+                    \(has_key(skipchangesets, cs.hex) ||
+                    \ !s:iterfuncs.check.check(checkd, cs))
         "▶3 Add cs to skipchangesets or get its properties
         if skip
-            let a:opts.skipchangesets[cs.hex]=cs
+            let skipchangesets[cs.hex]=1
         else
+            let addchangesets[cs.hex]=1
             call map(copy(reqprops),
                         \'a:repo.functions.getcsprop(a:repo, cs, v:val)')
             let foundfirst=1
     let r.expr=join(values(map(filter(copy(a:opts),
                 \                     'has_key(s:keytoexpr, v:key)'),
                 \              'eval(s:keytoexpr[v:key])')), '||')
+    let r.haslimit=(has_key(a:opts, 'limit') && a:opts.limit)
+    if r.haslimit
+        let r.limit=a:opts.limit
+    endif
     "▲3
     return r
 endfunction
 "▶2 iterfuncs.check.check
 function s:iterfuncs.check.check(d, cs)
     "▶3 Check simple cases
-    if !empty(a:d.expr) && eval(a:d.expr)
+    if (!empty(a:d.expr) && eval(a:d.expr)) || (a:d.haslimit && !a:d.limit)
         return 0
     endif
     "▶3 Check files
             return 0
         endif
     endif
+    "▶3 Decrement limit
+    " XXX It is duplicating glog.graphlog functionality
+    if a:d.haslimit
+        let a:d.limit-=1
+    endif
     "▲3
     return 1
 endfunction

Binary file modified.

 {{{1 <CR>
 aurum://diff:%ETMPDIR%%-test%-logmapsrepo:504f74154456dbb0e9441326514e42ce66279e62:
 {{{1 branch <CR>
-aurum://log:%ETMPDIR%%-test%-logmapsrepo:crrestrict:branch,branch:A,
+aurum://log:%ETMPDIR%%-test%-logmapsrepo:branch:A,crrestrict:branch,
 {{{1 user <CR>
 aurum://log:%ETMPDIR%%-test%-logmapsrepo:user:%+VA <a@example.com>,crrestrict:user,
 {{{1 date <CR>
 {{{1 gD
 aurum://log:%ETMPDIR%%-test%-logmapsrepo:date:2002-02,crrestrict:date,
 {{{1 gb
-aurum://log:%ETMPDIR%%-test%-logmapsrepo:crrestrict:branch,branch:A,
+aurum://log:%ETMPDIR%%-test%-logmapsrepo:branch:A,crrestrict:branch,
 {{{1 gr
 aurum://log:%ETMPDIR%%-test%-logmapsrepo:crrestrict:revision,revision:be92227e3e43f4e7402408afe110098d209d2568,
 {{{1 gd
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.