Commits

ZyX_I committed dd8f68e

@aurum/log: Added support for “limit” to iterfuncs.check. Should fix ref #9 in all cases

Comments (0)

Files changed (2)

plugin/aurum/log.vim

     "▶3 Populate self.interesting_parents
     let self.interesting_parents=[]
     for parent in a:cs.parents
-        if has_key(self.skipchangesets, parent)
-            continue
+        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
-            continue
         else
+            let self.addchangesets[parent]=1
             let self.interesting_parents+=[parent]
         endif
     endfor
     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
         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 foundfirst=0
     let csbuf=[]
     let reqprops=s:F.requiredpropslist(a:opts)
+    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 skipchangesets=a:opts.skipchangesets
         let didredraw=0
         let procinput=a:bvar.procinput
         let lastw0line=-1
         if cs is 0 "▶3
             return r
         endif "▲3
-        let skip=has_key(skipchangesets, cs.hex) ||
-                    \!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 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.

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.