comparison plugin/lawrencium.vim @ 78:e42f813b4a39

Fixed some bugs with the `Hgqseries` window.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 17 Feb 2014 08:35:30 -0800
parents f535cda5d20e
children cac06d16dafc
comparison
equal deleted inserted replaced
77:1c57a78e11fb 78:e42f813b4a39
633 for line in l:tail 633 for line in l:tail
634 call setbufvar(l:curbuffer, 'lawrencium_patchname_' . (l:idx + 1), l:names[l:idx]) 634 call setbufvar(l:curbuffer, 'lawrencium_patchname_' . (l:idx + 1), l:names[l:idx])
635 call append(l:idx, line) 635 call append(l:idx, line)
636 let l:idx = l:idx + 1 636 let l:idx = l:idx + 1
637 endfor 637 endfor
638 call setbufvar(l:curbuffer, 'lawrencium_patchname_top', l:names[len(l:head) - 1])
638 set filetype=hgqseries 639 set filetype=hgqseries
639 endfunction 640 endfunction
640 641
641 " Generic read 642 " Generic read
642 let s:lawrencium_file_readers = { 643 let s:lawrencium_file_readers = {
1693 return getbufvar('%', 'lawrencium_patchname_' . l:pos[1]) 1694 return getbufvar('%', 'lawrencium_patchname_' . l:pos[1])
1694 endfunction 1695 endfunction
1695 1696
1696 function! s:HgQSeries_Goto() abort 1697 function! s:HgQSeries_Goto() abort
1697 let l:repo = s:hg_repo() 1698 let l:repo = s:hg_repo()
1698 let l:patchname = HgQSeries_GetCurrentPatchName() 1699 let l:patchname = s:HgQSeries_GetCurrentPatchName()
1699 if len(l:patchname) == 0 1700 if len(l:patchname) == 0
1700 call s:error("No patch to go to here.") 1701 call s:error("No patch to go to here.")
1701 return 1702 return
1702 endif 1703 endif
1703 call l:repo.RunCommand('qgoto', l:patchname) 1704 call l:repo.RunCommand('qgoto', l:patchname)
1704 edit 1705 edit
1705 endfunction 1706 endfunction
1706 1707
1707 function! s:HgQSeries_Rename(...) abort 1708 function! s:HgQSeries_Rename(...) abort
1708 let l:repo = s:hg_repo() 1709 let l:repo = s:hg_repo()
1709 let l:current_name = HgQSeries_GetCurrentPatchName() 1710 let l:current_name = s:HgQSeries_GetCurrentPatchName()
1710 if len(l:current_name) == 0 1711 if len(l:current_name) == 0
1711 call s:error("No patch to rename here.") 1712 call s:error("No patch to rename here.")
1712 return 1713 return
1713 endif 1714 endif
1714 let l:new_name = '"' . join(a:000, ' ') . '"' 1715 let l:new_name = '"' . join(a:000, ' ') . '"'
1716 edit 1717 edit
1717 endfunction 1718 endfunction
1718 1719
1719 function! s:HgQSeries_EditMessage() abort 1720 function! s:HgQSeries_EditMessage() abort
1720 let l:repo = s:hg_repo() 1721 let l:repo = s:hg_repo()
1721 let l:patchname = getbufvar('%', 'lawrencium_patchname_1') 1722 let l:patchname = getbufvar('%', 'lawrencium_patchname_top')
1722 if len(l:patchname) == 0 1723 if len(l:patchname) == 0
1723 call s:error("No patch to edit here.") 1724 call s:error("No patch to edit here.")
1724 return 1725 return
1725 endif 1726 endif
1726 let l:current = split(l:repo.RunCommand('qheader', l:patchname), '\n') 1727 let l:current = split(l:repo.RunCommand('qheader', l:patchname), '\n')