aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2016-05-12 12:26:00 +0200
committerJonas Bernoulli <jonas@bernoul.li>2016-05-12 12:26:00 +0200
commitbcabbf21b39a7f81ee54aaff627e795c19fbd3cd (patch)
treebaea54c9677db027ba1d2d9e3458b5f1ef5cc098
parent19844e680675b2c3c7f22120b6952b99b568ccf9 (diff)
magit-branch-config-popup: bind in other popups
-rw-r--r--Documentation/RelNotes/2.7.0.txt12
-rw-r--r--lisp/magit-remote.el19
-rw-r--r--lisp/magit.el52
3 files changed, 47 insertions, 36 deletions
diff --git a/Documentation/RelNotes/2.7.0.txt b/Documentation/RelNotes/2.7.0.txt
index 38bcf71..e7469de 100644
--- a/Documentation/RelNotes/2.7.0.txt
+++ b/Documentation/RelNotes/2.7.0.txt
@@ -6,6 +6,18 @@ Changes since v2.6.2
* Added new popup `magit-subtree-popup' and bound "O" to it.
+* Added new popup `magit-branch-config-popup' and made it available
+ from the popups `magit-branch-popup', `magit-pull-and-fetch-popup',
+ `magit-pull-popup', `magit-fetch-popup', and `magit-push-popup'.
+
+ With a prefix argument it reads a the branch to be configured in
+ the minibuffer instead of using the current branch.
+
+* Added new option `magit-branch-popup-show-variables', defaulting to
+ t to avoid changing key bindings. When set to nil, no variables are
+ displayed directly in the `magit-branch-popup', instead the subpopup
+ `magit-branch-config-popup' has to be used.
+
* Added new commands `magit-worktree-checkout',
`magit-worktree-branch', `magit-worktree-delete',
and `magit-worktree-status'.
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index 980c6d1..91816e9 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -178,7 +178,9 @@ Delete the symbolic-ref \"refs/remotes/<remote>/HEAD\"."
'magit-commands
:man-page "git-fetch"
:switches '((?p "Prune deleted branches" "--prune"))
- :actions '("Fetch from"
+ :actions '("Configure"
+ (?C "variables..." magit-branch-config-popup)
+ "Fetch from"
(?p magit-get-push-remote magit-fetch-from-pushremote)
(?u magit-get-remote magit-fetch-from-upstream)
(?e "elsewhere" magit-fetch)
@@ -271,9 +273,11 @@ removed on the respective remote."
"Popup console for pull commands."
'magit-commands
:man-page "git-pull"
- :variables '((?r "branch.%s.rebase"
+ :variables '("Configure"
+ (?r "branch.%s.rebase"
magit-cycle-branch*rebase
- magit-pull-format-branch*rebase))
+ magit-pull-format-branch*rebase)
+ (?C "variables..." magit-branch-config-popup))
:actions '((lambda ()
(--if-let (magit-get-current-branch)
(concat
@@ -315,10 +319,11 @@ missing. To add them use something like:
\\='magit-fetch-from-push-remote ?F))"
'magit-commands
:man-page "git-pull"
- :variables '("Pull variables"
+ :variables '("Configure"
(?r "branch.%s.rebase"
magit-cycle-branch*rebase
- magit-pull-format-branch*rebase))
+ magit-pull-format-branch*rebase)
+ (?C "variables..." magit-branch-config-popup))
:actions '((lambda ()
(--if-let (magit-get-current-branch)
(concat
@@ -418,7 +423,9 @@ removed after restarting Emacs."
(?d "Dry run" "--dry-run")
,@(and (not magit-push-current-set-remote-if-missing)
'((?u "Set upstream" "--set-upstream"))))
- :actions '((lambda ()
+ :actions '("Configure"
+ (?C "variables..." magit-branch-config-popup)
+ (lambda ()
(--when-let (magit-get-current-branch)
(concat (propertize "Push " 'face 'magit-popup-heading)
(propertize it 'face 'magit-branch-local)
diff --git a/lisp/magit.el b/lisp/magit.el
index b4f7b53..45a2ad7 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -279,6 +279,16 @@ prefer the former, then you should add branches such as \"master\",
:group 'magit-commands
:type '(repeat string))
+(defcustom magit-branch-popup-show-variables t
+ "Whether the `magit-branch-popup' shows Git variables.
+This defaults to t to avoid changing key bindings. When set to
+nil, no variables are displayed directly in this popup, instead
+the sub-popup `magit-branch-config-popup' has to be used to view
+and change branch related variables."
+ :package-version '(magit . "2.7.0")
+ :group 'magit-commands
+ :type 'boolean)
+
(defcustom magit-repository-directories nil
"Directories containing Git repositories.
Magit checks these directories for Git repositories and offers
@@ -1297,44 +1307,26 @@ Non-interactively DIRECTORY is (re-)initialized unconditionally."
"Popup console for branch commands."
'magit-commands
:man-page "git-branch"
- :variables '("Configure existing branches"
- (?d "branch.%s.description"
- magit-edit-branch*description
- magit-format-branch*description)
- (?u "branch.%s.merge"
- magit-set-branch*merge/remote
- magit-format-branch*merge/remote)
- (?r "branch.%s.rebase"
- magit-cycle-branch*rebase
- magit-format-branch*rebase)
- (?p "branch.%s.pushRemote"
- magit-cycle-branch*pushRemote
- magit-format-branch*pushRemote)
- "Configure repository defaults"
- (?\M-r "pull.rebase"
- magit-cycle-pull.rebase
- magit-format-pull.rebase)
- (?\M-p "remote.pushDefault"
- magit-cycle-remote.pushDefault
- magit-format-remote.pushDefault)
- "Configure branch creation"
- (?U "branch.autoSetupMerge"
- magit-cycle-branch*autoSetupMerge
- magit-format-branch*autoSetupMerge)
- (?R "branch.autoSetupRebase"
- magit-cycle-branch*autoSetupRebase
- magit-format-branch*autoSetupRebase))
:actions '((?b "Checkout" magit-checkout)
(?n "Create new branch" magit-branch)
- (?m "Rename" magit-branch-rename)
+ (?C "Configure..." magit-branch-config-popup)
(?c "Checkout new branch" magit-branch-and-checkout)
(?s "Create new spin-off" magit-branch-spinoff)
- (?x "Reset" magit-branch-reset)
+ (?m "Rename" magit-branch-rename)
(?w "Checkout new worktree" magit-worktree-checkout)
(?W "Create new worktree" magit-worktree-branch)
+ (?x "Reset" magit-branch-reset) nil nil
(?k "Delete" magit-branch-delete))
:default-action 'magit-checkout
- :max-action-columns 3)
+ :max-action-columns 3
+ :setup-function 'magit-branch-popup-setup)
+
+(defvar magit-branch-config-variables)
+
+(defun magit-branch-popup-setup (val def)
+ (magit-popup-default-setup val def)
+ (magit-popup-put :variables (magit-popup-convert-variables
+ val magit-branch-config-variables)))
;;;###autoload
(defun magit-checkout (revision)