Commits

ZyX_I committed 94685cf

@aurum/drivers/subversion: Fixed diffopts processing in rf-diff()
Made rf-getcs() try to get information from repo.changesets in first place

Comments (0)

Files changed (1)

plugin/aurum/drivers/subversion.vim

             \  'ndate': 'You must install “date” programm in order to get '.
             \           'time information for Subversion revisions',
             \  'r2fst': 'Second revision was found before the first',
+            \     'u3': 'Subversion supports only three lines '.
+            \           'of unified context, you gave %u',
         \}
 let s:svn={}
 "▶1 s:hypsites
         \}
 let s:hasdateexe=executable('date')
 " TODO HEAD, ... in cs.tags
+" TODO use merge information if available
 function s:F.parsecs(csdata, line)
     let cs=deepcopy(s:csinit)
     "▶2 Check for logentry start
 endfunction
 "▶1 svn.getcs :: repo, rev → cs
 function s:svn.getcs(repo, rev)
+    "▶2 Do the best trying to get it from repo.changesets
+    if has_key(a:repo.changesets, a:rev)
+        return a:repo.changesets[a:rev]
+    else
+        let rev=a:repo.functions.getrevhex(a:repo, a:rev)
+        if has_key(a:repo.changesets, rev)
+            return a:repo.changesets[rev]
+        elseif !empty(a:repo.cslist)
+            call a:repo.functions.updatechangesets(a:repo)
+            if has_key(a:repo.changesets, rev)
+                return a:repo.changesets[rev]
+            endif
+        endif
+    endif
+    "▲2
     let cs=s:F.parsecs(s:F.svn(a:repo, 'log', [],
-                \              {'revision': a:rev, 'limit': '1', 'xml': 1},
+                \              {'revision': rev, 'limit': '1', 'xml': 1},
                 \              0, 'csf', a:rev), 2)[0]
+    " TODO Populate cs.parents
     let cs.parents=[]
-    " XXX This construct is used to preserve information like “allfiles” etc
-    let a:repo.changesets[cs.hex]=extend(get(a:repo.changesets, cs.hex, {}), cs)
+    let a:repo.changesets[cs.hex]=cs
     return a:repo.changesets[cs.hex]
 endfunction
 "▶1 svn.getwork :: repo → cs
         \}
 function s:svn.diff(repo, rev1, rev2, files, opts)
     let diffopts=s:_r.utils.diffopts(a:opts, a:repo.diffopts, s:difftrans)
-    if has_key(diffopts, 'unified')
-        let diffopts.unified=''.diffopts.unified
+    if has_key(diffopts, 'unified') && diffopts.unified && diffopts.unified!=3
+        call s:_f.throw('u3', diffopts.unified)
     endif
-    if get(a:opts, 'reverse', 0)
-        let reverse=1
-    endif
-    let kwargs=copy(diffopts)
+    let reverse=get(a:opts, 'reverse', 0)
+    let kwargs={}
     let args=[]
+    for [k, v] in items(diffopts)
+        if v
+            let args+=['--extensions', '--'.k]
+        endif
+    endfor
     if empty(a:rev2)
         if !empty(a:rev1)
             if reverse
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.