Commit 9776338f authored by Jonas Bernoulli's avatar Jonas Bernoulli

rename magit-get-{tracked => upstream}-{ref,branch,remote}

parent 2dc55afe
......@@ -629,7 +629,7 @@ If no DWIM context is found, nil is returned."
(branch (let ((current (magit-get-current-branch))
(atpoint (magit-section-value it)))
(if (equal atpoint current)
(--if-let (magit-get-tracked-branch)
(--if-let (magit-get-upstream-branch)
(format "%s...%s" it current)
(if (magit-anything-modified-p)
current
......
......@@ -729,7 +729,7 @@ which is different from the current branch and still exists."
(cl-incf i))
prev))
(cl-defun magit-get-tracked-ref
(cl-defun magit-get-upstream-ref
(&optional (branch (magit-get-current-branch)))
(when branch
(let ((remote (magit-get "branch" branch "remote"))
......@@ -739,7 +739,7 @@ which is different from the current branch and still exists."
((string-prefix-p "refs/heads/" merge)
(concat "refs/remotes/" remote "/" (substring merge 11))))))))
(cl-defun magit-get-tracked-branch
(cl-defun magit-get-upstream-branch
(&optional (branch (magit-get-current-branch)))
(when branch
(let ((remote (magit-get "branch" branch "remote"))
......@@ -750,7 +750,7 @@ which is different from the current branch and still exists."
(propertize merge 'face 'magit-branch-local)
(propertize (concat remote "/" merge) 'face 'magit-branch-remote))))))
(cl-defun magit-get-tracked-remote
(cl-defun magit-get-upstream-remote
(&optional (branch (magit-get-current-branch)))
(when branch
(magit-get "branch" branch "remote")))
......@@ -848,7 +848,7 @@ where COMMITS is the number of commits in TAG but not in REV."
(magit-git-lines "branch" "--no-merged" commit))))
(defun magit-list-unmerged-to-upstream-branches ()
(--filter (-when-let (upstream (magit-get-tracked-branch it))
(--filter (-when-let (upstream (magit-get-upstream-branch it))
(member it (magit-list-unmerged-branches upstream)))
(magit-list-local-branch-names)))
......@@ -1221,6 +1221,14 @@ Return a list of two integers: (A>B B>A)."
(magit-git-string "config" "--unset" (mapconcat 'identity keys "."))))
;;; magit-git.el ends soon
(define-obsolete-function-alias 'magit-get-tracked-ref
'magit-get-upstream-ref "Magit 2.4.0")
(define-obsolete-function-alias 'magit-get-tracked-branch
'magit-get-upstream-branch "Magit 2.4.0")
(define-obsolete-function-alias 'magit-get-tracked-remote
'magit-get-upstream-remote "Magit 2.4.0")
(provide 'magit-git)
;; Local Variables:
;; indent-tabs-mode: nil
......
......@@ -1162,7 +1162,7 @@ Type \\[magit-cherry-pick-popup] to apply the commit at point.
(interactive
(let ((head (magit-read-branch "Cherry head")))
(list head (magit-read-other-branch "Cherry upstream" head
(magit-get-tracked-branch head)))))
(magit-get-upstream-branch head)))))
(magit-mode-setup #'magit-cherry-mode upstream head))
(defun magit-cherry-refresh-buffer (_upstream _head)
......@@ -1268,7 +1268,7 @@ Type \\[magit-reset] to reset HEAD to the commit at point.
(magit-insert-section (unpulled "..@{upstream}")
(magit-insert-heading
(format (propertize "Unpulled from %s:" 'face 'magit-section-heading)
(magit-get-tracked-branch)))
(magit-get-upstream-branch)))
(magit-insert-log "..@{upstream}" magit-log-section-arguments))))
(magit-define-section-jumper magit-jump-to-unpulled-from-pushremote
......@@ -1301,7 +1301,7 @@ Type \\[magit-reset] to reset HEAD to the commit at point.
(magit-insert-section (unpushed "@{upstream}..")
(magit-insert-heading
(format (propertize "Unpushed to %s:" 'face 'magit-section-heading)
(magit-get-tracked-branch)))
(magit-get-upstream-branch)))
(magit-insert-log "@{upstream}.." magit-log-section-arguments))))
(magit-define-section-jumper magit-jump-to-unpushed-to-pushremote
......@@ -1391,7 +1391,7 @@ These sections can be expanded to show the respective commits."
(dolist (module modules)
(let ((default-directory
(expand-file-name (file-name-as-directory module))))
(-when-let (tracked (magit-get-tracked-ref))
(-when-let (tracked (magit-get-upstream-ref))
(magit-insert-section sec (file module t)
(magit-insert-heading
(concat (propertize module 'face 'magit-diff-file-heading) ":"))
......@@ -1411,7 +1411,7 @@ These sections can be expanded to show the respective commits."
(dolist (module modules)
(let ((default-directory
(expand-file-name (file-name-as-directory module))))
(-when-let (tracked (magit-get-tracked-ref))
(-when-let (tracked (magit-get-upstream-ref))
(magit-insert-section sec (file module t)
(magit-insert-heading
(concat (propertize module 'face 'magit-diff-file-heading) ":"))
......
......@@ -174,9 +174,9 @@ Then show the status buffer for the new repository."
(propertize it 'face 'magit-branch-local)
(propertize " from" 'face 'magit-popup-heading))
(propertize "Pull from" 'face 'magit-popup-heading)))
(?p magit-get-push-branch magit-pull-from-pushremote)
(?u magit-get-tracked-branch magit-pull-from-upstream)
(?e "elsewhere" magit-pull))
(?p magit-get-push-branch magit-pull-from-pushremote)
(?u magit-get-upstream-branch magit-pull-from-upstream)
(?e "elsewhere" magit-pull))
:default-action 'magit-pull
:max-action-columns 1)
......@@ -206,7 +206,7 @@ Then show the status buffer for the new repository."
(defun magit-pull-from-upstream (args)
"Pull from the upstream of the current branch."
(interactive (list (magit-pull-arguments)))
(--if-let (magit-get-tracked-branch)
(--if-let (magit-get-upstream-branch)
(magit-git-pull it args)
(--if-let (magit-get-current-branch)
(user-error "No upstream is configured for %s" it)
......@@ -235,9 +235,9 @@ Then show the status buffer for the new repository."
(concat (propertize "Push " 'face 'magit-popup-heading)
(propertize it 'face 'magit-branch-local)
(propertize " to" 'face 'magit-popup-heading))))
(?p magit-get-push-branch magit-push-current-to-pushremote)
(?u magit-get-tracked-branch magit-push-current-to-upstream)
(?e "elsewhere" magit-push-current)
(?p magit-get-push-branch magit-push-current-to-pushremote)
(?u magit-get-upstream-branch magit-push-current-to-upstream)
(?e "elsewhere" magit-push-current)
"Push"
(?o "another branch" magit-push)
(?T "a tag" magit-push-tag)
......@@ -271,7 +271,7 @@ If that variable is unset, then push to `remote.pushDefault'."
"Push the current branch to its upstream branch."
(interactive (list (magit-push-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (target (magit-get-tracked-branch it))
(-if-let (target (magit-get-upstream-branch it))
(magit-git-push it target args)
(user-error "No upstream is configured for %s" it))
(user-error "No branch is checked out")))
......@@ -295,7 +295,7 @@ Both the source and the target are read in the minibuffer."
(let ((source (magit-read-local-branch-or-commit "Push")))
(list source
(magit-read-remote-branch (format "Push %s to" source) nil
(magit-get-tracked-branch source)
(magit-get-upstream-branch source)
source 'confirm)
(magit-push-arguments))))
(magit-git-push source target args))
......@@ -382,7 +382,7 @@ END is the last commit, usually a branch name, which upstream
is asked to pull. START has to be reachable from that commit."
(interactive
(list (magit-get "remote" (magit-read-remote "Remote") "url")
(magit-read-branch-or-commit "Start" (magit-get-tracked-branch))
(magit-read-branch-or-commit "Start" (magit-get-upstream-branch))
(magit-read-branch-or-commit "End")))
(let ((dir default-directory))
;; mu4e changes default-directory
......
......@@ -302,9 +302,9 @@ This discards all changes made since the sequence started."
(propertize (or (magit-get-current-branch) "HEAD")
'face 'magit-branch-local)
(propertize " onto" 'face 'magit-popup-heading)))
(?p magit-get-push-branch magit-rebase-onto-pushremote)
(?u magit-get-tracked-branch magit-rebase-onto-upstream)
(?e "elsewhere" magit-rebase)
(?p magit-get-push-branch magit-rebase-onto-pushremote)
(?u magit-get-upstream-branch magit-rebase-onto-upstream)
(?e "elsewhere" magit-rebase)
"Rebase"
(?i "interactively" magit-rebase-interactive)
(?m "to edit a commit" magit-rebase-edit-commit)
......@@ -339,7 +339,7 @@ If that variable is unset, then rebase onto `remote.pushDefault'."
"Rebase the current branch onto its upstream branch."
(interactive (list (magit-rebase-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (target (magit-get-tracked-branch it))
(-if-let (target (magit-get-upstream-branch it))
(magit-git-rebase target args)
(user-error "No upstream is configured for %s" it))
(user-error "No branch is checked out")))
......@@ -365,7 +365,7 @@ START has to be selected from a list of recent commits."
(interactive (list (magit-read-other-branch-or-commit
"Rebase subset onto"
(magit-get-current-branch)
(magit-get-tracked-branch))
(magit-get-upstream-branch))
nil
(magit-rebase-arguments)))
(if start
......@@ -382,7 +382,7 @@ START has to be selected from a list of recent commits."
(declare (indent 2))
(when commit
(if (eq commit :merge-base)
(setq commit (--if-let (magit-get-tracked-branch)
(setq commit (--if-let (magit-get-upstream-branch)
(magit-git-string "merge-base" it "HEAD")
nil))
(when (magit-git-failure "merge-base" "--is-ancestor" commit "HEAD")
......
......@@ -467,7 +467,7 @@ detached `HEAD'."
(cl-defun magit-insert-upstream-branch-header
(&optional (branch (magit-get-current-branch))
(pull (magit-get-tracked-branch branch))
(pull (magit-get-upstream-branch branch))
keyword)
"Insert a header line about branch usually pulled into current branch."
(when pull
......@@ -1305,7 +1305,7 @@ began on the old branch (likely but not necessarily \"master\")."
(-if-let (current (magit-get-current-branch))
(let (tracked base)
(magit-call-git "checkout" args "-b" branch current)
(when (and (setq tracked (magit-get-tracked-branch current))
(when (and (setq tracked (magit-get-upstream-branch current))
(setq base (magit-git-string "merge-base" current tracked))
(not (magit-rev-equal base current)))
(magit-run-git "update-ref" "-m"
......@@ -1334,7 +1334,7 @@ realize it's all crap and want to start over."
(delete branch (magit-list-branch-names))
nil nil nil 'magit-revision-history
(or (and (not (equal branch atpoint)) atpoint)
(magit-get-tracked-branch branch)))
(magit-get-upstream-branch branch)))
(magit-branch-arguments))))
(unless (member "--force" args)
(setq args (cons "--force" args)))
......@@ -1487,7 +1487,7 @@ is the full reference of the upstream branch, on the remote."
(let ((branch (or (and (not current-prefix-arg)
(magit-get-current-branch))
(magit-read-local-branch "Change upstream of branch"))))
(list branch (and (not (magit-get-tracked-branch branch))
(list branch (and (not (magit-get-upstream-branch branch))
(magit-completing-read
(format "Change upstream of %s to" branch)
(delete branch (magit-list-branch-names))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment