M autoload/lawrencium/annotate.vim +5 -5
@@ 98,7 98,7 @@ function! lawrencium#annotate#HgAnnotate
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 @@ function! lawrencium#annotate#HgAnnotate
" 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 @@ function! s:HgAnnotate_DiffSummary(...)
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.
M autoload/lawrencium/commit.vim +2 -2
@@ 20,7 20,7 @@ function! lawrencium#commit#HgCommit(ban
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 @@ function! s:HgCommit_Execute(log_file, s
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
M autoload/lawrencium/hg.vim +1 -1
@@ 50,7 50,7 @@ else
endif
" Include the command file type mappings.
-let s:file_type_mappings = expand("<sfile>:h:h") . '/resources/hg_command_file_types.vim'
+let s:file_type_mappings = expand("<sfile>:h:h:h") . '/resources/hg_command_file_types.vim'
if filereadable(s:file_type_mappings)
execute "source " . fnameescape(s:file_type_mappings)
endif
M autoload/lawrencium/log.vim +3 -3
@@ 9,7 9,7 @@ function! lawrencium#log#init() abort
call lawrencium#add_reader("logpatch", "lawrencium#log#read_patch")
endfunction
-let s:log_style_file = expand("<sfile>:h:h") . "/resources/hg_log.style"
+let s:log_style_file = expand("<sfile>: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 @@ function! lawrencium#log#HgLog(vertical,
" 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)
M autoload/lawrencium/record.vim +16 -16
@@ 11,8 11,8 @@ function! lawrencium#record#HgRecord(spl
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 @@ function! lawrencium#record#HgRecord(spl
" 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 @@ function! lawrencium#record#HgRecord(spl
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 @@ function! s:HgRecord_Execute() abort
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 @@ function! s:HgRecord_PostExecutePre(work
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 @@ function! s:HgRecord_PostExecutePost(wor
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 @@ function! s:HgRecord_Abort() abort
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()
M autoload/lawrencium/status.vim +10 -6
@@ 80,7 80,7 @@ function! lawrencium#status#HgStatus() a
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 @@ function! s:HgStatus_Refresh(...) abort
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 @@ function! s:HgStatus_AddRemove(linestart
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 @@ function! s:HgStatus_Revert(linestart, l
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 @@ function! s:HgStatus_Commit(linestart, l
" 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 @@ function! s:HgStatus_QNew(linestart, lin
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 @@ function! s:HgStatus_QRefresh(linestart,
call l:repo.RunCommand('qrefresh', l:filenames)
" Refresh the status window.
- call s:HgStatus_Refresh()
+ call lawrencium#status#HgStatusRefresh()
endfunction