# HG changeset patch # User Ludovic Chabant # Date 1465880140 25200 # Mon Jun 13 21:55:40 2016 -0700 # Node ID 652a6f5df0f3a204fc2c23418e1f7b4d62efa414 # Parent 065625e1bb316e4281304ffa748942b0ef683bf7 Fixed for broken things after the reorganization. diff --git a/autoload/lawrencium/annotate.vim b/autoload/lawrencium/annotate.vim --- a/autoload/lawrencium/annotate.vim +++ b/autoload/lawrencium/annotate.vim @@ -98,7 +98,7 @@ let b:mercurial_dir = l:repo.root_dir let b:lawrencium_annotated_path = l:path let b:lawrencium_annotated_bufnr = l:bufnr - call s:DefineMainCommands() + call lawrencium#define_commands() " Add some other nice commands and mappings. command! -buffer Hgannotatediffsum :call s:HgAnnotate_DiffSummary() @@ -110,12 +110,12 @@ " Clean up when the annotate buffer is deleted. let l:bufobj = lawrencium#buffer_obj() - call l:bufobj.OnDelete('call s:HgAnnotate_Delete(' . l:bufobj.nr . ')') + call l:bufobj.OnDelete('call lawrencium#annotate#HgAnnotate_Delete(' . l:bufobj.nr . ')') endfunction -function! s:HgAnnotate_Delete(bufnr) abort +function! lawrencium#annotate#HgAnnotate_Delete(bufnr) abort if g:lawrencium_auto_close_buffers - call s:delete_dependency_buffers('lawrencium_diff_for', a:bufnr) + call lawrencium#delete_dependency_buffers('lawrencium_diff_for', a:bufnr) endif endfunction @@ -136,7 +136,7 @@ let l:annotate_buffer = lawrencium#buffer_obj() " Find a window already displaying diffs for this annotation. - let l:diff_winnr = s:find_buffer_window('lawrencium_diff_for', l:annotate_buffer.nr) + let l:diff_winnr = lawrencium#find_buffer_window('lawrencium_diff_for', l:annotate_buffer.nr) if l:diff_winnr == -1 " Not found... go back to the main source buffer and open a bottom " split with the diff for the specified revision. diff --git a/autoload/lawrencium/commit.vim b/autoload/lawrencium/commit.vim --- a/autoload/lawrencium/commit.vim +++ b/autoload/lawrencium/commit.vim @@ -20,7 +20,7 @@ endif " Open a commit message file. - let l:commit_path = s:tempname('hg-editor-', '.txt') + let l:commit_path = lawrencium#tempname('hg-editor-', '.txt') let l:split = a:vertical ? 'vsplit' : 'split' execute l:split . ' ' . l:commit_path call append(0, ['', '']) @@ -112,7 +112,7 @@ call lawrencium#trace("Committing with log file: " . a:log_file) " Clean all the 'HG: ' lines. - let l:is_valid = s:clean_commit_file(a:log_file) + let l:is_valid = lawrencium#clean_commit_file(a:log_file) if !l:is_valid call lawrencium#error("abort: Empty commit message") return diff --git a/autoload/lawrencium/hg.vim b/autoload/lawrencium/hg.vim --- a/autoload/lawrencium/hg.vim +++ b/autoload/lawrencium/hg.vim @@ -50,7 +50,7 @@ endif " Include the command file type mappings. -let s:file_type_mappings = expand(":h:h") . '/resources/hg_command_file_types.vim' +let s:file_type_mappings = expand(":h:h:h") . '/resources/hg_command_file_types.vim' if filereadable(s:file_type_mappings) execute "source " . fnameescape(s:file_type_mappings) endif diff --git a/autoload/lawrencium/log.vim b/autoload/lawrencium/log.vim --- a/autoload/lawrencium/log.vim +++ b/autoload/lawrencium/log.vim @@ -9,7 +9,7 @@ call lawrencium#add_reader("logpatch", "lawrencium#log#read_patch") endfunction -let s:log_style_file = expand(":h:h") . "/resources/hg_log.style" +let s:log_style_file = expand(":h:h:h") . "/resources/hg_log.style" function! lawrencium#log#read(repo, path_parts, full_path) abort let l:log_opts = join(split(a:path_parts['value'], ',')) @@ -87,10 +87,10 @@ " Clean up when the log buffer is deleted. let l:bufobj = lawrencium#buffer_obj() - call l:bufobj.OnDelete('call s:HgLog_Delete(' . l:bufobj.nr . ')') + call l:bufobj.OnDelete('call lawrencium#log#HgLog_Delete(' . l:bufobj.nr . ')') endfunction -function! s:HgLog_Delete(bufnr) +function! lawrencium#log#HgLog_Delete(bufnr) if g:lawrencium_auto_close_buffers call lawrencium#delete_dependency_buffers('lawrencium_diff_for', a:bufnr) call lawrencium#delete_dependency_buffers('lawrencium_rev_for', a:bufnr) diff --git a/autoload/lawrencium/record.vim b/autoload/lawrencium/record.vim --- a/autoload/lawrencium/record.vim +++ b/autoload/lawrencium/record.vim @@ -11,8 +11,8 @@ let l:diff_id = localtime() " Start diffing on the current file, enable some commands. - call l:orig_buf.DefineCommand('Hgrecordabort', ':call s:HgRecord_Abort()') - call l:orig_buf.DefineCommand('Hgrecordcommit', ':call s:HgRecord_Execute()') + call l:orig_buf.DefineCommand('Hgrecordabort', ':call lawrencium#record#HgRecord_Abort()') + call l:orig_buf.DefineCommand('Hgrecordcommit', ':call lawrencium#record#HgRecord_Execute()') call lawrencium#diff#HgDiffThis(l:diff_id) setlocal foldmethod=diff @@ -43,9 +43,9 @@ " Hookup the commit and abort commands. let l:rec_buf = lawrencium#buffer_obj() - call l:rec_buf.OnDelete('call s:HgRecord_Execute()') + call l:rec_buf.OnDelete('call lawrencium#record#HgRecord_Execute()') call l:rec_buf.DefineCommand('Hgrecordcommit', ':quit') - call l:rec_buf.DefineCommand('Hgrecordabort', ':call s:HgRecord_Abort()') + call l:rec_buf.DefineCommand('Hgrecordabort', ':call lawrencium#record#HgRecord_Abort()') call lawrencium#define_commands() " Make it the other part of the diff. @@ -59,12 +59,12 @@ endif endfunction -function! s:HgRecord_Execute() abort +function! lawrencium#record#HgRecord_Execute() abort if exists('b:lawrencium_record_abort') " Abort flag is set, let's just cleanup. let l:buf_nr = b:lawrencium_record_for == '%' ? bufnr('%') : \b:lawrencium_record_other_nr - call s:HgRecord_CleanUp(l:buf_nr) + call lawrencium#record#HgRecord_CleanUp(l:buf_nr) call lawrencium#error("abort: User requested aborting the record operation.") return endif @@ -84,19 +84,19 @@ let l:working_path = fnameescape(b:lawrencium_record_for) let l:record_path = fnameescape(expand('%:p')) let l:callbacks = [ - \'call s:HgRecord_PostExecutePre('.l:working_bufnr.', "'. + \'call lawrencium#record#HgRecord_PostExecutePre('.l:working_bufnr.', "'. \escape(l:working_path, '\').'", "'. \escape(l:record_path, '\').'")', - \'call s:HgRecord_PostExecutePost('.l:working_bufnr.', "'. + \'call lawrencium#record#HgRecord_PostExecutePost('.l:working_bufnr.', "'. \escape(l:working_path, '\').'")', - \'call s:HgRecord_PostExecuteAbort('.l:working_bufnr.', "'. + \'call lawrencium#record#HgRecord_PostExecuteAbort('.l:working_bufnr.', "'. \escape(l:record_path, '\').'")' \] call lawrencium#trace("Starting commit flow with callbacks: ".string(l:callbacks)) call lawrencium#commit#HgCommit(0, l:split, l:callbacks, b:lawrencium_record_for) endfunction -function! s:HgRecord_PostExecutePre(working_bufnr, working_path, record_path) abort +function! lawrencium#record#HgRecord_PostExecutePre(working_bufnr, working_path, record_path) abort " Just before committing, we switch the original file with the record " file... we'll restore things in the post-callback below. " We also switch on 'autoread' temporarily on the working buffer so that @@ -111,13 +111,13 @@ sleep 200m endfunction -function! s:HgRecord_PostExecutePost(working_bufnr, working_path) abort +function! lawrencium#record#HgRecord_PostExecutePost(working_bufnr, working_path) abort " Recover the back-up file from underneath the buffer. call lawrencium#trace("Recovering original file: ".a:working_path) silent call rename(a:working_path.'~working', a:working_path) " Clean up! - call s:HgRecord_CleanUp(a:working_bufnr) + call lawrencium#record#HgRecord_CleanUp(a:working_bufnr) " Restore default 'autoread'. if has('dialog_gui') @@ -125,13 +125,13 @@ endif endfunction -function! s:HgRecord_PostExecuteAbort(working_bufnr, record_path) abort - call s:HgRecord_CleanUp(a:working_bufnr) +function! lawrencium#record#HgRecord_PostExecuteAbort(working_bufnr, record_path) abort + call lawrencium#record#HgRecord_CleanUp(a:working_bufnr) call lawrencium#trace("Delete discarded record file: ".a:record_path) silent call delete(a:record_path) endfunction -function! s:HgRecord_Abort() abort +function! lawrencium#record#HgRecord_Abort() abort if b:lawrencium_record_for == '%' " We're in the working directory buffer. Switch to the 'recording' " buffer and quit. @@ -144,7 +144,7 @@ quit! endfunction -function! s:HgRecord_CleanUp(buf_nr) abort +function! lawrencium#record#HgRecord_CleanUp(buf_nr) abort " Get in the original buffer and clean the local commands/variables. let l:buf_obj = lawrencium#buffer_obj(a:buf_nr) call l:buf_obj.MoveToFirstWindow() diff --git a/autoload/lawrencium/status.vim b/autoload/lawrencium/status.vim --- a/autoload/lawrencium/status.vim +++ b/autoload/lawrencium/status.vim @@ -80,7 +80,7 @@ endif endfunction -function! s:HgStatus_Refresh(...) abort +function! lawrencium#status#HgStatusRefresh(...) abort if a:0 > 0 let l:win_nr = bufwinnr(a:1) call lawrencium#trace("Switching back to status window ".l:win_nr) @@ -104,6 +104,10 @@ edit endfunction +function! s:HgStatus_Refresh() abort + call lawrencium#status#HgStatusRefresh() +endfunction + function! s:HgStatus_FileEdit(newtab) abort " Get the path of the file the cursor is on. let l:filename = s:HgStatus_GetSelectedFile() @@ -148,7 +152,7 @@ call l:repo.RunCommand('addremove', l:filenames) " Refresh the status window. - call s:HgStatus_Refresh() + call lawrencium#status#HgStatusRefresh() endfunction function! s:HgStatus_Revert(linestart, lineend, bang) abort @@ -168,7 +172,7 @@ call l:repo.RunCommand('revert', l:filenames) " Refresh the status window. - call s:HgStatus_Refresh() + call lawrencium#status#HgStatusRefresh() endfunction function! s:HgStatus_Commit(linestart, lineend, bang, vertical) abort @@ -181,7 +185,7 @@ " Run `Hgcommit` on those paths. let l:buf_nr = bufnr('%') - let l:callback = 'call s:HgStatus_Refresh('.l:buf_nr.')' + let l:callback = 'call lawrencium#status#HgStatusRefresh('.l:buf_nr.')' call lawrencium#commit#HgCommit(a:bang, a:vertical, l:callback, l:filenames) endfunction @@ -230,7 +234,7 @@ call l:repo.RunCommand('qnew', l:filenames) " Refresh the status window. - call s:HgStatus_Refresh() + call lawrencium#status#HgStatusRefresh() endfunction function! s:HgStatus_QRefresh(linestart, lineend) abort @@ -247,7 +251,7 @@ call l:repo.RunCommand('qrefresh', l:filenames) " Refresh the status window. - call s:HgStatus_Refresh() + call lawrencium#status#HgStatusRefresh() endfunction