Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6389ff1
commit 4394789
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
;;; magit-flow.el --- git-flow plug-in for Magit | ||
|
||
;; Copyright (C) 2012 Phil Jackson | ||
;; | ||
;; Magit is free software; you can redistribute it and/or modify it | ||
;; under the terms of the GNU General Public License as published by | ||
;; the Free Software Foundation; either version 3, or (at your option) | ||
;; any later version. | ||
;; | ||
;; Magit is distributed in the hope that it will be useful, but WITHOUT | ||
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
;; License for more details. | ||
;; | ||
;; You should have received a copy of the GNU General Public License | ||
;; along with Magit. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; This plug-in provides git-flow functionality as a separate | ||
;; component of Magit | ||
|
||
;;; Code: | ||
|
||
(require 'magit) | ||
(eval-when-compile | ||
(require 'cl)) | ||
|
||
(defun magit-run-git-flow (&rest args) | ||
(apply 'magit-run-git (cons "flow" args))) | ||
|
||
(defun magit-flow-init () | ||
(interactive) | ||
(magit-run-git-flow "init" "-d") | ||
(magit-display-process)) | ||
|
||
(defun magit-flow-create-feature () | ||
(interactive) | ||
(let (name (read-string "Create feature branch: ")) | ||
(magit-run-git-flow "feature" "start" name))) | ||
|
||
(defvar magit-flow-mode-map | ||
(let ((map (make-sparse-keymap))) | ||
(define-key map (kbd "o") 'magit-key-mode-popup-flow) | ||
map)) | ||
|
||
;;;###autoload | ||
(define-minor-mode magit-flow-mode "FLOW support for Magit" | ||
:lighter " FLOW" | ||
:require 'magit-flow | ||
:keymap 'magit-flow-mode-map) | ||
|
||
;;;###autoload | ||
(defun turn-on-magit-flow () | ||
"Unconditionally turn on `magit-flow-mode'." | ||
(magit-flow-mode 1)) | ||
|
||
;; add the group and its keys | ||
(progn | ||
;; (re-)create the group | ||
(magit-key-mode-add-group 'flow) | ||
(magit-key-mode-insert-action | ||
'flow | ||
"n" | ||
"Create feature" | ||
'magit-flow-create-feature) | ||
|
||
(magit-key-mode-insert-action | ||
'flow | ||
"i" | ||
"Init" | ||
'magit-flow-init) | ||
|
||
(magit-key-mode-insert-action | ||
'flow | ||
"f l" | ||
"List features" | ||
'magit-flow-create-feature) | ||
|
||
;; generate and bind the menu popup function | ||
(magit-key-mode-generate 'flow)) | ||
|
||
(provide 'magit-flow) | ||
;;; magit-flow.el ends here |