ZyX_I avatar ZyX_I committed 51ea9e0

@aurum/log: Made ancestors cs generator sort changesets by revision number
before outputting.
Ref #8 for Mercurial driver is not fixed, but something still has to
be done with git

Comments (0)

Files changed (3)

   - Viewing working directory status ([:AuStatus](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line361-0)).
   - Commiting changes ([:AuCommit](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line99-0)), commit messages are remembered in case of 
-    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line843-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line846-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 
     other case it will possibly break mappings that do not expect such 
     behavior from |:AuLog|).
     Default value: 1.
+    Note: if you somehow switch buffers while log is being generated then 
+          buffer with generated log will be wiped out, log generation will 
+          stop.
 recheight                                                  *g:aurum_recheight*
     VimL |expression| that evaluates to unsigned integer or unsigned integer. 
     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.
 functions :: {String : FRef}                            *aurum-repo.functions*
     Dictionary that contains all driver-specific functions. All functions 


 let s:_messages={
             \'2multl': 'Two multiline statements on one line',
             \'argmis': 'Missing argument #%u for keyword %s',
-            \  'ebuf': 'Exiting: buffer changed, old buffer was wiped out',
+            \  'ebuf': 'Switched to another buffer: exiting',
 " iterfunc :: {fname: { "start": startfunc, "next": nextfunc }}
 " startfunc (always) :: repo, opts, * → d
                                 execute 'normal' input
                                 if bufnr('%')!=buf
                                     if bufexists(buf)
-                                        execute 'buffer' buf
-                                    else
-                                        call s:_f.warn('ebuf')
-                                        return []
+                                        execute 'silent bwipeout!' buf
+                                    call s:_f.warn('ebuf')
+                                    return []
                                 let lw0=line('w0')
                                 if lw0!=lastw0line
 "▶2 ancestors
 let s:iterfuncs.ancestors={}
 function s:iterfuncs.ancestors.start(repo, opts)
-    let hex=a:repo.functions.getrevhex(a:repo, a:opts.revision)
-    return {'addrevs': [hex], 'revisions': {}, 'repo': a:repo}
+    let cs=a:repo.functions.getcs(a:repo,
+                \a:repo.functions.getrevhex(a:repo, a:opts.revision))
+    return {'addrevs': [cs], 'revisions': {}, 'repo': a:repo,
+                \'hasrevisions': get(a:repo, 'hasrevisions', 1)}
+function! s:RevCmp(cs1, cs2)
+    let rev1=a:cs1.rev
+    let rev2=a:cs2.rev
+    return ((rev1==rev2)?(0):((rev1<rev2)?(1):(-1)))
+let s:_functions+=['s:RevCmp']
 function s:iterfuncs.ancestors.next(d)
     if empty(a:d.addrevs)
         return 0
-    let hex=remove(a:d.addrevs, 0)
-    if has_key(a:d.revisions, hex)
+    let cs=remove(a:d.addrevs, 0)
+    if has_key(a:d.revisions, cs.hex)
         return s:iterfuncs.ancestors.next(a:d)
-    let cs=a:d.repo.functions.getcs(a:d.repo, hex)
-    let a:d.revisions[hex]=cs
-    let a:d.addrevs+=cs.parents
+    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
     return cs
 "▶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.