Commits

ZyX_I  committed ec2e258

Added support for `patch' option

  • Participants
  • Parent commits 97a75d3

Comments (0)

Files changed (3)

File ftplugin/aurumgraphlog.vim

     let special.description_R=[[len(text),                    0],
                 \              [len(text)+len(description)-1, 0]]
     let text+=description
+    "▶3 Add patch
+    if get(a:opts, 'patch', 0) && !empty(a:cs.parents)
+        let diff=a:opts.repo.functions.diff(a:opts.repo, a:cs.hex,
+                    \                       a:cs.parents[0].hex, [],
+                    \                       {})
+        call map(diff, '":".v:val')
+        let special.diff_R=[[len(text), 0], [len(text)+len(diff)-1, 0]]
+        let text+=diff
+    endif
     "▲3
     let text+=['']
     return r
 "▶2 glog.graphlog
 function s:F.glog.graphlog(repo, opts)
     let css=reverse(a:repo.cslist[:-2])
+    let a:opts.repo=a:repo
     return s:F.glog.generate(css, [a:repo.work_hex], s:F.glog.summary, a:opts)
 endfunction
 "▶1 setup

File plugin/aurum.vim

                 \                  'vim.eval("a:rev2"), '.
                 \                  'vim.eval("a:files"), '.
                 \                  'vim.eval("a:opts"))'
-    echom string(a:files)
     return r
 endfunction
 "▶2 comm

File syntax/aurumgraphlog.vim

     finish
 endif
 
-syn match auGlogLineStart /\v^[@o|+\-\/\\ ]+/ nextgroup=auGlogChangeset,auGlogCommit,auGlogTag,auGlogBookmark,auGlogMessage,auGlogFiles
+
+syn match auGlogLineStart /\v^[@o|+\-\/\\ ]+/ nextgroup=auGlogChangeset,auGlogCommit,auGlogTag,auGlogBookmark,auGlogMessage,auGlogFiles,auGlogDiffStart
 syn match auGlogChangeset         /Changeset / contained nextgroup=auGlogChangesetNum
 syn match auGlogChangesetNum      /\v\d+/      contained nextgroup=auGlogChangesetSep
 syn match auGlogChangesetSep      /:/          contained nextgroup=auGlogChangesetHexStart
 syn match auGlogFile          /\v%(%(, )@!.)+/    contained nextgroup=auGlogFileSep
 syn match auGlogFileSep       /, /                contained nextgroup=auGlogFile
 
+syn cluster Diff contains=auGlogDiffFile,auGlogDiffOldFile,auGlogDiffNewFile,auGlogDiffAdded,auGlogDiffRemoved
+syn match auGlogDiffStart     /:/                 contained nextgroup=@Diff
+syn match auGlogDiffAdded     /\V+\.\*/           contained
+syn match auGlogDiffRemoved   /\V-\.\*/           contained
+syn match auGlogDiffFile      /\vdiff.*/          contained
+syn match auGlogDiffNewFile   /\V+++ \.\*/        contained
+syn match auGlogDiffOldFile   /\V--- \.\*/        contained
+
 hi def link auGlogChangeset         Special
 hi def link auGlogChangesetNum      Statement
 hi def link auGlogChangesetSep      Comment
 
 hi def link auGlogTagNames          auGlogTagName
 
+hi def link auGlogDiffStart         Ignore
+hi def link auGlogDiffFile          Type
+hi def link auGlogDiffNewFile       auGlogDiffFile
+hi def link auGlogDiffOldFile       auGlogDiffFile
+hi def link auGlogDiffAdded         Identifier
+hi def link auGlogDiffRemoved       Special
+
 let b:current_syntax=expand('<sfile>:t:r')