summaryrefslogtreecommitdiff
path: root/lisp/vc
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-07-31 14:27:28 +0200
committerPhilip Kaludercic <philipk@posteo.net>2022-07-31 14:27:28 +0200
commit118033294136a8fb3a14347ce190b447dd2ff2fe (patch)
tree3d036aa53a16c1283883b0955cbed77be3295310 /lisp/vc
parentedd73bd0d5474b71cbd4261c6a722be8f652bb9a (diff)
parentac237334c7672377721e4d27e8ecd6b09d453568 (diff)
downloademacs-118033294136a8fb3a14347ce190b447dd2ff2fe.tar.gz
emacs-118033294136a8fb3a14347ce190b447dd2ff2fe.tar.bz2
emacs-118033294136a8fb3a14347ce190b447dd2ff2fe.zip
Merge remote-tracking branch 'origin/master' into feature/package+vc
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/add-log.el3
-rw-r--r--lisp/vc/compare-w.el5
-rw-r--r--lisp/vc/diff-mode.el137
-rw-r--r--lisp/vc/diff.el16
-rw-r--r--lisp/vc/ediff-help.el2
-rw-r--r--lisp/vc/ediff-hook.el6
-rw-r--r--lisp/vc/ediff-init.el10
-rw-r--r--lisp/vc/ediff-merg.el2
-rw-r--r--lisp/vc/ediff-mult.el6
-rw-r--r--lisp/vc/ediff-util.el8
-rw-r--r--lisp/vc/ediff-wind.el29
-rw-r--r--lisp/vc/emerge.el6
-rw-r--r--lisp/vc/log-edit.el12
-rw-r--r--lisp/vc/log-view.el16
-rw-r--r--lisp/vc/vc-annotate.el3
-rw-r--r--lisp/vc/vc-bzr.el10
-rw-r--r--lisp/vc/vc-cvs.el11
-rw-r--r--lisp/vc/vc-dav.el4
-rw-r--r--lisp/vc/vc-dir.el35
-rw-r--r--lisp/vc/vc-dispatcher.el37
-rw-r--r--lisp/vc/vc-git.el2
-rw-r--r--lisp/vc/vc-hooks.el17
-rw-r--r--lisp/vc/vc-mtn.el380
-rw-r--r--lisp/vc/vc-rcs.el19
-rw-r--r--lisp/vc/vc-sccs.el11
-rw-r--r--lisp/vc/vc-src.el14
-rw-r--r--lisp/vc/vc-svn.el6
-rw-r--r--lisp/vc/vc.el9
28 files changed, 290 insertions, 526 deletions
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index beaad2e835f..e02d84f1f56 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -789,10 +789,9 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'."
If a ChangeLog file does not already exist, a non-nil value
means to put log entries in a suitably named buffer."
:type 'boolean
+ :safe #'booleanp
:version "27.1")
-(put 'add-log-dont-create-changelog-file 'safe-local-variable #'booleanp)
-
(defun add-log--pseudo-changelog-buffer-name (changelog-file-name)
"Compute a suitable name for a non-file visiting ChangeLog buffer.
CHANGELOG-FILE-NAME is the file name of the actual ChangeLog file
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index b56b4c0d83a..64d5d1081a3 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -1,7 +1,6 @@
;;; compare-w.el --- compare text between windows for Emacs -*- lexical-binding: t; -*-
-;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2022 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1986-2022 Free Software Foundation, Inc.
;; Maintainer: emacs-devel@gnu.org
;; Keywords: convenience files vc
@@ -99,7 +98,7 @@ may fail by finding the wrong match. The bigger number makes
difference regions more coarse-grained.
The default value 32 is good for the most cases."
- :type 'integer
+ :type 'natnum
:version "22.1")
(defcustom compare-windows-recenter nil
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 0bf78992460..aa426446d73 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -147,6 +147,12 @@ and hunk-based syntax highlighting otherwise as a fallback."
(const :tag "Highlight syntax" t)
(const :tag "Allow hunk-based fallback" hunk-also)))
+(defcustom diff-whitespace-style '(face trailing)
+ "Specify `whitespace-style' variable for `diff-mode' buffers."
+ :require 'whitespace
+ :type (get 'whitespace-style 'custom-type)
+ :version "29.1")
+
(defvar diff-vc-backend nil
"The VC backend that created the current Diff buffer, if any.")
@@ -1476,9 +1482,6 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
;; Added when diff--font-lock-prettify is non-nil!
(cl-pushnew 'display font-lock-extra-managed-props)))
-(defvar whitespace-style)
-(defvar whitespace-trailing-regexp)
-
(defvar-local diff-mode-read-only nil
"Non-nil when read-only diff buffer uses short keys.")
@@ -1487,6 +1490,9 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
(nconc minor-mode-map-alist
(list (cons 'diff-mode-read-only diff-mode-shared-map))))
+(defvar whitespace-style)
+(defvar whitespace-trailing-regexp)
+
;;;###autoload
(define-derived-mode diff-mode fundamental-mode "Diff"
"Major mode for viewing/editing context diffs.
@@ -1572,7 +1578,7 @@ a diff with \\[diff-reverse-direction].
This sets `whitespace-style' and `whitespace-trailing-regexp' so
that Whitespace mode shows trailing whitespace problems on the
modified lines of the diff."
- (setq-local whitespace-style '(face trailing))
+ (setq-local whitespace-style diff-whitespace-style)
(let ((style (save-excursion
(goto-char (point-min))
;; FIXME: For buffers filled from async processes, this search
@@ -1596,8 +1602,8 @@ modified lines of the diff."
nil)))
(when (eq diff-buffer-type 'git)
(setq diff-outline-regexp
- (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)"))
- (setq-local outline-level #'diff--outline-level))
+ (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)")))
+ (setq-local outline-level #'diff--outline-level)
(setq-local outline-regexp diff-outline-regexp))
(defun diff-delete-if-empty ()
@@ -2074,7 +2080,7 @@ For use in `add-log-current-defun-function'."
(re-search-forward "^[^ ]" nil t))
(pcase-let ((`(,buf ,_line-offset ,pos ,src ,dst ,switched)
(ignore-errors ;Signals errors in place of prompting.
- ;; Use `noprompt' since this is used in which-func-mode
+ ;; Use `noprompt' since this is used in which-function-mode
;; and such.
(diff-find-source-location nil nil 'noprompt))))
(when buf
@@ -2600,40 +2606,103 @@ fixed, visit it in a buffer."
(defun diff--font-lock-prettify (limit)
(when diff-font-lock-prettify
- (save-excursion
- ;; FIXME: Include the first space for context-style hunks!
- (while (re-search-forward "^[-+! ]" limit t)
- (let ((spec (alist-get (char-before)
- '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
- (?- . (left-fringe diff-fringe-del diff-indicator-removed))
- (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
- (?\s . (left-fringe diff-fringe-nul fringe))))))
- (put-text-property (match-beginning 0) (match-end 0) 'display spec))))
+ (when (> (frame-parameter nil 'left-fringe) 0)
+ (save-excursion
+ ;; FIXME: Include the first space for context-style hunks!
+ (while (re-search-forward "^[-+! ]" limit t)
+ (unless (eq (get-text-property (match-beginning 0) 'face)
+ 'diff-header)
+ (put-text-property
+ (match-beginning 0) (match-end 0)
+ 'display
+ (alist-get
+ (char-before)
+ '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
+ (?- . (left-fringe diff-fringe-del diff-indicator-removed))
+ (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
+ (?\s . (left-fringe diff-fringe-nul fringe)))))))))
;; Mimicks the output of Magit's diff.
;; FIXME: This has only been tested with Git's diff output.
+ ;; FIXME: Add support for Git's "rename from/to"?
(while (re-search-forward "^diff " limit t)
- ;; FIXME: Switching between context<->unified leads to messed up
- ;; file headers by cutting the `display' property in chunks!
+ ;; We split the regexp match into a search plus a looking-at because
+ ;; we want to use LIMIT for the search but we still want to match
+ ;; all the header's lines even if LIMIT falls in the middle of it.
(when (save-excursion
(forward-line 0)
(looking-at
(eval-when-compile
- (concat "diff.*\n"
- "\\(?:\\(?:new file\\|deleted\\).*\n\\)?"
- "\\(?:index.*\n\\)?"
- "--- \\(?:" null-device "\\|a/\\(.*\\)\\)\n"
- "\\+\\+\\+ \\(?:" null-device "\\|b/\\(.*\\)\\)\n"))))
- (put-text-property (match-beginning 0) (1- (match-end 0))
- 'display
- (propertize
- (cond
- ((null (match-string 1))
- (concat "new file " (match-string 2)))
- ((null (match-string 2))
- (concat "deleted " (match-string 1)))
- (t
- (concat "modified " (match-string 1))))
- 'face '(diff-file-header diff-header))))))
+ (let* ((index "\\(?:index.*\n\\)?")
+ (file4 (concat
+ "\\(?:" null-device "\\|[ab]/\\(?4:.*\\)\\)"))
+ (file5 (concat
+ "\\(?:" null-device "\\|[ab]/\\(?5:.*\\)\\)"))
+ (header (concat "--- " file4 "\n"
+ "\\+\\+\\+ " file5 "\n"))
+ (binary (concat
+ "Binary files " file4
+ " and " file5 " \\(?7:differ\\)\n"))
+ (horb (concat "\\(?:" header "\\|" binary "\\)?")))
+ (concat "diff.*?\\(?: a/\\(.*?\\) b/\\(.*\\)\\)?\n"
+ "\\(?:"
+ ;; For new/deleted files, there might be no
+ ;; header (and no hunk) if the file is/was empty.
+ "\\(?3:new\\(?6:\\)\\|deleted\\) file mode \\(?10:[0-7]\\{6\\}\\)\n"
+ index horb
+ ;; Normal case. There might be no header
+ ;; (and no hunk) if only the file mode
+ ;; changed.
+ "\\|"
+ "\\(?:old mode \\(?8:[0-7]\\{6\\}\\)\n\\)?"
+ "\\(?:new mode \\(?9:[0-7]\\{6\\}\\)\n\\)?"
+ index horb "\\)")))))
+ ;; The file names can be extracted either from the `diff' line
+ ;; or from the two header lines. Prefer the header line info if
+ ;; available since the `diff' line is ambiguous in case the
+ ;; file names include " b/" or " a/".
+ ;; FIXME: This prettification throws away all the information
+ ;; about the index hashes.
+ (let ((oldfile (or (match-string 4) (match-string 1)))
+ (newfile (or (match-string 5) (match-string 2)))
+ (kind (if (match-beginning 7) " BINARY"
+ (unless (or (match-beginning 4)
+ (match-beginning 5)
+ (not (match-beginning 3)))
+ " empty")))
+ (filemode
+ (cond
+ ((match-beginning 10)
+ (concat " file with mode " (match-string 10) " "))
+ ((and (match-beginning 8) (match-beginning 9))
+ (concat " file (mode changed from "
+ (match-string 8) " to " (match-string 9) ") "))
+ (t " file "))))
+ (add-text-properties
+ (match-beginning 0) (1- (match-end 0))
+ (list 'display
+ (propertize
+ (cond
+ ((match-beginning 3)
+ (concat (capitalize (match-string 3)) kind filemode
+ (if (match-beginning 6) newfile oldfile)))
+ ((and (null (match-string 4)) (match-string 5))
+ (concat "New " kind filemode newfile))
+ ((null (match-string 2))
+ ;; We used to use
+ ;; (concat "Deleted" kind filemode oldfile)
+ ;; here but that misfires for `diff-buffers'
+ ;; (see 24 Jun 2022 message in bug#54034).
+ ;; AFAIK if (match-string 2) is nil then so is
+ ;; (match-string 1), so "Deleted" doesn't sound right,
+ ;; so better just let the header in plain sight for now.
+ ;; FIXME: `diff-buffers' should maybe try to better
+ ;; mimic Git's format with "a/" and "b/" so prettification
+ ;; can "just work!"
+ nil)
+ (t
+ (concat "Modified" kind filemode oldfile)))
+ 'face '(diff-file-header diff-header))
+ 'font-lock-multiline t))))))
nil)
;;; Syntax highlighting from font-lock
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 4abcf6c15a7..3e35a3329b1 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -52,6 +52,12 @@ set (`vc-git-diff-switches' for git, for instance), and
"The command to use to run diff."
:type 'string)
+(defcustom diff-entire-buffers t
+ "If non-nil, diff the entire buffers, not just the visible part.
+If nil, only use the narrowed-to parts of the buffers."
+ :type 'boolean
+ :version "29.1")
+
;; prompt if prefix arg present
(defun diff-switches ()
(if current-prefix-arg
@@ -119,7 +125,9 @@ temporary file with the buffer's contents."
(if (bufferp file-or-buf)
(with-current-buffer file-or-buf
(let ((tempfile (make-temp-file "buffer-content-")))
- (write-region nil nil tempfile nil 'nomessage)
+ (if diff-entire-buffers
+ (write-region nil nil tempfile nil 'nomessage)
+ (write-region (point-min) (point-max) tempfile nil 'nomessage))
tempfile))
(file-local-copy file-or-buf)))
@@ -145,7 +153,7 @@ Possible values are:
;; Noninteractive helper for creating and reverting diff buffers
"Compare the OLD and NEW file/buffer.
If the optional SWITCHES is nil, the switches specified in the
-variable ‘diff-switches’ are passed to the diff command,
+variable `diff-switches' are passed to the diff command,
otherwise SWITCHES is used. SWITCHES can be a string or a list
of strings.
@@ -274,7 +282,9 @@ interactively for diff switches. Otherwise, the switches
specified in the variable `diff-switches' are passed to the
diff command.
-OLD and NEW may each be a buffer or a buffer name."
+OLD and NEW may each be a buffer or a buffer name.
+
+Also see the `diff-entire-buffers' variable."
(interactive
(let ((newb (read-buffer "Diff new buffer" (current-buffer) t))
(oldb (read-buffer "Diff original buffer"
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el
index 4e412041691..42fbde21659 100644
--- a/lisp/vc/ediff-help.el
+++ b/lisp/vc/ediff-help.el
@@ -152,7 +152,7 @@ the value of this variable and the variables `ediff-help-message-*' in
;; the keymap that defines clicks over the quick help regions
-(defvar ediff-help-region-map (make-sparse-keymap))
+(defvar-keymap ediff-help-region-map)
(define-key ediff-help-region-map [mouse-2] #'ediff-help-for-quick-help)
diff --git a/lisp/vc/ediff-hook.el b/lisp/vc/ediff-hook.el
index cee376de302..0160d9f6848 100644
--- a/lisp/vc/ediff-hook.el
+++ b/lisp/vc/ediff-hook.el
@@ -50,12 +50,12 @@
(make-sparse-keymap "Ediff Miscellanea"))
(fset 'menu-bar-ediff-misc-menu
menu-bar-ediff-misc-menu)
-(defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
+(defvar-keymap menu-bar-epatch-menu :name "Apply Patch")
(fset 'menu-bar-epatch-menu menu-bar-epatch-menu)
-(defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
+(defvar-keymap menu-bar-ediff-merge-menu :name "Merge")
(fset 'menu-bar-ediff-merge-menu
menu-bar-ediff-merge-menu)
-(defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
+(defvar-keymap menu-bar-ediff-menu :name "Compare")
(fset 'menu-bar-ediff-menu menu-bar-ediff-menu)
;; define ediff compare menu
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index de0a4d71ed2..273bad5d353 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -955,9 +955,9 @@ this variable represents.")
(((class color))
(:foreground "red3" :background "green"))
(t (:underline t :stipple "gray3")))
- "Face for highlighting the refinement of the selected diff in the ancestor buffer.
-At present, this face is not used and no fine differences are computed for the
-ancestor buffer."
+ "Face for highlighting refinement of the selected diff in the ancestor buffer.
+At present, this face is not used and no fine differences are
+computed for the ancestor buffer."
:group 'ediff-highlighting)
;; An internal variable. Ediff takes the face from here. When unhighlighting,
;; this variable is set to nil, then again to the appropriate face.
@@ -1055,7 +1055,7 @@ this variable represents.")
(:foreground "cyan3" :background "light grey"
:weight bold :extend t))
(t (:italic t :stipple ,stipple-pixmap :extend t)))
- "Face for highlighting even-numbered non-current differences in the ancestor buffer."
+ "Face for highlighting even-numbered non-current differences in ancestor buffer."
:group 'ediff-highlighting)
;; An internal variable. Ediff takes the face from here. When unhighlighting,
;; this variable is set to nil, then again to the appropriate face.
@@ -1146,7 +1146,7 @@ this variable represents.")
(((class color))
(:foreground "green3" :background "black" :weight bold :extend t))
(t (:italic t :stipple "gray1" :extend t)))
- "Face for highlighting odd-numbered non-current differences in the ancestor buffer."
+ "Face for highlighting odd-numbered non-current differences in ancestor buffer."
:group 'ediff-highlighting)
;; An internal variable. Ediff takes the face from here. When unhighlighting,
;; this variable is set to nil, then again to the appropriate face.
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el
index de8c587b1ca..aae6ad549ea 100644
--- a/lisp/vc/ediff-merg.el
+++ b/lisp/vc/ediff-merg.el
@@ -54,7 +54,7 @@ Valid values are the symbols `default-A', `default-B', and `combined'."
The value must be a list of the form
\(STRING1 bufspec1 STRING2 bufspec2 STRING3 bufspec3 STRING4)
where bufspec is the symbol A, B, or Ancestor. For instance, if the value is
-'(STRING1 A STRING2 Ancestor STRING3 B STRING4) then the
+`(STRING1 A STRING2 Ancestor STRING3 B STRING4)' then the
combined text will look like this:
STRING1
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index 48716901116..b7c349fc1cd 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -128,7 +128,7 @@
(defconst ediff-meta-buffer-verbose-message "Ediff Session Group Panel: %s
Useful commands (type ? to hide them and free up screen):
- button2, v, or RET over session record: start that Ediff session
+ mouse-2, v, or RET over session record: start that Ediff session
M:\tin sessions invoked from here, brings back this group panel
R:\tdisplay the registry of active Ediff sessions
h:\tmark session for hiding (toggle)
@@ -1236,7 +1236,7 @@ behavior."
(insert "\t\t*** Directory Differences ***\n")
(insert "
Useful commands:
- C,button2: over file name -- copy this file to directory that doesn't have it
+ C,mouse-2: over file name -- copy this file to directory that doesn't have it
q: hide this buffer
n,SPC: next line
p,DEL: previous line\n\n")
@@ -1429,7 +1429,7 @@ Useful commands:
This is a registry of all active Ediff sessions.
Useful commands:
- button2, `v', RET over a session record: switch to that session
+ mouse-2, `v', RET over a session record: switch to that session
M over a session record: display the associated session group
R in any Ediff session: display session registry
n,SPC: next session
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index b41def2aff3..040a9a63c5a 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -3431,6 +3431,9 @@ Without an argument, it saves customized diff argument, if available
))
(defun ediff-show-diff-output (arg)
+ "With prefix argument ARG, show plain diff output.
+Without an argument, save the customized diff argument, if available
+(and plain output, if customized output was not generated)."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(ediff-compute-custom-diffs-maybe)
@@ -3438,7 +3441,10 @@ Without an argument, it saves customized diff argument, if available
(ediff-skip-unsuitable-frames ' ok-unsplittable))
(let ((buf (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer))
ediff-diff-buffer)
- ((ediff-buffer-live-p ediff-custom-diff-buffer)
+ ((and (ediff-buffer-live-p ediff-custom-diff-buffer)
+ ;; We may not have gotten a custom output if
+ ;; we're working on unsaved buffers.
+ (> (buffer-size ediff-custom-diff-buffer) 0))
ediff-custom-diff-buffer)
((ediff-buffer-live-p ediff-diff-buffer)
ediff-diff-buffer)
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index 1e702edb419..6db3667545e 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -1135,7 +1135,8 @@ It assumes that it is called from within the control buffer."
(setq mode-line-format
(if (ediff-narrow-control-frame-p)
(list " " mode-line-buffer-identification)
- (list "-- " mode-line-buffer-identification " Quick Help")))
+ (list "-- " mode-line-buffer-identification
+ (list 'ediff-use-long-help-message " Quick Help"))))
;; control buffer id
(setq mode-line-buffer-identification
(if (ediff-narrow-control-frame-p)
@@ -1213,18 +1214,20 @@ It assumes that it is called from within the control buffer."
ediff-control-buffer-suffix))
(defun ediff-make-wide-control-buffer-id ()
- (cond ((< ediff-current-difference 0)
- (list (format "%%b At start of %d diffs"
- ediff-number-of-differences)))
- ((>= ediff-current-difference ediff-number-of-differences)
- (list (format "%%b At end of %d diffs"
- ediff-number-of-differences)))
- (t
- (list (format "%%b diff %d of %d"
- (1+ ediff-current-difference)
- ediff-number-of-differences)))))
-
-
+ (list
+ (concat "%b "
+ (propertize
+ (cond ((< ediff-current-difference 0)
+ (format "At start of %d diffs"
+ ediff-number-of-differences))
+ ((>= ediff-current-difference ediff-number-of-differences)
+ (format "At end of %d diffs"
+ ediff-number-of-differences))
+ (t
+ (format "diff %d of %d"
+ (1+ ediff-current-difference)
+ ediff-number-of-differences)))
+ 'face 'mode-line-buffer-id))))
;; If buff is not live, return nil
(defun ediff-get-visible-buffer-window (buff)
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index b2fdb07d5fb..422ed5c0a4d 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -221,7 +221,7 @@ depend on the flags."
(defcustom emerge-min-visible-lines 3
"Number of lines to show above and below the flags when displaying a difference."
- :type 'integer)
+ :type 'natnum)
(defcustom emerge-temp-file-prefix
(expand-file-name "emerge" temporary-file-directory)
@@ -1647,7 +1647,7 @@ the height of the merge window.
(defun emerge-scroll-left (&optional arg)
"Scroll left all three merge buffers, if they are in windows.
If an argument is given, that is how many columns are scrolled, else nearly
-the width of the A and B windows. `C-u -' alone as argument scrolls half the
+the width of the A and B windows. \\`C-u -' alone as argument scrolls half the
width of the A and B windows."
(interactive "P")
(emerge-operate-on-windows
@@ -1675,7 +1675,7 @@ width of the A and B windows."
(defun emerge-scroll-right (&optional arg)
"Scroll right all three merge buffers, if they are in windows.
If an argument is given, that is how many columns are scrolled, else nearly
-the width of the A and B windows. `C-u -' alone as argument scrolls half the
+the width of the A and B windows. \\`C-u -' alone as argument scrolls half the
width of the A and B windows."
(interactive "P")
(emerge-operate-on-windows
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 79dafe60cc2..e958673fea8 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -710,10 +710,14 @@ different header separator appropriate for `log-edit-mode'."
(interactive)
(when (or (called-interactively-p 'interactive)
(log-edit-empty-buffer-p))
- (insert "Summary: ")
- (when log-edit-setup-add-author
- (insert "\nAuthor: "))
- (insert "\n\n")
+ (dolist (header (append '("Summary") (and log-edit-setup-add-author
+ '("Author"))))
+ ;; Make `C-a' work like in other buffers with header names.
+ (insert (propertize (concat header ": ")
+ 'field 'header
+ 'rear-nonsticky t)
+ "\n"))
+ (insert "\n")
(message-position-point)))
(defun log-edit-insert-cvs-template ()
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 9952345db50..415b1564eda 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -134,11 +134,7 @@
"n" #'log-view-msg-next
"p" #'log-view-msg-prev
"TAB" #'log-view-msg-next
- "<backtab>" #'log-view-msg-prev
- "N" #'log-view-file-next
- "P" #'log-view-file-prev
- "M-n" #'log-view-file-next
- "M-p" #'log-view-file-prev)
+ "<backtab>" #'log-view-msg-prev)
(easy-menu-define log-view-mode-menu log-view-mode-map
"Log-View Display Menu."
@@ -166,9 +162,15 @@
["Previous Log Entry" log-view-msg-prev
:help "Go to the previous count'th log message"]
["Next File" log-view-file-next
- :help "Go to the next count'th file"]
+ :help "Go to the next count'th file"
+ :active (derived-mode-p vc-cvs-log-view-mode
+ vc-rcs-log-view-mode
+ vc-sccs-log-view-mode)]
["Previous File" log-view-file-prev
- :help "Go to the previous count'th file"]))
+ :help "Go to the previous count'th file"
+ :active (derived-mode-p vc-cvs-log-view-mode
+ vc-rcs-log-view-mode
+ vc-sccs-log-view-mode)]))
(defvar log-view-mode-hook nil
"Hook run at the end of `log-view-mode'.")
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 4a511f1f688..1f19c4cfe26 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -451,7 +451,8 @@ should be applied to the background or to the foreground."
(setq-local vc-annotate-backend backend)
(setq-local vc-annotate-parent-file file)
(setq-local vc-annotate-parent-rev rev)
- (setq-local vc-annotate-parent-display-mode display-mode))))
+ (setq-local vc-annotate-parent-display-mode display-mode)
+ (kill-local-variable 'revert-buffer-function))))
(with-current-buffer temp-buffer-name
(vc-run-delayed
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 836630acb5d..072bd72b441 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -64,9 +64,13 @@
:version "22.2"
:group 'vc)
-(defcustom vc-bzr-program "bzr"
+(defcustom vc-bzr-program
+ (or (executable-find "bzr")
+ (executable-find "brz")
+ "bzr")
"Name of the bzr command (excluding any arguments)."
- :type 'string)
+ :type 'string
+ :version "29.1")
(defcustom vc-bzr-diff-switches nil
"String or list of strings specifying switches for bzr diff under VC.
@@ -640,7 +644,7 @@ Returns nil if unable to find this information."
;; Could run `bzr status' in the directory and see if it succeeds, but
;; that's relatively expensive.
(defalias 'vc-bzr-responsible-p #'vc-bzr-root
- "Return non-nil if FILE is (potentially) controlled by bzr.
+ "Return the directory if FILE is (potentially) controlled by bzr.
The criterion is that there is a `.bzr' directory in the same
or a superior directory.")
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index e234b9a0447..1f81ff2e0fe 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -26,6 +26,7 @@
(require 'vc-rcs)
(eval-when-compile (require 'vc))
+(require 'log-view)
(declare-function vc-checkout "vc" (file &optional rev))
(declare-function vc-expand-dirs "vc" (file-or-dir-list backend))
@@ -308,7 +309,7 @@ to the CVS command."
(vc-switches 'CVS 'register)))
(defun vc-cvs-responsible-p (file)
- "Return non-nil if CVS thinks it is responsible for FILE."
+ "Return the directory if CVS thinks it is responsible for FILE."
(let ((dir (if (file-directory-p file)
file
(file-name-directory file))))
@@ -1257,6 +1258,14 @@ ignore file."
(if sort (sort-lines nil (point-min) (point-max)))
(save-buffer)))))
+(defvar-keymap vc-cvs-log-view-mode-map
+ "N" #'log-view-file-next
+ "P" #'log-view-file-prev
+ "M-n" #'log-view-file-next
+ "M-p" #'log-view-file-prev)
+
+(define-derived-mode vc-cvs-log-view-mode log-view-mode "CVS-Log-View")
+
(provide 'vc-cvs)
;;; vc-cvs.el ends here
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 61e2cd23900..94621599e4a 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -137,9 +137,9 @@ It should return a status of either 0 (no differences found), or
)
(defun vc-dav-responsible-p (url)
- "Return non-nil if DAV considers itself `responsible' for URL."
+ "Return the URL if DAV considers itself `responsible' for URL."
;; Check for DAV support on the web server.
- (and t url))
+ url)
;;; Unimplemented functions
;;
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index ba6e098d987..9335da10065 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -325,6 +325,7 @@ See `run-hooks'."
(define-key map "U" #'vc-dir-unmark-all-files)
(define-key map "\C-?" #'vc-dir-unmark-file-up)
(define-key map "\M-\C-?" #'vc-dir-unmark-all-files)
+ (define-key map "%" #'vc-dir-mark-by-regexp)
;; Movement.
(define-key map "n" #'vc-dir-next-line)
(define-key map " " #'vc-dir-next-line)
@@ -750,6 +751,23 @@ share the same state."
(vc-dir-mark-file crt)))
(setq crt (ewoc-next vc-ewoc crt))))))))
+(defun vc-dir-mark-by-regexp (regexp &optional unmark)
+ "Mark all files that match REGEXP.
+If UNMARK (interactively, the prefix), unmark instead."
+ (interactive "sMark files matching: \nP")
+ (ewoc-map
+ (lambda (filearg)
+ (when (and (not (vc-dir-fileinfo->directory filearg))
+ (eq (not unmark)
+ (not (vc-dir-fileinfo->marked filearg)))
+ ;; We don't want to match on the part of the file
+ ;; that's above the current directory.
+ (string-match-p regexp (file-relative-name
+ (vc-dir-fileinfo->name filearg))))
+ (setf (vc-dir-fileinfo->marked filearg) (not unmark))
+ t))
+ vc-ewoc))
+
(defun vc-dir-mark-files (mark-files)
"Mark files specified by file names in the argument MARK-FILES.
MARK-FILES should be a list of absolute filenames."
@@ -924,7 +942,7 @@ system."
"Search through all marked files for a match for REGEXP.
For marked directories, use the files displayed from those directories.
Stops when a match is found.
-To continue searching for next match, use command \\[tags-loop-continue]."
+To continue searching for next match, use command \\[fileloop-continue]."
(interactive "sSearch marked files (regexp): ")
(tags-search regexp
(mapcar #'car (vc-dir-marked-only-files-and-states))))
@@ -933,8 +951,14 @@ To continue searching for next match, use command \\[tags-loop-continue]."
"Do `query-replace-regexp' of FROM with TO, on all marked files.
If a directory is marked, then use the files displayed for that directory.
Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
+
+As each match is found, the user must type a character saying
+what to do with it. Type SPC or `y' to replace the match,
+DEL or `n' to skip and go to the next match. For more directions,
+type \\[help-command] at that time.
+
If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
-with the command \\[tags-loop-continue]."
+with the command \\[fileloop-continue]."
;; FIXME: this is almost a copy of `dired-do-query-replace-regexp'. This
;; should probably be made generic and used in both places instead of
;; duplicating it here.
@@ -1538,9 +1562,8 @@ These are the commands available for use in the file status buffer:
This implements the `bookmark-make-record-function' type for
`vc-dir' buffers."
(let* ((bookmark-name
- (concat "(" (symbol-name vc-dir-backend) ") "
- (file-name-nondirectory
- (directory-file-name default-directory))))
+ (file-name-nondirectory
+ (directory-file-name default-directory)))
(defaults (list bookmark-name default-directory)))
`(,bookmark-name
,@(bookmark-make-record-default 'no-file)
@@ -1560,6 +1583,8 @@ type returned by `vc-dir-bookmark-make-record'."
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
+(put 'vc-dir-bookmark-jump 'bookmark-handler-type "VC")
+
(provide 'vc-dir)
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 5c664d58f1a..e2a490092b5 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -636,23 +636,23 @@ NOT-URGENT means it is ok to continue if the user says not to save."
(and (local-variable-p 'vc-log-fileset)
(not (equal vc-log-fileset fileset))))
`((log-edit-listfun
- . (lambda ()
- ;; FIXME: When fileset includes directories, and
- ;; there are relevant ChangeLog files inside their
- ;; children, we don't find them. Either handle it
- ;; in `log-edit-insert-changelog-entries' by
- ;; walking down the file trees, or somehow pass
- ;; `fileset-only-files' from `vc-next-action'
- ;; through to this function.
- (let ((root (vc-root-dir)))
- ;; Returns paths relative to the root, so that
- ;; `log-edit-changelog-insert-entries'
- ;; substitutes them in correctly later, even when
- ;; `vc-checkin' was called from a file buffer, or
- ;; a non-root VC-Dir buffer.
- (mapcar
- (lambda (file) (file-relative-name file root))
- ',fileset))))
+ . ,(lambda ()
+ ;; FIXME: When fileset includes directories, and
+ ;; there are relevant ChangeLog files inside their
+ ;; children, we don't find them. Either handle it
+ ;; in `log-edit-insert-changelog-entries' by
+ ;; walking down the file trees, or somehow pass
+ ;; `fileset-only-files' from `vc-next-action'
+ ;; through to this function.
+ (let ((root (vc-root-dir)))
+ ;; Returns paths relative to the root, so that
+ ;; `log-edit-changelog-insert-entries'
+ ;; substitutes them in correctly later, even when
+ ;; `vc-checkin' was called from a file buffer, or
+ ;; a non-root VC-Dir buffer.
+ (mapcar
+ (lambda (file) (file-relative-name file root))
+ fileset))))
(log-edit-diff-function . vc-diff)
(log-edit-vc-backend . ,backend)
(vc-log-fileset . ,fileset))
@@ -761,8 +761,7 @@ the buffer contents as a comment."
;; (while (and (not member) fileset)
;; (let ((elem (pop fileset)))
;; (if (if (file-directory-p elem)
-;; (eq t (compare-strings buffer-file-name nil (length elem)
-;; elem nil nil))
+;; (string-prefix-p elem buffer-file-name)
;; (eq (current-buffer) (get-file-buffer elem)))
;; (setq member t))))
;; member))
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index adf13406333..9ec78ee8ab6 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1602,7 +1602,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(declare-function grep-read-regexp "grep" ())
(declare-function grep-read-files "grep" (regexp))
(declare-function grep-expand-template "grep"
- (template &optional regexp files dir excl))
+ (template &optional regexp files dir excl more-opts))
(defvar compilation-environment)
;; Derived from `lgrep'.
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index bd2ea337b16..80508570f32 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -99,7 +99,7 @@ interpreted as hostnames."
:type 'regexp
:group 'vc)
-(defcustom vc-handled-backends '(RCS CVS SVN SCCS SRC Bzr Git Hg Mtn)
+(defcustom vc-handled-backends '(RCS CVS SVN SCCS SRC Bzr Git Hg)
;; RCS, CVS, SVN, SCCS, and SRC come first because they are per-dir
;; rather than per-tree. RCS comes first because of the multibackend
;; support intended to use RCS for local commits (with a remote CVS server).
@@ -141,9 +141,9 @@ confirmation whether it should follow the link. If nil, the link is
visited and a warning displayed."
:type '(choice (const :tag "Ask for confirmation" ask)
(const :tag "Visit link and warn" nil)
- (const :tag "Follow link" t))
+ (const :tag "Follow link" t))
+ :safe #'null
:group 'vc)
-(put 'vc-follow-symlinks 'safe-local-variable #'null)
(defcustom vc-display-status t
"If non-nil, display revision number and lock status in mode line.
@@ -556,15 +556,6 @@ this function."
templates))))
-;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made
-;; obsolete earlier, it is ok for the latter to be an alias to the former,
-;; since the latter will be removed first. We can't just make it
-;; an alias for read-only-mode, since that is not 100% the same.
-(defalias 'vc-toggle-read-only 'toggle-read-only)
-(make-obsolete 'vc-toggle-read-only
- "use `read-only-mode' instead (or `toggle-read-only' in older versions of Emacs)."
- "24.1")
-
(defun vc-default-make-version-backups-p (_backend _file)
"Return non-nil if unmodified versions should be backed up locally.
The default is to switch off this feature."
@@ -966,7 +957,7 @@ In the latter case, VC mode is deactivated for this buffer."
(defalias 'vc-menu-map vc-menu-map)
-(declare-function vc-responsible-backend "vc" (file))
+(declare-function vc-responsible-backend "vc" (file &optional no-error))
(defun vc-menu-map-filter (orig-binding)
(if (and (symbolp orig-binding) (fboundp orig-binding))
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
deleted file mode 100644
index 20fbf92bb12..00000000000
--- a/lisp/vc/vc-mtn.el
+++ /dev/null
@@ -1,380 +0,0 @@
-;;; vc-mtn.el --- VC backend for Monotone -*- lexical-binding: t -*-
-
-;; Copyright (C) 2007-2022 Free Software Foundation, Inc.
-
-;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: vc
-;; Package: vc
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;
-
-;;; TODO:
-
-;; - The `previous-version' VC method needs to be supported, 'D' in
-;; log-view-mode uses it.
-
-;;; Code:
-
-(eval-when-compile (require 'vc))
-
-(defgroup vc-mtn nil
- "VC Monotone (mtn) backend."
- :version "24.1"
- :group 'vc)
-
-(defcustom vc-mtn-diff-switches t
- "String or list of strings specifying switches for monotone diff under VC.
-If nil, use the value of `vc-diff-switches'. If t, use no switches."
- :type '(choice (const :tag "Unspecified" nil)
- (const :tag "None" t)
- (string :tag "Argument String")
- (repeat :tag "Argument List" :value ("") string))
- :version "23.1")
-
-(defcustom vc-mtn-annotate-switches nil
- "String or list of strings specifying switches for mtn annotate under VC.
-If nil, use the value of `vc-annotate-switches'. If t, use no
-switches."
- :type '(choice (const :tag "Unspecified" nil)
- (const :tag "None" t)
- (string :tag "Argument String")
- (repeat :tag "Argument List" :value ("") string))
- :version "25.1")
-
-(defcustom vc-mtn-program "mtn"
- "Name of the monotone executable."
- :type 'string)
-
-;; Clear up the cache to force vc-call to check again and discover
-;; new functions when we reload this file.
-(put 'Mtn 'vc-functions nil)
-
-(unless (executable-find vc-mtn-program)
- ;; vc-mtn.el is 100% non-functional without the `mtn' executable.
- (setq vc-handled-backends (delq 'Mtn vc-handled-backends)))
-
-;;;###autoload
-(defconst vc-mtn-admin-dir "_MTN" "Name of the monotone directory.")
-;;;###autoload
-(defconst vc-mtn-admin-format (concat vc-mtn-admin-dir "/format")
- "Name of the monotone directory's format file.")
-
-;;;###autoload (defun vc-mtn-registered (file)
-;;;###autoload (if (vc-find-root file vc-mtn-admin-format)
-;;;###autoload (progn
-;;;###autoload (load "vc-mtn" nil t)
-;;;###autoload (vc-mtn-registered file))))
-
-(defun vc-mtn-revision-granularity () 'repository)
-(defun vc-mtn-checkout-model (_files) 'implicit)
-
-(defun vc-mtn-root (file)
- (setq file (expand-file-name file)
- file (if (file-directory-p file)
- (file-name-as-directory file)
- (file-name-directory file)))
- (or (vc-file-getprop file 'vc-mtn-root)
- (vc-file-setprop file 'vc-mtn-root
- (vc-find-root file vc-mtn-admin-format))))
-
-(defun vc-mtn-find-admin-dir (file)
- "Return the administrative directory of FILE."
- (expand-file-name vc-mtn-admin-dir (vc-mtn-root file)))
-
-(defun vc-mtn-find-ignore-file (file)
- "Return the mtn ignore file that controls FILE."
- (expand-file-name ".mtnignore" (vc-mtn-root file)))
-
-(defun vc-mtn-registered (file)
- (let ((root (vc-mtn-root file)))
- (when root
- (vc-mtn-state file))))
-
-(defun vc-mtn-command (buffer okstatus files &rest flags)
- "A wrapper around `vc-do-command' for use in vc-mtn.el."
- (let ((process-environment
- ;; Avoid localization of messages so we can parse the output.
- (cons "LC_MESSAGES=C" process-environment)))
- (apply #'vc-do-command (or buffer "*vc*") okstatus vc-mtn-program
- files flags)))
-
-(defun vc-mtn-state (file)
- ;; If `mtn' fails or returns status>0, or if the search files, just
- ;; return nil.
- (ignore-errors
- (with-temp-buffer
- (vc-mtn-command t 0 file "status")
- (goto-char (point-min))
- (re-search-forward
- "^ \\(?:\\(patched\\)\\|\\(added\\) \\(?:.*\\)\\)\\|no changes$")
- (cond ((match-end 1) 'edited)
- ((match-end 2) 'added)
- (t 'up-to-date)))))
-
-(defun vc-mtn-after-dir-status (update-function)
- (let (result)
- (goto-char (point-min))
- (re-search-forward "\\(?:Current b\\|B\\)ranch: *\\(.*\\)\n?\nChanges against parent \\(.*\\)" nil t)
- (while (re-search-forward
- "^ \\(?:\\(patched \\)\\|\\(added \\)\\)\\(.*\\)$" nil t)
- (cond ((match-end 1) (push (list (match-string 3) 'edited) result))
- ((match-end 2) (push (list (match-string 3) 'added) result))))
- (funcall update-function result)))
-
-;; dir-status-files called from vc-dir, which loads vc,
-;; which loads vc-dispatcher.
-(declare-function vc-exec-after "vc-dispatcher" (code))
-
-(defun vc-mtn-dir-status-files (dir _files update-function)
- (vc-mtn-command (current-buffer) 'async dir "status")
- (vc-run-delayed
- (vc-mtn-after-dir-status update-function)))
-
-(defun vc-mtn-working-revision (file)
- ;; If `mtn' fails or returns status>0, or if the search fails, just
- ;; return nil.
- (ignore-errors
- (with-temp-buffer
- (vc-mtn-command t 0 file "status")
- (goto-char (point-min))
- (re-search-forward "\\(?:Current b\\|B\\)ranch: *\\(.*\\)\n?\nChanges against parent \\(.*\\)")
- (match-string 2))))
-
-(defun vc-mtn-workfile-branch (file)
- ;; If `mtn' fails or returns status>0, or if the search files, just
- ;; return nil.
- (ignore-errors
- (with-temp-buffer
- (vc-mtn-command t 0 file "status")
- (goto-char (point-min))
- (re-search-forward "\\(?:Current b\\|B\\)ranch: *\\(.*\\)\n?\nChanges against parent \\(.*\\)")
- (match-string 1))))
-
-;; Mode-line rewrite code copied from vc-arch.el.
-
-(defcustom vc-mtn-mode-line-rewrite
- '(("\\`[^:/#]*[:/#]" . "")) ;Drop the host part.
- "Rewrite rules to shorten Mtn's revision names on the mode-line."
- :type '(repeat (cons regexp string))
- :version "22.2")
-
-(defun vc-mtn-mode-line-string (file)
- "Return a string for `vc-mode-line' to put in the mode line for FILE."
- (let ((branch (vc-mtn-workfile-branch file)))
- (if branch
- (progn
- (dolist (rule vc-mtn-mode-line-rewrite)
- (if (string-match (car rule) branch)
- (setq branch (replace-match (cdr rule) t nil branch))))
- (format "Mtn%c%s"
- (pcase (vc-state file)
- ((or 'up-to-date 'needs-update) ?-)
- ('added ?@)
- (_ ?:))
- branch))
- "")))
-
-(defun vc-mtn-register (files &optional _comment)
- (vc-mtn-command nil 0 files "add"))
-
-(defun vc-mtn-responsible-p (file) (vc-mtn-root file))
-
-(declare-function log-edit-extract-headers "log-edit" (headers string))
-
-(defun vc-mtn-checkin (files comment &optional _rev)
- (apply #'vc-mtn-command nil 0 files
- (nconc (list "commit" "-m")
- (log-edit-extract-headers '(("Author" . "--author")
- ("Date" . "--date"))
- comment))))
-
-(defun vc-mtn-find-revision (file rev buffer)
- ;; null rev means latest revision
- (if rev
- (vc-mtn-command buffer 0 file "cat" "-r" rev)
- (vc-mtn-command buffer 0 file "cat")))
-
-;; (defun vc-mtn-checkout (file &optional rev)
-;; )
-
-(defun vc-mtn-revert (file &optional contents-done)
- (unless contents-done
- (vc-mtn-command nil 0 file "revert")))
-
-(defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit)
- "Print commit logs associated with FILES into specified BUFFER.
-_SHORTLOG is ignored.
-If START-REVISION is non-nil, it is the newest revision to show.
-If LIMIT is non-nil, show no more than this many entries."
- (apply #'vc-mtn-command buffer 0 files "log"
- (append
- (when start-revision (list "--from" (format "%s" start-revision)))
- (when limit (list "--last" (format "%s" limit))))))
-
-(defvar log-view-message-re)
-(defvar log-view-file-re)
-(defvar log-view-font-lock-keywords)
-(defvar log-view-per-file-logs)
-
-(define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
- ;; Don't match anything.
- (setq-local log-view-file-re regexp-unmatchable)
- (setq-local log-view-per-file-logs nil)
- ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
- ;; in the ChangeLog text.
- (setq-local log-view-message-re
- "^[ |/]+Revision: \\([0-9a-f]+\\)")
- (require 'add-log) ;For change-log faces.
- (setq-local log-view-font-lock-keywords
- (append log-view-font-lock-keywords
- '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email))
- ("^[ |]+Date: \\(.*\\)" (1 'change-log-date))))))
-
-;; (defun vc-mtn-show-log-entry (revision)
-;; )
-
-(autoload 'vc-switches "vc")
-
-(defun vc-mtn-diff (files &optional rev1 rev2 buffer _async)
- "Get a difference report using monotone between two revisions of FILES."
- (apply #'vc-mtn-command (or buffer "*vc-diff*")
- 1 ; bug#21969
- files "diff"
- (append
- (vc-switches 'mtn 'diff)
- (if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
-
-(defun vc-mtn-annotate-command (file buf &optional rev)
- (apply #'vc-mtn-command buf 'async file "annotate"
- (append (vc-switches 'mtn 'annotate)
- (if rev (list "-r" rev)))))
-
-(declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
-
-(defconst vc-mtn-annotate-full-re
- "^ *\\([0-9a-f]+\\)\\.* by [^ ]+ \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\): ")
-(defconst vc-mtn-annotate-any-re
- (concat "^\\(?: +: \\|" vc-mtn-annotate-full-re "\\)"))
-
-(defun vc-mtn-annotate-time ()
- (when (looking-at vc-mtn-annotate-any-re)
- (goto-char (match-end 0))
- (let ((year (match-string 2)))
- (if (not year)
- ;; Look for the date on a previous line.
- (save-excursion
- (get-text-property (1- (previous-single-property-change
- (point) 'vc-mtn-time nil (point-min)))
- 'vc-mtn-time))
- (let ((time (vc-annotate-convert-time
- (encode-time 0 0 0
- (string-to-number (match-string 4))
- (string-to-number (match-string 3))
- (string-to-number year)
- t))))
- (let ((inhibit-read-only t)
- (inhibit-modification-hooks t))
- (put-text-property (match-beginning 0) (match-end 0)
- 'vc-mtn-time time))
- time)))))
-
-(defun vc-mtn-annotate-extract-revision-at-line ()
- (save-excursion
- (when (or (looking-at vc-mtn-annotate-full-re)
- (re-search-backward vc-mtn-annotate-full-re nil t))
- (match-string 1))))
-
-;;; Revision completion.
-
-(defun vc-mtn-list-tags ()
- (with-temp-buffer
- (vc-mtn-command t 0 nil "list" "tags")
- (goto-char (point-min))
- (let ((tags ()))
- (while (re-search-forward "^[^ ]+" nil t)
- (push (match-string 0) tags))
- tags)))
-
-(defun vc-mtn-list-branches ()
- (with-temp-buffer
- (vc-mtn-command t 0 nil "list" "branches")
- (goto-char (point-min))
- (let ((branches ()))
- (while (re-search-forward "^.+" nil t)
- (push (match-string 0) branches))
- branches)))
-
-(defun vc-mtn-list-revision-ids (prefix)
- (with-temp-buffer
- (vc-mtn-command t 0 nil "complete" "revision" prefix)
- (goto-char (point-min))
- (let ((ids ()))
- (while (re-search-forward "^.+" nil t)
- (push (match-string 0) ids))
- ids)))
-
-(defun vc-mtn-revision-completion-table (_files)
- ;; What about using `files'?!? --Stef
- (lambda (string pred action)
- (cond
- ;; Special chars for composite selectors.
- ((string-match ".*[^\\]\\(\\\\\\\\\\)*[/|;(]" string)
- (completion-table-with-context (substring string 0 (match-end 0))
- (vc-mtn-revision-completion-table nil)
- (substring string (match-end 0))
- pred action))
- ;; "Tag" selectors.
- ((string-match "\\`t:" string)
- (complete-with-action action
- (mapcar (lambda (tag) (concat "t:" tag))
- (vc-mtn-list-tags))
- string pred))
- ;; "Branch" or "Head" selectors.
- ((string-match "\\`[hb]:" string)
- (let ((prefix (match-string 0 string)))
- (complete-with-action action
- (mapcar (lambda (tag) (concat prefix tag))
- (vc-mtn-list-branches))
- string pred)))
- ;; "ID" selectors.
- ((string-match "\\`i:" string)
- (complete-with-action action
- (mapcar (lambda (tag) (concat "i:" tag))
- (vc-mtn-list-revision-ids
- (substring string (match-end 0))))
- string pred))
- (t
- (complete-with-action action
- '("t:" "b:" "h:" "i:"
- ;; Completion not implemented for these.
- "c:" "a:" "k:" "d:" "m:" "e:" "l:" "i:" "p:"
- ;; These have no arg to complete.
- "u:" "w:"
- ;; Selector functions.
- "difference(" "lca(" "max(" "ancestors("
- "descendants(" "parents(" "children("
- "pick(")
- string pred)))))
-
-
-
-(provide 'vc-mtn)
-
-;;; vc-mtn.el ends here
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 20f3b1fba71..a4345c7d7e2 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -40,6 +40,7 @@
(eval-when-compile
(require 'cl-lib)
(require 'vc))
+(require 'log-view)
(declare-function vc-read-revision "vc"
(prompt &optional files backend default initial-input))
@@ -99,7 +100,7 @@ to use --brief and sets this variable to remember whether it worked."
"Where to look for RCS master files.
For a description of possible values, see `vc-check-master-templates'."
:type '(choice (const :tag "Use standard RCS file names"
- '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
+ ("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
(repeat :tag "User-specified"
(choice string
function)))
@@ -288,7 +289,7 @@ to the RCS command."
(match-string 1))))))
(defun vc-rcs-responsible-p (file)
- "Return non-nil if RCS thinks it would be responsible for registering FILE."
+ "Return the directory if RCS thinks it would be responsible for FILE."
;; TODO: check for all the patterns in vc-rcs-master-templates
(let ((dir (if (file-directory-p file)
file
@@ -1062,9 +1063,9 @@ file."
(defun vc-rcs-consult-headers (file)
"Search for RCS headers in FILE, and set properties accordingly.
-Returns: nil if no headers were found
- 'rev if a workfile revision was found
- 'rev-and-lock if revision and lock info was found"
+Returns: nil if no headers were found
+ `rev' if a workfile revision was found
+ `rev-and-lock' if revision and lock info was found"
(cond
((not (get-file-buffer file)) nil)
((let (status version)
@@ -1456,6 +1457,14 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
`((headers ,desc ,@headers)
(revisions ,@revs)))))
+(defvar-keymap vc-rcs-log-view-mode-map
+ "N" #'log-view-file-next
+ "P" #'log-view-file-prev
+ "M-n" #'log-view-file-next
+ "M-p" #'log-view-file-prev)
+
+(define-derived-mode vc-rcs-log-view-mode log-view-mode "RCS-Log-View")
+
(provide 'vc-rcs)
;;; vc-rcs.el ends here
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 4bbf92b3274..9622bf5e097 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -27,6 +27,7 @@
(eval-when-compile
(require 'vc))
+(require 'log-view)
;;;
;;; Customization options
@@ -212,7 +213,7 @@ to the SCCS command."
(vc-sccs-do-command nil 0 "get" (vc-master-name file)))))
(defun vc-sccs-responsible-p (file)
- "Return non-nil if SCCS thinks it would be responsible for registering FILE."
+ "Return the directory if SCCS thinks it would be responsible for FILE."
;; TODO: check for all the patterns in vc-sccs-master-templates
(or (and (file-directory-p
(expand-file-name "SCCS" (file-name-directory file)))
@@ -518,6 +519,14 @@ If NAME is nil or a revision number string it's just passed through."
(file-name-directory (vc-master-name file))))
(vc-parse-buffer (concat name "\t:\t" file "\t\\(.+\\)") 1))))
+(defvar-keymap vc-sccs-log-view-mode-map
+ "N" #'log-view-file-next
+ "P" #'log-view-file-prev
+ "M-n" #'log-view-file-next
+ "M-p" #'log-view-file-prev)
+
+(define-derived-mode vc-sccs-log-view-mode log-view-mode "SCCS-Log-View")
+
(provide 'vc-sccs)
;;; vc-sccs.el ends here
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index 1c1a7b5d139..432448bde58 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -120,7 +120,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
"Where to look for SRC master files.
For a description of possible values, see `vc-check-master-templates'."
:type '(choice (const :tag "Use standard SRC file names"
- '("%s.src/%s,v"))
+ ("%s.src/%s,v"))
(repeat :tag "User-specified"
(choice string
function))))
@@ -242,11 +242,13 @@ This function differs from vc-do-command in that it invokes `vc-src-program'."
(vc-src-command nil files "add"))
(defun vc-src-responsible-p (file)
- "Return non-nil if SRC thinks it would be responsible for registering FILE."
- (file-directory-p (expand-file-name ".src"
- (if (file-directory-p file)
- file
- (file-name-directory file)))))
+ "Return the directory if SRC thinks it would be responsible for FILE."
+ (let ((dir (expand-file-name ".src"
+ (if (file-directory-p file)
+ file
+ (file-name-directory file)))))
+ (and (file-directory-p dir)
+ dir)))
(defun vc-src-checkin (files comment &optional _rev)
"SRC-specific version of `vc-backend-checkin'.
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index b38a676acbd..270877041aa 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -201,8 +201,8 @@ switches."
;; FIXME are there other possible combinations?
(cond ((eq state 'edited) (setq state 'needs-merge))
((not state) (setq state 'needs-update))))
- (when (and state (not (string= "." filename)))
- (setq result (cons (list filename state) result)))))
+ (when state
+ (setq result (cons (list filename state) result)))))
(funcall callback result)))
;; dir-status-files called from vc-dir, which loads vc,
@@ -212,7 +212,7 @@ switches."
(autoload 'vc-expand-dirs "vc")
(defun vc-svn-dir-status-files (_dir files callback)
- "Run 'svn status' for DIR and update BUFFER via CALLBACK.
+ "Run \"svn status\" for DIR and update BUFFER via CALLBACK.
CALLBACK is called as (CALLBACK RESULT BUFFER), where
RESULT is a list of conses (FILE . STATE) for directory DIR."
;; FIXME shouldn't this rather default to all the files in dir?
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index fd0192fad2b..2dcf8f56542 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -220,7 +220,7 @@
;;
;; - responsible-p (file)
;;
-;; Return non-nil if this backend considers itself "responsible" for
+;; Return the directory if this backend considers itself "responsible" for
;; FILE, which can also be a directory. This function is used to find
;; out what backend to use for registration of new files and for things
;; like change log generation. The default implementation always
@@ -829,7 +829,7 @@ for the backend you use."
"Limit the number of items shown by the VC log commands.
Zero means unlimited.
Not all VC backends are able to support this feature."
- :type 'integer)
+ :type 'natnum)
(defcustom vc-allow-async-revert nil
"Specifies whether the diff during \\[vc-revert] may be asynchronous.
@@ -2659,7 +2659,10 @@ with its diffs (if the underlying VCS supports that)."
(error "Directory is not version controlled")))
(setq default-directory rootdir)
(vc-print-log-internal backend (list rootdir) revision revision limit
- (when with-diff 'with-diff))))
+ (when with-diff 'with-diff))
+ ;; We're looking at the root, so displaying " from <some-file>" in
+ ;; the mode line isn't helpful.
+ (setq vc-parent-buffer-name nil)))
;;;###autoload
(defun vc-print-branch-log (branch)