--- Adds a context menu for commits, so that a 'rebase' can be done. Optionally, it will ask if you want to 'stash' current work before doing so. TODO: better error handling. gitk | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/gitk b/gitk index f74ce51..558b7bb 100755 --- a/gitk +++ b/gitk @@ -898,6 +898,8 @@ proc makewindow {} { -command cherrypick $rowctxmenu add command -label "Reset HEAD branch to here" \ -command resethead + $rowctxmenu add command -label "Rebase HEAD branch on this commit" \ + -command rebasehead set fakerowmenu .fakerowmenu menu $fakerowmenu -tearoff 0 @@ -5593,6 +5595,7 @@ proc rowmenu {x y id} { if {$id ne $nullid && $id ne $nullid2} { set menu $rowctxmenu $menu entryconfigure 7 -label "Reset $mainhead branch to here" + $menu entryconfigure 8 -label "Rebase $mainhead branch on this commit" } else { set menu $fakerowmenu } @@ -5972,6 +5975,41 @@ proc cherrypick {} { notbusy cherrypick } +proc rebasehead {} { + global mainheadid mainhead rowmenuid confirm_ok + global localfrow localirow + + + set head $mainhead + set id $rowmenuid + + set confirm_ok 0 + + if {$localfrow != -1 || $localirow != -1} { + # There's something to stash. + set confirm_ok [confirm_popup "There are some local modifications.\n\nDo you want to git-stash any changes before doing a rebase?\n\n(They will be reapplied right after, and stash will be *cleared*)"] + } + + nowbusy rebasehead + update + + if {$confirm_ok} { + exec git stash save + } + + # TODO: error handling. + exec git rebase $id + + if {$confirm_ok} { + exec git stash apply stash@{0} + exec git stash clear + } + + notbusy rebasehead + updatecommits +} + + proc resethead {} { global mainheadid mainhead rowmenuid confirm_ok resettype global showlocalchanges -- 1.5.3.rc4.24.g5b56a - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html