ZyX_I avatar ZyX_I committed 78706c2

@aurum/drivers/git: Added rf-getchangesets()
@aurum: Made :AuGrep use values(repo.changesets) instead of cslist returned by rf-getchangesets()

Comments (0)

Files changed (3)

 
 cslist :: [ cs ]                                           *aurum-repo.cslist*
     List of |aurum-changeset| objects. If it is not empty, then for each 
-    changeset in repository cs is repo.cslist[cs.rev]. It is empty by default 
-    and populated only when you call |aurum-rf-getchangesets|. See also 
-    |aurum-cs.rev|.
+    changeset in repository cs is repo.cslist[cs.rev] unless cs.rev is not 
+    String. It is empty by default and may be populated only when you call 
+    |aurum-rf-getchangesets|. See also |aurum-cs.rev|.
+    Obsolete, use |aurum-rf-revrange|.
 changesets :: {hex : cs}                               *aurum-repo.changesets*
     Dictionary containing all |aurum-changeset| objects that are associated 
     with the repository. For each changeset cs is repo.changesets[cs.hex].
     Pull all changesets contained in repository into |aurum-repo.changesets| 
     dictionary. If this function is not called, then |aurum-repo.changesets| 
     dictionary contains only changesets that were used at least ones. Returns 
-    list of changesets as contained in |aurum-repo.cslist|.
+    list of changesets as contained in |aurum-repo.cslist|. Return value is 
+    ignored (|aurum-rf-revrange| function is now used instead).
   revrange :: hex, hex -> [ cs ]                           *aurum-rf-revrange*
     Get revision range (inclusive). Numbers are to be treated specially, like 
     it is done by |list-index|, but it is up to driver what it thinks is “last 
     file A was modified in both parents, then it is to be listed in 
     merge_cs.changes only if git was unable to merge changes and had to ask 
     user to do this).
+|aurum-rf-getchangesets| is always returning empty list.
 
 ==============================================================================
 11. Changelog                                                *aurum-changelog*
             if get(a:opts, 'workmatch', 1)
                 let css=[repo.functions.getwork(repo)]
             else
-                let css=repo.functions.getchangesets(repo)[:-2]
+                call repo.functions.getchangesets(repo)
+                let css=values(repo.changesets)
             endif
         else
             let css=[]

plugin/aurum/drivers/git.vim

 let s:_messages={
             \   'hexf': 'Failed to obtain hex string for revision %s '.
             \           'in the repository %s: %s',
+            \   'logf': 'Failed to list all revisions in the repository %s: %s',
             \    'csf': 'Failed to obtain information about revision %s '.
             \           'in the repository %s: %s',
             \   'updf': 'Failed to checkout commit %s in the repository %s: %s',
 " author name
 " author email
 " 1-indented commit message
-let s:logformat='%H-%P-%at-%n%an%n%ae%n%d%n%w(0,1,1)%B'
+let s:logformat='%H-%P-%at%n%an%n%ae%n%d%n%w(0,1,1)%B'
 let s:logkwargs={'format': s:logformat, 'encoding': 'utf-8'}
 function s:F.parsecs(csdata, lstart)
     let line=a:lstart
     let cs={'branch': 'default'}
-    let [hex, parents, time]=split(a:csdata[line], '-') | let line+=1
+    let [hex, parents, time]=split(a:csdata[line], '-', 1) | let line+=1
     let cs.hex=hex
     let cs.parents=split(parents)
     let cs.time=+time
-    let aname=a:csdata[line]                            | let line+=1
-    let aemail=a:csdata[line]                           | let line+=1
+    let aname=a:csdata[line]                               | let line+=1
+    let aemail=a:csdata[line]                              | let line+=1
     let cs.user=aname.' <'.aemail.'>'
-    let cs.tags=split(a:csdata[line][2:-2], ', ')       | let line+=1
+    let cs.tags=split(a:csdata[line][2:-2], ', ')          | let line+=1
     let cs.bookmarks=[]
     let cs.rev=cs.hex[:6]
     "▶2 get description
         let line+=1
     endwhile
     let cs.description=join(description, "\n")
+    let line+=1
     "▲2
     return [cs, line]
 endfunction
+"▶1 git.getchangesets :: repo → []
+function s:git.getchangesets(repo)
+    let log=s:F.git(a:repo, 'log', [], extend({'all': 1, 'full-history': 1},
+                \                             s:logkwargs), 0, 'logf')[:-2]
+    let i=0
+    let llog=len(log)
+    while i<llog
+        let [cs, i]=s:F.parsecs(log, i)
+        let a:repo.changesets[cs.hex]=cs
+    endwhile
+    return []
+endfunction
 "▶1 git.getcs :: repo, rev → cs
 function s:git.getcs(repo, rev)
     let cs=s:F.parsecs(s:F.git(a:repo, 'log', [a:rev.'^..'.a:rev], s:logkwargs,
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.