aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2018-11-21 12:17:46 +0100
committerJonas Bernoulli <jonas@bernoul.li>2019-02-02 00:28:35 +0100
commitc47913461c099ced33488bb2daed90bf40458a5d (patch)
tree7b4390042f505c7c6351620cec21980840bc3aa6 /lisp
parent7e0ef84859bc168de3cd8babdbfcb8f03bcf8b86 (diff)
Rename magit-{push-current-set-remote => remote-set}-if-missing
We are going to use this for other, non-push, commands. Also move the definition to a file that is not solely about pushing and remove most of the doc-string because it is not accurate anymore and additionally would have to be modified several times over the next few commits.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/Makefile2
-rw-r--r--lisp/magit-obsolete.el5
-rw-r--r--lisp/magit-push.el44
-rw-r--r--lisp/magit-remote.el27
4 files changed, 41 insertions, 37 deletions
diff --git a/lisp/Makefile b/lisp/Makefile
index 84cf365..d57dc88 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -42,7 +42,7 @@ magit-commit.elc: magit.elc magit-sequence.elc
magit-remote.elc: magit.elc
magit-clone.elc: magit.elc
magit-fetch.elc: magit.elc
-magit-pull.elc: magit.elc
+magit-pull.elc: magit.elc magit-remote.elc
magit-push.elc: magit.elc
magit-patch.elc: magit.elc
magit-bisect.elc: magit.elc
diff --git a/lisp/magit-obsolete.el b/lisp/magit-obsolete.el
index 0cabad4..f71a5a4 100644
--- a/lisp/magit-obsolete.el
+++ b/lisp/magit-obsolete.el
@@ -50,6 +50,11 @@
(define-obsolete-function-alias 'magit-reflog 'magit-reflog-other "Magit 2.90.0")
(define-obsolete-function-alias 'magit-diff 'magit-diff-range "Magit 2.90.0")
+;;; Obsolete since v2.91.0
+
+(define-obsolete-variable-alias 'magit-push-current-set-remote-if-missing
+ 'magit-remote-set-if-missing "Magit 2.91.0")
+
;;; _
(provide 'magit-obsolete)
;;; magit-obsolete.el ends here
diff --git a/lisp/magit-push.el b/lisp/magit-push.el
index f34be47..a2637ff 100644
--- a/lisp/magit-push.el
+++ b/lisp/magit-push.el
@@ -32,34 +32,6 @@
(require 'magit)
-;;; Options
-
-(defcustom magit-push-current-set-remote-if-missing t
- "Whether to configure missing remotes before pushing.
-
-When nil, then the command `magit-push-current-to-pushremote' and
-`magit-push-current-to-upstream' do not appear in the push popup
-if the push-remote resp. upstream is not configured. If the user
-invokes one of these commands anyway, then it raises an error.
-
-When non-nil, then these commands always appear in the push
-popup. But if the required configuration is missing, then they
-do appear in a way that indicates that this is the case. If the
-user invokes one of them, then it asks for the necessary
-configuration, stores the configuration, and then uses it to push
-a first time.
-
-This option also affects whether the argument `--set-upstream' is
-available in the popup. If the value is t, then that argument is
-redundant. But note that changing the value of this option does
-not take affect immediately, the argument will only be added or
-removed after restarting Emacs."
- :package-version '(magit . "2.6.0")
- :group 'magit-commands
- :type '(choice (const :tag "don't set" nil)
- (const :tag "set branch.<name>.pushRemote" t)
- (const :tag "set remote.pushDefault" default)))
-
;;; Commands
;;;###autoload (autoload 'magit-push-popup "magit-push" nil t)
@@ -70,7 +42,7 @@ removed after restarting Emacs."
(?F "Force" "--force")
(?h "Disable hooks" "--no-verify")
(?d "Dry run" "--dry-run")
- ,@(and (not magit-push-current-set-remote-if-missing)
+ ,@(and (not magit-remote-set-if-missing)
'((?u "Set upstream" "--set-upstream"))))
:actions '("Configure"
(?C "variables..." magit-branch-config-popup)
@@ -104,7 +76,7 @@ removed after restarting Emacs."
"Push the current branch to `branch.<name>.pushRemote'.
If that variable is unset, then push to `remote.pushDefault'.
-When `magit-push-current-set-remote-if-missing' is non-nil and
+When `magit-remote-set-if-missing' is non-nil and
the push-remote is not configured, then read the push-remote from
the user, set it, and then push to it. With a prefix argument
the push-remote can be changed before pushed to it."
@@ -112,14 +84,14 @@ the push-remote can be changed before pushed to it."
(list (magit-push-arguments)
(and (magit--push-current-set-pushremote-p current-prefix-arg)
(magit-read-remote
- (if (eq magit-push-current-set-remote-if-missing 'default)
+ (if (eq magit-remote-set-if-missing 'default)
"Set `remote.pushDefault' and push there"
(format "Set `branch.%s.pushRemote' and push there"
(magit-get-current-branch)))))))
(--if-let (magit-get-current-branch)
(progn (when push-remote
(setf (magit-get
- (if (eq magit-push-current-set-remote-if-missing 'default)
+ (if (eq magit-remote-set-if-missing 'default)
"remote.pushDefault"
(format "branch.%s.pushRemote" it)))
push-remote))
@@ -132,7 +104,7 @@ the push-remote can be changed before pushed to it."
(defun magit--push-current-set-pushremote-p (&optional change)
(and (or change
- (and magit-push-current-set-remote-if-missing
+ (and magit-remote-set-if-missing
(not (magit-get-push-remote))))
(magit-get-current-branch)))
@@ -141,7 +113,7 @@ the push-remote can be changed before pushed to it."
(concat (magit-branch-set-face it) "\n")
(and (magit--push-current-set-pushremote-p)
(concat
- (propertize (if (eq magit-push-current-set-remote-if-missing 'default)
+ (propertize (if (eq magit-remote-set-if-missing 'default)
"pushDefault"
"pushRemote")
'face 'bold)
@@ -151,7 +123,7 @@ the push-remote can be changed before pushed to it."
(defun magit-push-current-to-upstream (args &optional upstream)
"Push the current branch to its upstream branch.
-When `magit-push-current-set-remote-if-missing' is non-nil and
+When `magit-remote-set-if-missing' is non-nil and
the upstream is not configured, then read the upstream from the
user, set it, and then push to it. With a prefix argument the
upstream can be changed before pushed to it."
@@ -170,7 +142,7 @@ upstream can be changed before pushed to it."
(defun magit--push-current-set-upstream-p (&optional change)
(and (or change
- (and magit-push-current-set-remote-if-missing
+ (and magit-remote-set-if-missing
(not (magit-get-upstream-branch))))
(magit-get-current-branch)))
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index fa2d921..827713e 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -55,6 +55,33 @@ to be used to view and change remote related variables."
:group 'magit-commands
:type 'boolean)
+(defcustom magit-remote-set-if-missing t
+ "Whether to configure missing remotes before pushing.
+
+When nil, then the command `magit-push-current-to-pushremote' and
+`magit-push-current-to-upstream' do not appear in the push popup
+if the push-remote resp. upstream is not configured. If the user
+invokes one of these commands anyway, then it raises an error.
+
+When non-nil, then these commands always appear in the push
+popup. But if the required configuration is missing, then they
+do appear in a way that indicates that this is the case. If the
+user invokes one of them, then it asks for the necessary
+configuration, stores the configuration, and then uses it to push
+a first time.
+
+This option also affects whether the argument `--set-upstream' is
+available in the popup. If the value is t, then that argument is
+redundant. But note that changing the value of this option does
+not take affect immediately, the argument will only be added or
+removed after restarting Emacs."
+ :package-version '(magit . "2.91.0")
+ :group 'magit-commands
+ :type '(choice
+ (const :tag "don't set" nil)
+ (const :tag "set (using branch.<name>.pushRemote for push-target)" t)
+ (const :tag "set (using remote.pushDefault for push-target" default)))
+
;;; Commands
(defvar magit-remote-config-variables)