# HG changeset patch # User Ludovic Chabant # Date 1455925834 28800 # Node ID 7ad578b151c1ac2cf9cdcd59ed483af37a0512e2 # Parent 96e4423e729e3845a30315f045c6229b4977900d# Parent e2757acfd9b1a1b42a85b00d1203adcee0c1f7cc Merge pull request #8 from GitHub. diff -r 96e4423e729e -r 7ad578b151c1 doc/lawrencium.txt --- a/doc/lawrencium.txt Fri Feb 19 15:39:56 2016 -0800 +++ b/doc/lawrencium.txt Fri Feb 19 15:50:34 2016 -0800 @@ -474,6 +474,9 @@ :Hgannotatediffsum Show a diff summary (similar to |:Hgdiffsum|) for the revision mentioned under the cursor. Mapped to ||. +:Hgannotatelog Show the complete commit for the revision mentioned + under the cursor. + Mapped to . diff -r 96e4423e729e -r 7ad578b151c1 plugin/lawrencium.vim --- a/plugin/lawrencium.vim Fri Feb 19 15:39:56 2016 -0800 +++ b/plugin/lawrencium.vim Fri Feb 19 15:50:34 2016 -0800 @@ -713,6 +713,17 @@ setlocal filetype=hglog endfunction +function! s:read_lawrencium_logpatch(repo, path_parts, full_path) abort + let l:log_cmd = 'log --patch --verbose --rev ' . a:path_parts['value'] + + if a:path_parts['path'] == '' + call a:repo.ReadCommandOutput(l:log_cmd) + else + call a:repo.ReadCommandOutput(l:log_cmd, a:full_path) + endif + setlocal filetype=diff +endfunction + " Diff revisions (`hg diff`) function! s:read_lawrencium_diff(repo, path_parts, full_path) abort let l:diffargs = [] @@ -776,6 +787,7 @@ let s:lawrencium_file_readers = { \'rev': function('s:read_lawrencium_rev'), \'log': function('s:read_lawrencium_log'), + \'logpatch': function('s:read_lawrencium_logpatch'), \'diff': function('s:read_lawrencium_diff'), \'status': function('s:read_lawrencium_status'), \'annotate': function('s:read_lawrencium_annotate'), @@ -2024,8 +2036,10 @@ " Add some other nice commands and mappings. command! -buffer Hgannotatediffsum :call s:HgAnnotate_DiffSummary() + command! -buffer Hgannotatelog :call s:HgAnnotate_DiffSummary(1) if g:lawrencium_define_mappings nnoremap :Hgannotatediffsum + nnoremap :Hgannotatelog endif " Clean up when the annotate buffer is deleted. @@ -2039,15 +2053,20 @@ endif endfunction -function! s:HgAnnotate_DiffSummary() abort +function! s:HgAnnotate_DiffSummary(...) abort " Get the path for the diff of the revision specified under the cursor. let l:line = getline('.') let l:rev_hash = matchstr(l:line, '\v[a-f0-9]{12}') + let l:log = (a:0 > 0 ? a:1 : 0) " Get the Lawrencium path for the diff, and the buffer object for the " annotation. let l:repo = s:hg_repo() - let l:path = l:repo.GetLawrenciumPath(b:lawrencium_annotated_path, 'diff', l:rev_hash) + if l:log + let l:path = l:repo.GetLawrenciumPath(b:lawrencium_annotated_path, 'logpatch', l:rev_hash) + else + let l:path = l:repo.GetLawrenciumPath(b:lawrencium_annotated_path, 'diff', l:rev_hash) + endif let l:annotate_buffer = s:buffer_obj() " Find a window already displaying diffs for this annotation.