comparison autoload/lawrencium/status.vim @ 140:652a6f5df0f3

Fixed for broken things after the reorganization.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 13 Jun 2016 21:55:40 -0700
parents 065625e1bb31
children 4d5f4233b04e
comparison
equal deleted inserted replaced
139:065625e1bb31 140:652a6f5df0f3
78 vnoremap <buffer> <silent> <C-A> :Hgstatusaddremove<cr> 78 vnoremap <buffer> <silent> <C-A> :Hgstatusaddremove<cr>
79 vnoremap <buffer> <silent> <C-S> :Hgstatuscommit<cr> 79 vnoremap <buffer> <silent> <C-S> :Hgstatuscommit<cr>
80 endif 80 endif
81 endfunction 81 endfunction
82 82
83 function! s:HgStatus_Refresh(...) abort 83 function! lawrencium#status#HgStatusRefresh(...) abort
84 if a:0 > 0 84 if a:0 > 0
85 let l:win_nr = bufwinnr(a:1) 85 let l:win_nr = bufwinnr(a:1)
86 call lawrencium#trace("Switching back to status window ".l:win_nr) 86 call lawrencium#trace("Switching back to status window ".l:win_nr)
87 if l:win_nr < 0 87 if l:win_nr < 0
88 call lawrencium#throw("Can't find the status window anymore!") 88 call lawrencium#throw("Can't find the status window anymore!")
102 " Just re-edit the buffer, it will reload the contents by calling 102 " Just re-edit the buffer, it will reload the contents by calling
103 " the matching Mercurial command. 103 " the matching Mercurial command.
104 edit 104 edit
105 endfunction 105 endfunction
106 106
107 function! s:HgStatus_Refresh() abort
108 call lawrencium#status#HgStatusRefresh()
109 endfunction
110
107 function! s:HgStatus_FileEdit(newtab) abort 111 function! s:HgStatus_FileEdit(newtab) abort
108 " Get the path of the file the cursor is on. 112 " Get the path of the file the cursor is on.
109 let l:filename = s:HgStatus_GetSelectedFile() 113 let l:filename = s:HgStatus_GetSelectedFile()
110 114
111 let l:cleanupbufnr = -1 115 let l:cleanupbufnr = -1
146 " Run `addremove` on those paths. 150 " Run `addremove` on those paths.
147 let l:repo = lawrencium#hg_repo() 151 let l:repo = lawrencium#hg_repo()
148 call l:repo.RunCommand('addremove', l:filenames) 152 call l:repo.RunCommand('addremove', l:filenames)
149 153
150 " Refresh the status window. 154 " Refresh the status window.
151 call s:HgStatus_Refresh() 155 call lawrencium#status#HgStatusRefresh()
152 endfunction 156 endfunction
153 157
154 function! s:HgStatus_Revert(linestart, lineend, bang) abort 158 function! s:HgStatus_Revert(linestart, lineend, bang) abort
155 " Get the selected filenames. 159 " Get the selected filenames.
156 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R']) 160 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R'])
166 call insert(l:filenames, '-C', 0) 170 call insert(l:filenames, '-C', 0)
167 endif 171 endif
168 call l:repo.RunCommand('revert', l:filenames) 172 call l:repo.RunCommand('revert', l:filenames)
169 173
170 " Refresh the status window. 174 " Refresh the status window.
171 call s:HgStatus_Refresh() 175 call lawrencium#status#HgStatusRefresh()
172 endfunction 176 endfunction
173 177
174 function! s:HgStatus_Commit(linestart, lineend, bang, vertical) abort 178 function! s:HgStatus_Commit(linestart, lineend, bang, vertical) abort
175 " Get the selected filenames. 179 " Get the selected filenames.
176 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R']) 180 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R'])
179 return 183 return
180 endif 184 endif
181 185
182 " Run `Hgcommit` on those paths. 186 " Run `Hgcommit` on those paths.
183 let l:buf_nr = bufnr('%') 187 let l:buf_nr = bufnr('%')
184 let l:callback = 'call s:HgStatus_Refresh('.l:buf_nr.')' 188 let l:callback = 'call lawrencium#status#HgStatusRefresh('.l:buf_nr.')'
185 call lawrencium#commit#HgCommit(a:bang, a:vertical, l:callback, l:filenames) 189 call lawrencium#commit#HgCommit(a:bang, a:vertical, l:callback, l:filenames)
186 endfunction 190 endfunction
187 191
188 function! s:HgStatus_Diff(split) abort 192 function! s:HgStatus_Diff(split) abort
189 " Open the file and run `Hgdiff` on it. 193 " Open the file and run `Hgdiff` on it.
228 call insert(l:filenames, l:message, 1) 232 call insert(l:filenames, l:message, 1)
229 endif 233 endif
230 call l:repo.RunCommand('qnew', l:filenames) 234 call l:repo.RunCommand('qnew', l:filenames)
231 235
232 " Refresh the status window. 236 " Refresh the status window.
233 call s:HgStatus_Refresh() 237 call lawrencium#status#HgStatusRefresh()
234 endfunction 238 endfunction
235 239
236 function! s:HgStatus_QRefresh(linestart, lineend) abort 240 function! s:HgStatus_QRefresh(linestart, lineend) abort
237 " Get the selected filenames. 241 " Get the selected filenames.
238 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R']) 242 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R'])
245 let l:repo = lawrencium#hg_repo() 249 let l:repo = lawrencium#hg_repo()
246 call insert(l:filenames, '-s', 0) 250 call insert(l:filenames, '-s', 0)
247 call l:repo.RunCommand('qrefresh', l:filenames) 251 call l:repo.RunCommand('qrefresh', l:filenames)
248 252
249 " Refresh the status window. 253 " Refresh the status window.
250 call s:HgStatus_Refresh() 254 call lawrencium#status#HgStatusRefresh()
251 endfunction 255 endfunction
252 256
253 257
254 function! s:HgStatus_GetSelectedFile() abort 258 function! s:HgStatus_GetSelectedFile() abort
255 let l:filenames = s:HgStatus_GetSelectedFiles() 259 let l:filenames = s:HgStatus_GetSelectedFiles()