aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav HÃ¥llberg <gustav@virtutech.com>2009-12-04 08:55:03 +0100
committerKarl Wiberg <kha@treskal.com>2009-12-04 08:55:05 +0100
commitd6e17ce04e5b6e766bec35f7c7e56d1b5139b307 (patch)
treee440fb56accf4a00607838c4b254ad9c1fe22874
parent3e528fb0f9dd58c6e4bcb46ed53c532c9c947f03 (diff)
downloadstgit-d6e17ce04e5b6e766bec35f7c7e56d1b5139b307.tar.gz
stgit.el: Get default rebase branch from git-config in stg-rebase
Signed-off-by: Gustav HÃ¥llberg <gustav@virtutech.com>
-rw-r--r--contrib/stgit.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el
index 0335d6d..3dd1989 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -1454,10 +1454,25 @@ If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"."
result)
result))))
+(defun stgit-parent-branch ()
+ "Return the parent branch of the current stg branch as per
+git-config setting branch.<branch>.stgit.parentbranch."
+ (let ((output (with-output-to-string
+ (stgit-run-git-silent "config"
+ (format "branch.%s.stgit.parentbranch"
+ (stgit-current-branch))))))
+ (when (string-match ".*" output)
+ (match-string 0 output))))
+
(defun stgit-rebase (new-base)
- "Rebase to NEW-BASE."
+ "Rebase the current branch to NEW-BASE.
+
+Interactively, first ask which branch to rebase to. Defaults to
+what git-config branch.<branch>.stgit.parentbranch is set to."
(interactive (list (completing-read "Rebase to: "
- (stgit-available-refs t))))
+ (stgit-available-refs t)
+ nil nil
+ (stgit-parent-branch))))
(stgit-assert-mode)
(stgit-capture-output nil (stgit-run "rebase" new-base))
(stgit-reload))