# HG changeset patch # User Ludovic Chabant # Date 1405573571 25200 # Node ID e856f8dc22a8bc00c8c4de6a24503879c5d530bc # Parent e21a1819ab27a0e419081212bd648d6b2279b932 `Hglogexport` uses relative paths correctly on Windows, auto-completes to files. diff -r e21a1819ab27 -r e856f8dc22a8 plugin/lawrencium.vim --- a/plugin/lawrencium.vim Sat Jul 05 17:16:42 2014 -0700 +++ b/plugin/lawrencium.vim Wed Jul 16 22:06:11 2014 -0700 @@ -1522,10 +1522,10 @@ " Add some other nice commands and mappings. let l:is_file = (l:path != '' && filereadable(l:repo.GetFullPath(l:path))) - command! -buffer -nargs=+ Hglogexport :call s:HgLog_ExportPatch() command! -buffer -nargs=* Hglogdiffsum :call s:HgLog_DiffSummary(1, ) command! -buffer -nargs=* Hglogvdiffsum :call s:HgLog_DiffSummary(2, ) command! -buffer -nargs=* Hglogtabdiffsum :call s:HgLog_DiffSummary(3, ) + command! -buffer -nargs=+ -complete=file Hglogexport :call s:HgLog_ExportPatch() if l:is_file command! -buffer Hglogrevedit :call s:HgLog_FileRevEdit() command! -buffer -nargs=* Hglogdiff :call s:HgLog_Diff(0, ) @@ -1632,12 +1632,16 @@ function! s:HgLog_ExportPatch(...) abort let l:patch_name = a:1 if !empty($HG_EXPORT_PATCH_DIR) - let l:is_patch_relative = (matchstr(l:patch_name, '\v^/') == "") - " Use the patch dir only if user has specified a relative path - " Only works on Unix. Not sure how to check on Windows. - if l:is_patch_relative - let l:patch_name = $HG_EXPORT_PATCH_DIR . "/" . l:patch_name - endif + " Use the patch dir only if user has specified a relative path + if has('win32') + let l:is_patch_relative = (matchstr(l:patch_name, '\v^([a-zA-Z]:)?\\') == "") + else + let l:is_patch_relative = (matchstr(l:patch_name, '\v^/') == "") + endif + if l:is_patch_relative + let l:patch_name = s:normalizepath( + s:stripslash($HG_EXPORT_PATCH_DIR) . "/" . l:patch_name) + endif endif if a:0 == 2