comparison lisp/vc.el @ 1478:429e23e87072

(vc-resynch-window): New arg NOQUERY. Pass it to vc-revert-buffer1. (vc-checkout, vc-finish-logentry, vc-revert-buffer, vc-finish-steal): Supply t as NOQUERY arg for vc-resynch-window. (vc-next-action): Don't revert workfile from master if buffer is modified.
author Richard M. Stallman <rms@gnu.org>
date Mon, 26 Oct 1992 05:33:20 +0000
parents a8623439066b
children 64f5e84c822b
comparison
equal deleted inserted replaced
1477:e31496f6289d 1478:429e23e87072
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
4 4
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
6 ;; Version: 4.0 6 ;; Version: 4.0
7 7
8 ;; $Id: vc.el,v 1.12 1992/10/05 22:03:53 rms Exp rms $ 8 ;; $Id: vc.el,v 1.13 1992/10/06 08:59:39 rms Exp rms $
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
290 (t (progn 290 (t (progn
291 291
292 ;; give luser a chance to save before checking in. 292 ;; give luser a chance to save before checking in.
293 (vc-buffer-sync) 293 (vc-buffer-sync)
294 294
295 ;; revert if file is unchanged 295 ;; Revert if file is unchanged and buffer is too.
296 (if (vc-workfile-unchanged-p file) 296 ;; If buffer is modified, that means the user just said no
297 ;; to saving it; in that case, don't revert,
298 ;; because the user might intend to save
299 ;; after finishing the log entry.
300 (if (and (vc-workfile-unchanged-p file)
301 (not (buffer-modified-p)))
297 (progn 302 (progn
298 (vc-backend-revert file) 303 (vc-backend-revert file)
299 (vc-resynch-window file t)) 304 (vc-resynch-window file t))
300 305
301 ;; user may want to set nonstandard parameters 306 ;; user may want to set nonstandard parameters
318 (vc-admin 323 (vc-admin
319 buffer-file-name 324 buffer-file-name
320 (and override (read-string "Initial version level: "))) 325 (and override (read-string "Initial version level: ")))
321 ) 326 )
322 327
323 (defun vc-resynch-window (file &optional keep) 328 (defun vc-resynch-window (file &optional keep noquery)
324 ;; If the given file is in the current buffer, 329 ;; If the given file is in the current buffer,
325 ;; either revert on it so we see expanded keyworks, 330 ;; either revert on it so we see expanded keyworks,
326 ;; or unvisit it (depending on vc-keep-workfiles) 331 ;; or unvisit it (depending on vc-keep-workfiles)
332 ;; NOQUERY if non-nil inhibits confirmation for reverting.
333 ;; NOQUERY should be t *only* if it is known the only difference
334 ;; between the buffer and the file is due to RCS rather than user editing!
327 (and (string= buffer-file-name file) 335 (and (string= buffer-file-name file)
328 (if keep 336 (if keep
329 (progn 337 (progn
330 (vc-revert-buffer1 nil t) 338 (vc-revert-buffer1 nil noquery)
331 (vc-mode-line buffer-file-name)) 339 (vc-mode-line buffer-file-name))
332 (progn 340 (progn
333 (delete-window) 341 (delete-window)
334 (kill-buffer (current-buffer)))))) 342 (kill-buffer (current-buffer))))))
335 343
336 344
337 (defun vc-admin (file rev) 345 (defun vc-admin (file rev)
338 "Checks a file into your version-control system. 346 "Check a file into your version-control system.
339 FILE is the unmodified name of the file. REV should be the base version 347 FILE is the unmodified name of the file. REV should be the base version
340 level to check it in under." 348 level to check it in under."
341 (if vc-initial-comment 349 (if vc-initial-comment
342 (progn 350 (progn
343 (pop-to-buffer (get-buffer-create "*VC-log*")) 351 (pop-to-buffer (get-buffer-create "*VC-log*"))
375 (message "Please explain why you stole the lock. Type C-c C-c when done.")) 383 (message "Please explain why you stole the lock. Type C-c C-c when done."))
376 384
377 ;; This is called when the notification has been sent. 385 ;; This is called when the notification has been sent.
378 (defun vc-finish-steal (file version) 386 (defun vc-finish-steal (file version)
379 (vc-backend-steal file version) 387 (vc-backend-steal file version)
380 (vc-resynch-window file t)) 388 (vc-resynch-window file t t))
381 389
382 (defun vc-checkout (file &optional writeable) 390 (defun vc-checkout (file &optional writeable)
383 "Retrieve a copy of the latest version of the given file." 391 "Retrieve a copy of the latest version of the given file."
384 (vc-backend-checkout file writeable) 392 (vc-backend-checkout file writeable)
385 (if (string-equal file buffer-file-name) 393 (if (string-equal file buffer-file-name)
386 (vc-resynch-window file t)) 394 (vc-resynch-window file t t))
387 ) 395 )
388 396
389 (defun vc-checkin (file &optional rev comment) 397 (defun vc-checkin (file &optional rev comment)
390 "Check in the file specified by FILE. 398 "Check in the file specified by FILE.
391 The optional argument REV may be a string specifying the new version level 399 The optional argument REV may be a string specifying the new version level
433 ;; Return to "parent" buffer of this checkin and remove checkin window 441 ;; Return to "parent" buffer of this checkin and remove checkin window
434 (pop-to-buffer (get-file-buffer vc-log-file)) 442 (pop-to-buffer (get-file-buffer vc-log-file))
435 (delete-window (get-buffer-window "*VC-log*")) 443 (delete-window (get-buffer-window "*VC-log*"))
436 (bury-buffer "*VC-log*") 444 (bury-buffer "*VC-log*")
437 ;; Now make sure we see the expanded headers 445 ;; Now make sure we see the expanded headers
438 (vc-resynch-window buffer-file-name vc-keep-workfiles) 446 (vc-resynch-window buffer-file-name vc-keep-workfiles t)
439 (run-hooks vc-log-after-operation-hook) 447 (run-hooks vc-log-after-operation-hook)
440 ) 448 )
441 449
442 ;; Code for access to the comment ring 450 ;; Code for access to the comment ring
443 451
714 (error "Revert cancelled.")) 722 (error "Revert cancelled."))
715 (set-buffer obuf)) 723 (set-buffer obuf))
716 (if changed 724 (if changed
717 (delete-window)) 725 (delete-window))
718 (vc-backend-revert file) 726 (vc-backend-revert file)
719 (vc-resynch-window file t) 727 (vc-resynch-window file t t)
720 ) 728 )
721 ) 729 )
722 730
723 ;;;###autoload 731 ;;;###autoload
724 (defun vc-cancel-version (norevert) 732 (defun vc-cancel-version (norevert)