ZyX_I avatar ZyX_I committed 1a48ad8 Merge

Merge
Fixes #8

Comments (0)

Files changed (2)

     Determines whether |aurum-cs.rev| contains something different from 
     abbreviated hash. If this option is false, then in log produced by 
     |aurum://log| revisions will be ignored.
-    If it is true, then it also assumes that changesets sorted by revision 
-    numbers are sorted in topological order (see |aurum-rf-getchangesets|).
     This key is optional, default value: true.
 initprops :: [ propname ]                               *aurum-repo.initprops*
     Contains list of properties that are always set by |aurum-rf-getcs|.

plugin/aurum/repo.vim

             endfor
         endfor
         let work=[]
-        call map(copy(a:css), 'v:val.indegree==1 && add(work, v:val) is 0')
+        call map(copy(a:css), 'v:val.indegree==1 ? add(work, v:val) : 0')
         call sort(work, 's:DateCmp')
         let r=[]
         while !empty(work)
 function s:iterfuncs.ancestors.start(repo, opts)
     let cs=a:repo.functions.getcs(a:repo,
                 \a:repo.functions.getrevhex(a:repo, a:opts.revision))
+    let indegree={cs.hex : 1}
+    for parenthex in cs.parents
+        let indegree[parenthex]=2
+    endfor
     return {'addrevs': [cs], 'revisions': {}, 'repo': a:repo,
-                \'hasrevisions': get(a:repo, 'hasrevisions', 1)}
+                \'hasrevisions': get(a:repo, 'hasrevisions', 1),
+                \'indegree': indegree, 'incremented': {cs.hex : 1}}
 endfunction
 function! s:RevCmp(cs1, cs2)
     let rev1=a:cs1.rev
     if empty(a:d.addrevs)
         return 0
     endif
-    let cs=remove(a:d.addrevs, 0)
-    if has_key(a:d.revisions, cs.hex)
-        return s:iterfuncs.ancestors.next(a:d)
-    endif
+    " XXX cs variables should be kept after cycle ends
+    let i=-1
+    for cs in a:d.addrevs
+        let i+=1
+        if a:d.indegree[cs.hex]<=1
+            break
+        endif
+    endfor
+    call remove(a:d.addrevs, i)
     let a:d.revisions[cs.hex]=cs
-    let parents=map(copy(cs.parents),'a:d.repo.functions.getcs(a:d.repo,v:val)')
-    call extend(a:d.addrevs, parents)
-    if a:d.hasrevisions
-        call sort(a:d.addrevs, 's:RevCmp')
-    endif
+    for parenthex in filter(copy(cs.parents), '!has_key(a:d.revisions, v:val)')
+        let parent=a:d.repo.functions.getcs(a:d.repo, parenthex)
+        let a:d.indegree[parenthex]=a:d.indegree[parenthex]-1
+        if !has_key(a:d.incremented, parenthex)
+            let a:d.incremented[parenthex]=1
+            for pparhex in parent.parents
+                let a:d.indegree[pparhex]=get(a:d.indegree, pparhex, 1)+1
+            endfor
+            let a:d.addrevs+=[parent]
+        endif
+    endfor
     return cs
 endfunction
 "▶2 revrange
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.