From adeef6bc6f43fbccb1a046e00f57c559ee363737 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustav=20H=C3=A5llberg?= Date: Thu, 26 Feb 2009 20:59:07 +0100 Subject: [PATCH] stgit.el: Add "B" for stgit-branch MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- contrib/stgit.el | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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 @@ find copied files." ("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 @@ If that patch cannot be found, return nil." (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." -- 2.11.0