X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/acc5652f1f94c454f5b0a8e8dd920e55387e7f7e..adeef6bc6f43fbccb1a046e00f57c559ee363737:/contrib/stgit.el?ds=inline 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."