magit-submodule-update:
Update the submodule of the current git repository
magit-submodule-update-init:
Update and init the submodule of the current git repository
magit-submodule-init:
Initialize the submodules
magit-submodule-sync
Synchronizes submodules' remote URL configuration
---
magit-key-mode.el | 10 +++++++++-
magit.el | 32 +++++++++++++++++++++++++++++++-
magit.texi | 21 +++++++++++++++++++++
3 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/magit-key-mode.el b/magit-key-mode.el
index 23b58d4..ba1a56e 100644
--- a/magit-key-mode.el
+++ b/magit-key-mode.el
@@ -115,7 +115,15 @@
("a" "Abort" magit-rewrite-abort)
("f" "Finish" magit-rewrite-finish)
("*" "Set unused" magit-rewrite-set-unused)
- ("." "Set used" magit-rewrite-set-used))))
+ ("." "Set used" magit-rewrite-set-used)))
+
+ (submodule
+ (man-page "git-submodule")
+ (actions
+ ("u" "Update" magit-submodule-update)
+ ("b" "Both update and init" magit-submodule-update-init)
+ ("i" "Init" magit-submodule-init)
+ ("s" "Sync" magit-submodule-sync))))
"Holds the key, help, function mapping for the log-mode. If you
modify this make sure you reset `magit-key-mode-key-maps' to
nil.")
diff --git a/magit.el b/magit.el
index 1858dc8..fb8da93 100644
--- a/magit.el
+++ b/magit.el
@@ -437,6 +437,7 @@ Many Magit faces inherit from this one by default."
(define-key map (kbd "v") 'magit-revert-item)
(define-key map (kbd "b") 'magit-key-mode-popup-branching)
(define-key map (kbd "m") 'magit-key-mode-popup-merging)
+ (define-key map (kbd "M") 'magit-key-mode-popup-submodule)
(define-key map (kbd "k") 'magit-discard-item)
(define-key map (kbd "e") 'magit-interactive-resolve-item)
(define-key map (kbd "C") 'magit-add-log)
@@ -1842,6 +1843,11 @@ FUNC should leave point at the end of the modified
region"
["Push" magit-push t]
["Pull" magit-pull t]
["Remote update" magit-remote-update t]
+ ("Submodule"
+ ["Submodule update" magit-submodule-update t]
+ ["Submodule update and init" magit-submodule-update-init t]
+ ["Submodule init" magit-submodule-init t]
+ ["Submodule sync" magit-submodule-sync t])
"---"
("Extensions")
"---"
@@ -4417,6 +4423,30 @@ With prefix force the removal even it it hasn't been
merged."
(magit-list-buffers))
'string=)))
-(provide 'magit)
+(defun magit-submodule-update (&optional init)
+ "Update the submodule of the current git repository
+
+With a prefix arg, do a submodule update --init"
+ (interactive "P")
+ (let ((default-directory (magit-get-top-dir default-directory)))
+ (apply #'magit-run-git-async "submodule" "update" (if init '("--init")
()))))
+
+(defun magit-submodule-update-init ()
+ "Update and init the submodule of the current git repository."
+ (magit-submodule-update t))
+
+(defun magit-submodule-init ()
+ "Initialize the submodules"
+ (interactive)
+ (let ((default-directory (magit-get-top-dir default-directory)))
+ (magit-run-git-async "submodule" "init")))
+
+(defun magit-submodule-sync ()
+ "Synchronizes submodules' remote URL configuration"
+ (interactive)
+ (let ((default-directory (magit-get-top-dir default-directory)))
+ (magit-run-git-async "submodule" "sync")))
+
+(provide 'magit)
;;; magit.el ends here
diff --git a/magit.texi b/magit.texi
index 2ad016b..5e75c6c 100644
--- a/magit.texi
+++ b/magit.texi
@@ -48,6 +48,7 @@ as an extension to Emacs.
* Rebasing::
* Rewriting::
* Pushing and Pulling::
+* Submodules::
* Using Magit Extensions::
* Using Git Directly::
@end menu
@@ -676,6 +677,25 @@ When the remote branch has changes that are not in the
current branch,
Magit shows them in a section called @emph{Unpulled changes}. Typing
@kbd{f f} will merge them into the current branch.
+...@node Submodules
+...@chapter Submodules
+
+...@table @kbd
+...@item M u
+Update the submodules, with a prefix argument it will initializing.
+
+...@item M i
+Initialize the submodules.
+
+...@item M b
+Update and initialize the submodules in one go.
+
+...@item M s
+Synchronizes submodules' remote URL configuration setting to the value
+specified in .gitmodules.
+...@end table
+
+
@node Using Magit Extensions
@chapter Magit Extensions
@@ -685,6 +705,7 @@ Magit shows them in a section called @emph{Unpulled
changes}. Typing
* Developing Extensions::
@end menu
+
@node Interfacing with Subversion
@section Interfacing with Subversion
--
1.7.2.3
--
Rémi Vanicat