All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mod. gitk to support REBASE (with stash support).
@ 2007-08-08 18:33 Alexandre Bourget
  2007-08-08 19:31 ` Peter Baumann
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alexandre Bourget @ 2007-08-08 18:33 UTC (permalink / raw)
  To: Git Mailing List; +Cc: paulus, Alexandre Bourget

---
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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-08-09  7:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 18:33 [PATCH] Mod. gitk to support REBASE (with stash support) Alexandre Bourget
2007-08-08 19:31 ` Peter Baumann
2007-08-08 19:42 ` Johannes Schindelin
2007-08-08 20:08   ` David Kastrup
2007-08-09  3:26     ` Shawn O. Pearce
2007-08-09  5:51       ` David Kastrup
2007-08-09  6:58         ` Shawn O. Pearce
2007-08-09  7:21           ` Shawn O. Pearce
2007-08-09  7:55           ` David Kastrup
2007-08-08 19:53 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.