Mercurial > emacs
comparison lisp/vc.el @ 5338:b3a78854c791
(vc-buffer-sync, vc-diff): New arg NOT-URGENT.
(vc-diff): Pass new arg.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 24 Dec 1993 23:07:23 +0000 |
parents | f12548cb6e0b |
children | e66b058ec9f6 |
comparison
equal
deleted
inserted
replaced
5337:0740b2a454d9 | 5338:b3a78854c791 |
---|---|
329 (if mark-context | 329 (if mark-context |
330 (let ((new-mark (vc-find-position-by-context mark-context))) | 330 (let ((new-mark (vc-find-position-by-context mark-context))) |
331 (if new-mark (set-mark new-mark)))))) | 331 (if new-mark (set-mark new-mark)))))) |
332 | 332 |
333 | 333 |
334 (defun vc-buffer-sync () | 334 (defun vc-buffer-sync (&optional not-urgent) |
335 ;; Make sure the current buffer and its working file are in sync | 335 ;; Make sure the current buffer and its working file are in sync |
336 ;; NOT-URGENT means it is ok to continue if the user says not to save. | |
336 (if (buffer-modified-p) | 337 (if (buffer-modified-p) |
337 (progn | 338 (if (or vc-suppress-confirm |
338 (or vc-suppress-confirm | 339 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name)))) |
339 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))) | 340 (save-buffer) |
340 (error "Aborted")) | 341 (if not-urgent |
341 (save-buffer)))) | 342 nil |
343 (error "Aborted"))))) | |
344 | |
342 | 345 |
343 (defun vc-workfile-unchanged-p (file &optional want-differences-if-changed) | 346 (defun vc-workfile-unchanged-p (file &optional want-differences-if-changed) |
344 ;; Has the given workfile changed since last checkout? | 347 ;; Has the given workfile changed since last checkout? |
345 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) | 348 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) |
346 (lastmod (nth 5 (file-attributes file)))) | 349 (lastmod (nth 5 (file-attributes file)))) |
746 (t (error "Not found"))))) | 749 (t (error "Not found"))))) |
747 | 750 |
748 ;; Additional entry points for examining version histories | 751 ;; Additional entry points for examining version histories |
749 | 752 |
750 ;;;###autoload | 753 ;;;###autoload |
751 (defun vc-diff (historic) | 754 (defun vc-diff (historic &optional not-urgent) |
752 "Display diffs between file versions. | 755 "Display diffs between file versions. |
753 Normally this compares the current file and buffer with the most recent | 756 Normally this compares the current file and buffer with the most recent |
754 checked in version of that file. This uses no arguments. | 757 checked in version of that file. This uses no arguments. |
755 With a prefix argument, it reads the file name to use | 758 With a prefix argument, it reads the file name to use |
756 and two version designators specifying which versions to compare." | 759 and two version designators specifying which versions to compare." |
766 "There is no version-control master associated with this buffer")) | 769 "There is no version-control master associated with this buffer")) |
767 (let ((file buffer-file-name) | 770 (let ((file buffer-file-name) |
768 unchanged) | 771 unchanged) |
769 (or (and file (vc-name file)) | 772 (or (and file (vc-name file)) |
770 (vc-registration-error file)) | 773 (vc-registration-error file)) |
771 (vc-buffer-sync) | 774 (vc-buffer-sync not-urgent) |
772 (setq unchanged (vc-workfile-unchanged-p buffer-file-name)) | 775 (setq unchanged (vc-workfile-unchanged-p buffer-file-name)) |
773 (if unchanged | 776 (if unchanged |
774 (message "No changes to %s since latest version." file) | 777 (message "No changes to %s since latest version." file) |
775 (vc-backend-diff file) | 778 (vc-backend-diff file) |
776 ;; Ideally, we'd like at this point to parse the diff so that | 779 ;; Ideally, we'd like at this point to parse the diff so that |
1118 (if vc-dired-mode | 1121 (if vc-dired-mode |
1119 (find-file-other-window (dired-get-filename))) | 1122 (find-file-other-window (dired-get-filename))) |
1120 (while vc-parent-buffer | 1123 (while vc-parent-buffer |
1121 (pop-to-buffer vc-parent-buffer)) | 1124 (pop-to-buffer vc-parent-buffer)) |
1122 (let ((file buffer-file-name) | 1125 (let ((file buffer-file-name) |
1123 (obuf (current-buffer)) (changed (vc-diff nil))) | 1126 (obuf (current-buffer)) (changed (vc-diff nil t))) |
1124 (if (and changed (or vc-suppress-confirm | 1127 (if (and changed (or vc-suppress-confirm |
1125 (not (yes-or-no-p "Discard changes? ")))) | 1128 (not (yes-or-no-p "Discard changes? ")))) |
1126 (progn | 1129 (progn |
1127 (delete-window) | 1130 (delete-window) |
1128 (error "Revert cancelled")) | 1131 (error "Revert cancelled")) |