Git development
 help / color / mirror / Atom feed
From: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: paulus@samba.org,
	Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
Subject: [PATCH] Mod. gitk to support REBASE (with stash support).
Date: Wed,  8 Aug 2007 14:33:48 -0400	[thread overview]
Message-ID: <1186598028457-git-send-email-alexandre.bourget@savoirfairelinux.com> (raw)

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

             reply	other threads:[~2007-08-08 18:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 18:33 Alexandre Bourget [this message]
2007-08-08 19:31 ` [PATCH] Mod. gitk to support REBASE (with stash support) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1186598028457-git-send-email-alexandre.bourget@savoirfairelinux.com \
    --to=alexandre.bourget@savoirfairelinux.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox