diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2019-03-29 16:15:00 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2019-03-29 16:15:00 +0100 |
| commit | 93e0a818dd587139b9e5cec9b6119604d7a0446a (patch) | |
| tree | 5a80c9c6a1be30c7c8aa4a07dd65e64a80f9c883 /lisp/magit-remote.el | |
| parent | dd955a0e21ef914e64ad257f76c2e1311c29ead4 (diff) | |
Refactor commands that can set the upstream before their main task
Diffstat (limited to 'lisp/magit-remote.el')
| -rw-r--r-- | lisp/magit-remote.el | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el index 7b0b952..44192e7 100644 --- a/lisp/magit-remote.el +++ b/lisp/magit-remote.el @@ -312,7 +312,6 @@ Delete the symbolic-ref \"refs/remotes/<remote>/HEAD\"." :choices '("--no-tags" "--tags")) ;;; Transfer Utilities -;;;; Push-Remote (defun magit--push-remote-variable (&optional branch short) (unless branch @@ -358,42 +357,6 @@ Delete the symbolic-ref \"refs/remotes/<remote>/HEAD\"." (concat (magit--push-remote-variable branch) ", after setting that"))))) -;;;; Upstream - -(defun magit--transfer-upstream (upstream fn) - (declare (indent defun)) - (if-let ((current (magit-get-current-branch))) - (progn - (when upstream - (magit-set-upstream-branch current upstream)) - (if-let ((upstream (or upstream (magit-get-upstream-branch current t)))) - (funcall fn current upstream) - (user-error "No upstream is configured for %s" current))) - (user-error "No branch is checked out"))) - -(defun magit--transfer-set-upstream-p (&optional change) - (when-let ((current (magit-get-current-branch))) - (or change (not (magit-get-upstream-branch current t))))) - -(defun magit--transfer-maybe-read-upstream (action) - (and (magit--transfer-set-upstream-p current-prefix-arg) - (magit-read-upstream-branch - nil (format "Set upstream and %s there" action)))) - -(defun magit--upstream-suffix-description (&optional pushp) - (if-let ((upstream (magit-get-upstream-branch nil t))) - (cond ((consp upstream) - (pcase-let ((`(,url ,ref) upstream)) - (insert ref " from " (propertize url 'face 'bold) " "))) - ((magit-rev-verify upstream) upstream) - (pushp (concat upstream ", creating it")) - ;; This shouldn't happen often and even if it does, then - ;; transfering would still succeed iff the branch exists - ;; on the remote (only the tracking branch is missing). - (t (concat upstream ", which appears to be missing"))) - (and (magit--transfer-set-upstream-p) - (concat (propertize "@{upstream}" 'face 'bold) - ", after setting that")))) ;;; _ (provide 'magit-remote) |
