Skip to content

Commit

Permalink
Some of the basic command in place.
Browse files Browse the repository at this point in the history
  • Loading branch information
philjackson committed Feb 3, 2013
1 parent 6389ff1 commit 4394789
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions magit-flow.el
@@ -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

0 comments on commit 4394789

Please sign in to comment.