branch: elpa/magit commit c9d9ce1b9ad1352bcaf57514c35bbfc946ebff62 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Increase name consistency for "commit" arguments - Never use REVISION. - For arguments of commands use COMMIT. - For arguments of other functions use REV. --- lisp/magit-blame.el | 6 +++--- lisp/magit-branch.el | 24 ++++++++++++------------ lisp/magit-extras.el | 8 ++++---- lisp/magit-git.el | 38 +++++++++++++++++++------------------- lisp/magit-log.el | 18 +++++++++--------- lisp/magit-refs.el | 6 +++--- lisp/magit-stash.el | 8 ++++---- lisp/magit-tag.el | 6 +++--- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el index e87bd4fc4ec..1de4e8f93d5 100644 --- a/lisp/magit-blame.el +++ b/lisp/magit-blame.el @@ -432,14 +432,14 @@ modes is toggled, then this mode also gets toggled automatically. (set-process-sentinel magit-this-process #'magit-blame-process-quickstart-sentinel))) -(defun magit-blame-run-process (revision file args &optional lines) +(defun magit-blame-run-process (rev file args &optional lines) (let ((process (magit-parse-git-async "blame" "--incremental" args (and lines (list "-L" (apply #'format "%s,%s" lines))) - revision "--" file))) + rev "--" file))) (set-process-filter process #'magit-blame-process-filter) (set-process-sentinel process #'magit-blame-process-sentinel) - (process-put process 'arguments (list revision file args)) + (process-put process 'arguments (list rev file args)) (setq magit-blame-cache (make-hash-table :test #'equal)) (setq magit-blame-process process))) diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el index 56a754e571a..2c84d4767de 100644 --- a/lisp/magit-branch.el +++ b/lisp/magit-branch.el @@ -252,24 +252,24 @@ has to be used to view and change branch related variables." (transient-args 'magit-branch)) ;;;###autoload -(defun magit-checkout (revision &optional args) - "Checkout REVISION, updating the index and the working tree. -If REVISION is a local branch, then that becomes the current +(defun magit-checkout (commit &optional args) + "Checkout COMMIT, updating the index and the working tree. +If COMMIT is a local branch, then that becomes the current branch. If it is something else, then `HEAD' becomes detached. Checkout fails if the working tree or the staging area contain changes. -\n(git checkout REVISION)." +\n(git checkout COMMIT)." (declare (interactive-only magit--checkout)) (interactive (list (magit-read-other-branch-or-commit "Checkout") (magit-branch-arguments))) - (when (string-match "\\`heads/\\(.+\\)" revision) - (setq revision (match-string 1 revision))) - (magit-run-git-async "checkout" args revision)) - -(defun magit--checkout (revision &optional args) - (when (string-match "\\`heads/\\(.+\\)" revision) - (setq revision (match-string 1 revision))) - (magit-call-git "checkout" args revision)) + (when (string-match "\\`heads/\\(.+\\)" commit) + (setq commit (match-string 1 commit))) + (magit-run-git-async "checkout" args commit)) + +(defun magit--checkout (rev &optional args) + (when (string-match "\\`heads/\\(.+\\)" rev) + (setq rev (match-string 1 rev))) + (magit-call-git "checkout" args rev)) ;;;###autoload (defun magit-branch-create (branch start-point) diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el index 7e346a689a1..e5501199c8d 100644 --- a/lisp/magit-extras.el +++ b/lisp/magit-extras.el @@ -431,8 +431,8 @@ Otherwise the author dates are also changed." :type 'boolean) ;;;###autoload -(defun magit-reshelve-since (rev keyid) - "Change the author and committer dates of the commits since REV. +(defun magit-reshelve-since (commit keyid) + "Change the author and committer dates of the commits since COMMIT. Ask the user for the first reachable commit whose dates should be changed. Then read the new date for that commit. The initial @@ -453,7 +453,7 @@ list returned by `magit-rebase-arguments'." (user-error "Refusing to reshelve detached head"))) (backup (concat "refs/original/refs/heads/" current))) (cond - ((not rev) + ((not commit) (when (and (magit-ref-p backup) (not (magit-y-or-n-p (format "Backup ref %s already exists. Override? " @@ -470,7 +470,7 @@ list returned by `magit-rebase-arguments'." (+ (floor time) (* offset 60) (- (car (decode-time time))))))) - (let* ((start (concat rev "^")) + (let* ((start (concat commit "^")) (range (concat start ".." current)) (time-rev (adjust (float-time (string-to-number (magit-rev-format "%at" start))) diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 9ff3fbeff91..aa0282a834b 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1999,32 +1999,32 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (defun magit-list-remote-branches (&optional remote) (magit-list-refs (concat "refs/remotes/" remote))) -(defun magit-list-related-branches (relation &optional commit &rest args) +(defun magit-list-related-branches (relation &optional rev &rest args) (seq-remove (##string-match-p "\\(\\`(HEAD\\|HEAD -> \\)" %) (mapcar (##substring % 2) - (magit-git-lines "branch" args relation commit)))) + (magit-git-lines "branch" args relation rev)))) -(defun magit-list-containing-branches (&optional commit &rest args) - (magit-list-related-branches "--contains" commit args)) +(defun magit-list-containing-branches (&optional rev &rest args) + (magit-list-related-branches "--contains" rev args)) -(defun magit-list-publishing-branches (&optional commit) - (seq-filter (##magit-rev-ancestor-p (or commit "HEAD") %) +(defun magit-list-publishing-branches (&optional rev) + (seq-filter (##magit-rev-ancestor-p (or rev "HEAD") %) magit-published-branches)) -(defun magit-list-merged-branches (&optional commit &rest args) - (magit-list-related-branches "--merged" commit args)) +(defun magit-list-merged-branches (&optional rev &rest args) + (magit-list-related-branches "--merged" rev args)) -(defun magit-list-unmerged-branches (&optional commit &rest args) - (magit-list-related-branches "--no-merged" commit args)) +(defun magit-list-unmerged-branches (&optional rev &rest args) + (magit-list-related-branches "--no-merged" rev args)) (defun magit-list-unmerged-to-upstream-branches () (seq-filter (##and-let* ((upstream (magit-get-upstream-branch %))) (member % (magit-list-unmerged-branches upstream))) (magit-list-local-branch-names))) -(defun magit-list-branches-pointing-at (commit) +(defun magit-list-branches-pointing-at (rev) (let ((re (format "\\`%s refs/\\(heads\\|remotes\\)/\\(.*\\)\\'" - (magit-rev-verify commit)))) + (magit-rev-verify rev)))) (seq-keep (##and (string-match re %) (let ((name (match-string 2 %))) (and (not (string-suffix-p "HEAD" name)) @@ -2285,16 +2285,16 @@ If `first-parent' is set, traverse only first parents." (defun magit-rev-abbrev (rev) (magit-rev-parse (magit-abbrev-arg "short") rev)) -(defun magit-commit-children (commit &optional args) +(defun magit-commit-children (rev &optional args) (seq-keep (lambda (line) (pcase-let ((`(,child . ,parents) (split-string line " "))) - (and (member commit parents) child))) + (and (member rev parents) child))) (magit-git-lines "log" "--format=%H %P" (or args (list "--branches" "--tags" "--remotes")) - "--not" commit))) + "--not" rev))) -(defun magit-commit-parents (commit) - (and-let* ((str (magit-git-string "rev-list" "-1" "--parents" commit))) +(defun magit-commit-parents (rev) + (and-let* ((str (magit-git-string "rev-list" "-1" "--parents" rev))) (cdr (split-string str)))) (defun magit-patch-id (rev) @@ -2444,14 +2444,14 @@ and this option only controls what face is used.") (defun magit-object-type (object) (magit-git-string "cat-file" "-t" object)) -(defmacro magit-with-blob (commit file &rest body) +(defmacro magit-with-blob (rev file &rest body) (declare (indent 2) (debug (form form body))) `(magit--with-temp-process-buffer (let ((buffer-file-name ,file)) (save-excursion (magit-git-insert "cat-file" "-p" - (concat ,commit ":" buffer-file-name))) + (concat ,rev ":" buffer-file-name))) (decode-coding-inserted-region (point-min) (point-max) buffer-file-name t nil nil t) ,@body))) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index eaff50bd082..187c800bad2 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -780,7 +780,7 @@ restrict the log to the lines that the region touches." (user-error "Buffer isn't visiting a file"))) ;;;###autoload -(defun magit-log-trace-definition (file fn rev) +(defun magit-log-trace-definition (file fn commit) "Show log for the definition at point." (interactive (list (or (magit-file-relative-name) (user-error "Buffer isn't visiting a file")) @@ -791,7 +791,7 @@ restrict the log to the lines that the region touches." "HEAD"))) (require 'magit) (magit-log-setup-buffer - (list rev) + (list commit) (cons (format "-L:%s%s:%s" (string-replace ":" "\\:" (regexp-quote fn)) (if (derived-mode-p 'lisp-mode 'emacs-lisp-mode) @@ -937,10 +937,10 @@ is displayed in the current frame." "\\[magit-log-double-commit-limit] first")))) (user-error "Parent %s does not exist" parent-rev))))) -(defun magit-log-move-to-revision (rev) - "Read a revision and move to it in current log buffer. +(defun magit-log-move-to-revision (commit) + "Read a commit and move to it in current log buffer. -If the chosen reference or revision isn't being displayed in +If the chosen reference or commit isn't being displayed in the current log buffer, then inform the user about that and do nothing else. @@ -962,8 +962,8 @@ of the current repository first; creating it if necessary." (pop-to-buffer-same-window buf))) (t (apply #'magit-log-all-branches (magit-log-arguments)))) - (unless (magit-log-goto-commit-section (magit-rev-abbrev rev)) - (user-error "%s isn't visible in the current log buffer" rev)))) + (unless (magit-log-goto-commit-section (magit-rev-abbrev commit)) + (user-error "%s isn't visible in the current log buffer" commit)))) ;;;; Shortlog Commands @@ -996,12 +996,12 @@ of the current repository first; creating it if necessary." (switch-to-buffer-other-window (current-buffer)))))) ;;;###autoload -(defun magit-shortlog-since (rev args) +(defun magit-shortlog-since (commit args) "Show a history summary for commits since REV." (interactive (list (magit-read-branch-or-commit "Shortlog since" (magit-get-current-tag)) (transient-args 'magit-shortlog))) - (magit-git-shortlog (concat rev "..") args)) + (magit-git-shortlog (concat commit "..") args)) ;;;###autoload (defun magit-shortlog-range (rev-or-range args) diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el index 2bcee3e7e24..a26981a5b63 100644 --- a/lisp/magit-refs.el +++ b/lisp/magit-refs.el @@ -804,9 +804,9 @@ line is inserted at all." (message "No cherries for %s" ref) (magit-make-margin-overlay))))) -(defun magit-refs--format-margin (commit) - (if-let ((line (magit-rev-format "%cN%x00%ct" commit))) - (apply #'magit-log-format-margin commit (split-string line "\0")) +(defun magit-refs--format-margin (rev) + (if-let ((line (magit-rev-format "%cN%x00%ct" rev))) + (apply #'magit-log-format-margin rev (split-string line "\0")) (magit-make-margin-overlay))) ;;; _ diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el index 1ca279db7ad..84fbebdbb2d 100644 --- a/lisp/magit-stash.el +++ b/lisp/magit-stash.el @@ -450,8 +450,8 @@ Then apply STASH, dropping it if it applies cleanly." ((not worktree) "staged") (t "local")))))) -(defun magit-stash-store (message ref commit) - (magit-update-ref ref message commit)) +(defun magit-stash-store (message ref rev) + (magit-update-ref ref message rev)) (defun magit-stash-create (message index worktree untracked) (unless (magit-rev-parse "--verify" "HEAD") @@ -637,8 +637,8 @@ See also info node `(magit)Section Movement'." (cl-defmethod magit-buffer-value (&context (major-mode magit-stash-mode)) magit-buffer-revision) -(defun magit-stash-insert-section (commit range message &optional files) - (magit-insert-section (commit commit) +(defun magit-stash-insert-section (rev range message &optional files) + (magit-insert-section (commit rev) (magit-insert-heading message) (magit--insert-diff nil "diff" range "-p" "--no-prefix" magit-buffer-diff-args diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el index 78c87b277ac..a7863622874 100644 --- a/lisp/magit-tag.el +++ b/lisp/magit-tag.el @@ -62,8 +62,8 @@ :history-key 'magit:--gpg-sign) ;;;###autoload -(defun magit-tag-create (name rev &optional args) - "Create a new tag with the given NAME at REV. +(defun magit-tag-create (name commit &optional args) + "Create a new tag with the given NAME at COMMIT. With a prefix argument annotate the tag. \n(git tag [--annotate] NAME REV)" (interactive (list (magit-read-tag "Tag name") @@ -72,7 +72,7 @@ With a prefix argument annotate the tag. (when current-prefix-arg (cl-pushnew "--annotate" args :test #'equal)) args))) - (magit-run-git-with-editor "tag" args name rev)) + (magit-run-git-with-editor "tag" args name commit)) ;;;###autoload (defun magit-tag-delete (tags)