Function: diff-hl-set-reference-rev-in-project

diff-hl-set-reference-rev-in-project is an interactive and natively compiled function defined in diff-hl.el.

Signature

(diff-hl-set-reference-rev-in-project REV)

Documentation

Set the reference revision in the current project to REV.

When called interactively, REV read with completion.

When called with a prefix argument, reset to the global value instead.

The default value chosen using one of methods below:

- In a log view buffer, it uses the revision of current entry.
Call vc-print-log or vc-print-root-log first to open a log view buffer.
- In a VC annotate buffer, it uses the revision of current line.
- In other situations, it uses the symbol at point.

Projects whose reference was set with this command are unaffected by subsequent changes to the global reference (see
`diff-hl-set-reference-rev`).

Also notice that this will disable diff-hl-amend-mode in buffers that enables it, since diff-hl-amend-mode overrides its effect.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/cfz56rl3lp066226i0bmmgiicls3gcq7-emacs-packages-deps/share/emacs/site-lisp/elpa/diff-hl-20261001.135/diff-hl.el
;;;###autoload
(defun diff-hl-set-reference-rev-in-project (rev)
  "Set the reference revision in the current project to REV.
When called interactively, REV read with completion.

When called with a prefix argument, reset to the global value instead.

The default value chosen using one of methods below:

- In a log view buffer, it uses the revision of current entry.
Call `vc-print-log' or `vc-print-root-log' first to open a log
view buffer.
- In a VC annotate buffer, it uses the revision of current line.
- In other situations, it uses the symbol at point.

Projects whose reference was set with this command are unaffected by
subsequent changes to the global reference (see
`diff-hl-set-reference-rev`).

Also notice that this will disable `diff-hl-amend-mode' in
buffers that enables it, since `diff-hl-amend-mode' overrides its
effect."
  (interactive
   (if current-prefix-arg current-prefix-arg
     (let* ((def (or (and (equal major-mode 'vc-annotate-mode)
                          (car (vc-annotate-extract-revision-at-line)))
                     (log-view-current-tag)
                     (thing-at-point 'symbol t)))
            (prompt (if def
                        (format "Reference revision (default %s): " def)
                      "Reference revision: ")))
       (list (vc-read-revision prompt nil nil def)))))
  (unless rev
    (user-error "No reference revision specified"))
  (let* ((proj (project-current))
         (name (project-name proj)))
    (cond
     ;; reset
     (current-prefix-arg
      (diff-hl-reset-reference-rev-in-project proj))
     ;; set
     (t
      (diff-hl-set-reference-rev-in-project-internal rev proj)
      (message "Showing changes against %s (project %s)" rev name)))))