Provide s/u mappings on commits

I need to figure out the big picture push story before I can document
the push maps.
This commit is contained in:
Tim Pope 2019-08-04 01:15:35 -04:00
parent c4d4986f1e
commit 35d7590354
2 changed files with 25 additions and 5 deletions

View File

@ -3047,7 +3047,7 @@ function! s:DoToggleHeadHeader(value) abort
call search('\C^index$', 'wc') call search('\C^index$', 'wc')
endfunction endfunction
function! s:DoToggleUnpushedHeading(heading) abort function! s:DoStageUnpushedHeading(heading) abort
let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/') let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/')
if empty(remote) if empty(remote)
let remote = '.' let remote = '.'
@ -3056,7 +3056,11 @@ function! s:DoToggleUnpushedHeading(heading) abort
call feedkeys(':Gpush ' . remote . ' ' . 'HEAD:' . branch) call feedkeys(':Gpush ' . remote . ' ' . 'HEAD:' . branch)
endfunction endfunction
function! s:DoToggleUnpushed(record) abort function! s:DoToggleUnpushedHeading(heading) abort
return s:DoStageUnpushedHeading(a:heading)
endfunction
function! s:DoStageUnpushed(record) abort
let remote = matchstr(a:record.heading, 'to \zs[^/]\+\ze/') let remote = matchstr(a:record.heading, 'to \zs[^/]\+\ze/')
if empty(remote) if empty(remote)
let remote = '.' let remote = '.'
@ -3065,12 +3069,28 @@ function! s:DoToggleUnpushed(record) abort
call feedkeys(':Gpush ' . remote . ' ' . a:record.commit . ':' . branch) call feedkeys(':Gpush ' . remote . ' ' . a:record.commit . ':' . branch)
endfunction endfunction
function! s:DoToggleUnpulledHeading(heading) abort function! s:DoToggleUnpushed(record) abort
return s:DoStageUnpushed(a:record)
endfunction
function! s:DoUnstageUnpulledHeading(heading) abort
call feedkeys(':Grebase') call feedkeys(':Grebase')
endfunction endfunction
function! s:DoToggleUnpulledHeading(heading) abort
call s:DoUnstageUnpulledHeading(a:heading)
endfunction
function! s:DoUnstageUnpulled(record) abort
call feedkeys(':Grebase ' . a:record.commit . '^')
endfunction
function! s:DoToggleUnpulled(record) abort function! s:DoToggleUnpulled(record) abort
call feedkeys(':Grebase ' . a:record.commit) call s:DoUnstageUnpulled(a:record)
endfunction
function! s:DoUnstageUnpushed(record) abort
call s:DoUnstageUnpulled(a:record)
endfunction endfunction
function! s:DoToggleStagedHeading(...) abort function! s:DoToggleStagedHeading(...) abort

View File

@ -483,7 +483,7 @@ cz? Show this help.
Rebase mappings ~ Rebase mappings ~
ri Perform an interactive rebase. Uses ancestor of ri Perform an interactive rebase. Uses ancestor of
commit under cursor as upstream if available. u commit under cursor as upstream if available.
rf Perform an autosquash rebase without editing the todo rf Perform an autosquash rebase without editing the todo
list. Uses ancestor of commit under cursor as list. Uses ancestor of commit under cursor as