aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-11-27 11:39:02 +0000
committerRichard M. Stallman1993-11-27 11:39:02 +0000
commitbbf97570e5037b2417c9dd6353e1b2a9afadda7c (patch)
tree3091d3cdea19365e95b946c4e69a514e377b4c9f
parent5d9e58e85e8513b0ea5c1ca28681a63325fb0621 (diff)
downloademacs-bbf97570e5037b2417c9dd6353e1b2a9afadda7c.tar.gz
emacs-bbf97570e5037b2417c9dd6353e1b2a9afadda7c.zip
(vc-buffer-sync): Signal error if user says no.
-rw-r--r--lisp/vc.el43
1 files changed, 35 insertions, 8 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index e9501a8bd0b..7b688ea8694 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -118,6 +118,12 @@ Add an entry in this list if you need to override the normal comment-start
118and comment-end variables. This will only be necessary if the mode language 118and comment-end variables. This will only be necessary if the mode language
119is sensitive to blank lines.") 119is sensitive to blank lines.")
120 120
121;; Default is to be extra careful for super-user.
122(defvar vc-checkout-carefully (= (user-uid) 0)
123 "*Non-nil means be extra-careful in checkout.
124Verify that the file really is not locked
125and that its contents match what the master file says.")
126
121;; Variables the user doesn't need to know about. 127;; Variables the user doesn't need to know about.
122(defvar vc-log-entry-mode nil) 128(defvar vc-log-entry-mode nil)
123(defvar vc-log-operation nil) 129(defvar vc-log-operation nil)
@@ -327,12 +333,12 @@ the master name of FILE; this is appended to an optional list of FLAGS."
327 333
328(defun vc-buffer-sync () 334(defun vc-buffer-sync ()
329 ;; 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
330 (if (and (buffer-modified-p) 336 (if (buffer-modified-p)
331 (or 337 (progn
332 vc-suppress-confirm 338 (or vc-suppress-confirm
333 (y-or-n-p (format "%s has been modified. Write it out? " 339 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name)))
334 (buffer-name))))) 340 (error "Aborted"))
335 (save-buffer))) 341 (save-buffer))))
336 342
337(defun vc-workfile-unchanged-p (file) 343(defun vc-workfile-unchanged-p (file)
338 ;; Has the given workfile changed since last checkout? 344 ;; Has the given workfile changed since last checkout?
@@ -365,7 +371,26 @@ the master name of FILE; this is appended to an optional list of FLAGS."
365 371
366 ;; if there is no lock on the file, assert one and get it 372 ;; if there is no lock on the file, assert one and get it
367 ((not (setq owner (vc-locking-user file))) 373 ((not (setq owner (vc-locking-user file)))
368 (vc-checkout-writable-buffer file)) 374 (if (and vc-checkout-carefully
375 (not (vc-workfile-unchanged-p file))
376 (not (zerop (vc-backend-diff file nil))))
377 (if (save-window-excursion
378 (pop-to-buffer "*vc*")
379 (goto-char (point-min))
380 (insert-string (format "Changes to %s since last lock:\n\n"
381 file))
382 (not (beep))
383 (yes-or-no-p
384 (concat "File has unlocked changes, "
385 "claim lock retaining changes? ")))
386 (progn (vc-backend-steal file)
387 (vc-mode-line file))
388 (if (not (yes-or-no-p "Revert to checked-in version, instead? "))
389 (error "Checkout aborted.")
390 (vc-revert-buffer1 t t)
391 (vc-checkout-writable-buffer file))
392 )
393 (vc-checkout-writable-buffer file)))
369 394
370 ;; a checked-out version exists, but the user may not own the lock 395 ;; a checked-out version exists, but the user may not own the lock
371 ((not (string-equal owner (user-login-name))) 396 ((not (string-equal owner (user-login-name)))
@@ -441,7 +466,9 @@ it will operate on the file in the current line.
441files are marked, it will accept a log message and then operate on 466files are marked, it will accept a log message and then operate on
442each one. The log message will be used as a comment for any register 467each one. The log message will be used as a comment for any register
443or checkin operations, but ignored when doing checkouts. Attempted 468or checkin operations, but ignored when doing checkouts. Attempted
444lock steals will raise an error." 469lock steals will raise an error.
470
471 For checkin, a prefix argument lets you specify the version number to use."
445 (interactive "P") 472 (interactive "P")
446 (catch 'nogo 473 (catch 'nogo
447 (if vc-dired-mode 474 (if vc-dired-mode