From: Gustav Hållberg Date: Thu, 26 Feb 2009 19:59:07 +0000 (+0100) Subject: stgit.el: Add "B" for stgit-branch X-Git-Tag: v0.15-rc1~45 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/adeef6bc6f43fbccb1a046e00f57c559ee363737 stgit.el: Add "B" for stgit-branch Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 3b63533..7fd3786 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -541,7 +541,8 @@ (unless stgit-mode-map ("D" . stgit-delete) ([(control ?/)] . stgit-undo) ("\C-_" . stgit-undo) - ("q" . stgit-quit)))) + ("B" . stgit-branch) + ("q" . stgit-quit)))) (defun stgit-mode () "Major mode for interacting with StGit. @@ -677,6 +678,24 @@ (defun stgit-repair () (stgit-run "repair")) (stgit-reload)) +(defun stgit-available-branches () + "Returns a list of the available stg branches" + (let ((output (with-output-to-string + (stgit-run "branch" "--list"))) + (start 0) + result) + (while (string-match "^>?\\s-+s\\s-+\\(\\S-+\\)" output start) + (setq result (cons (match-string 1 output) result)) + (setq start (match-end 0))) + result)) + +(defun stgit-branch (branch) + "Switch to branch BRANCH." + (interactive (list (completing-read "Switch to branch: " + (stgit-available-branches)))) + (stgit-capture-output nil (stgit-run "branch" "--" branch)) + (stgit-reload)) + (defun stgit-commit (count) "Run stg commit on COUNT commits. Interactively, the prefix argument is used as COUNT."