From: Gustav HÃ¥llberg Date: Sat, 8 Aug 2009 18:59:49 +0000 (+0200) Subject: stgit.el: Add C-c C-b for stgit-rebase X-Git-Tag: v0.15-rc2~11^2~12 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/380a021f81691d3cf7b8be3ec3980dc3004234df?ds=inline stgit.el: Add C-c C-b for stgit-rebase Signed-off-by: Gustav HÃ¥llberg --- diff --git a/contrib/stgit.el b/contrib/stgit.el index df1656e..827b139 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -771,6 +771,7 @@ (unless stgit-mode-map ([?\C-c ?\C-/] . stgit-redo) ("\C-c\C-_" . stgit-redo) ("B" . stgit-branch) + ("\C-c\C-b" . stgit-rebase) ("t" . ,toggle-map) ("d" . ,diff-map) ("q" . stgit-quit))))) @@ -855,6 +856,7 @@ (defun stgit-mode () Commands for branches: \\[stgit-branch] Switch to another branch +\\[stgit-rebase] Rebase the current branch Customization variables: `stgit-abbreviate-copies-and-renames' @@ -1049,6 +1051,31 @@ (defun stgit-branch (branch) (stgit-capture-output nil (stgit-run "branch" "--" branch)) (stgit-reload)) +(defun stgit-available-refs (&optional omit-stgit) + "Returns a list of the available git refs. +If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"." + (let* ((output (with-output-to-string + (stgit-run-git-silent "for-each-ref" "--format=%(refname)" + "refs/tags" "refs/heads" + "refs/remotes"))) + (result (split-string output "\n" t))) + (mapcar (lambda (s) + (if (string-match "^refs/\\(heads\\|tags\\|remotes\\)/" s) + (substring s (match-end 0)) + s)) + (if omit-stgit + (delete-if (lambda (s) + (string-match "^refs/heads/.*\\.stgit$" s)) + result) + result)))) + +(defun stgit-rebase (new-base) + "Rebase to NEW-BASE." + (interactive (list (completing-read "Rebase to: " + (stgit-available-refs t)))) + (stgit-capture-output nil (stgit-run "rebase" new-base)) + (stgit-reload)) + (defun stgit-commit (count) "Run stg commit on COUNT commits. Interactively, the prefix argument is used as COUNT.