aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert1993-09-15 23:19:13 +0000
committerPaul Eggert1993-09-15 23:19:13 +0000
commitf18189940825cd4ea2ad1f86324500dde242be1e (patch)
tree53855cffb4fe8c44c50cb1a3533cb0790fd5d10e
parent0f0a85b310ae2016c91153fd69e6fdff8b5e72a1 (diff)
downloademacs-f18189940825cd4ea2ad1f86324500dde242be1e.tar.gz
emacs-f18189940825cd4ea2ad1f86324500dde242be1e.zip
(vc-version-other-window): New function.
(vc-backend-checkout): Add optional arg workfile, which specifies where to put the working file.
-rw-r--r--lisp/vc.el62
1 files changed, 52 insertions, 10 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index d0f7d773e1d..0a15abf3588 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -806,6 +806,26 @@ files in or below it."
806 (message "No changes to %s between %s and %s." file rel1 rel2) 806 (message "No changes to %s between %s and %s." file rel1 rel2)
807 (pop-to-buffer "*vc*")))) 807 (pop-to-buffer "*vc*"))))
808 808
809;;;###autoload
810(defun vc-version-other-window (rev)
811 "Visit version REV of the current buffer in another window.
812If the current buffer is named `F', the version is named `F.~REV~'.
813If `F.~REV~' already exists, it is used instead of being re-created."
814 (interactive "sVersion to visit (default is latest version): ")
815 (if vc-dired-mode
816 (set-buffer (find-file-noselect (dired-get-filename))))
817 (while vc-parent-buffer
818 (pop-to-buffer vc-parent-buffer))
819 (if (and buffer-file-name (vc-name buffer-file-name))
820 (let* ((version (if (string-equal rev "")
821 (vc-latest-version buffer-file-name)
822 rev))
823 (filename (concat buffer-file-name ".~" version "~")))
824 (or (file-exists-p filename)
825 (vc-backend-checkout buffer-file-name nil version filename))
826 (find-file-other-window filename))
827 (vc-registration-error buffer-file-name)))
828
809;; Header-insertion code 829;; Header-insertion code
810 830
811;;;###autoload 831;;;###autoload
@@ -1423,21 +1443,42 @@ Return nil if there is no such person."
1423 (message "Registering %s...done" file) 1443 (message "Registering %s...done" file)
1424 ) 1444 )
1425 1445
1426(defun vc-backend-checkout (file &optional writable rev) 1446(defun vc-backend-checkout (file &optional writable rev workfile)
1427 ;; Retrieve a copy of a saved version into a workfile 1447 ;; Retrieve a copy of a saved version into a workfile
1428 (message "Checking out %s..." file) 1448 (let ((filename (or workfile file)))
1429 (vc-backend-dispatch file 1449 (message "Checking out %s..." filename)
1430 (progn 1450 (vc-backend-dispatch file
1431 (vc-do-command 0 "get" file ;; SCCS 1451 (vc-do-command 0 "get" file ;; SCCS
1432 (if writable "-e") 1452 (if writable "-e")
1453 (if workfile (concat "-G" workfile))
1433 (and rev (concat "-r" (vc-lookup-triple file rev)))) 1454 (and rev (concat "-r" (vc-lookup-triple file rev))))
1455 (if workfile ;; RCS
1456 ;; RCS doesn't let us check out into arbitrary file names directly.
1457 ;; Use `co -p' and make stdout point to the correct file.
1458 (let ((default-modes (default-file-modes))
1459 (vc-modes (logior (file-modes (vc-name file))
1460 (if writable 128 0)))
1461 (failed t))
1462 (unwind-protect
1463 (progn
1464 (set-default-file-modes vc-modes)
1465 (vc-do-command
1466 0 "/bin/sh" file "-c"
1467 "filename=$1; shift; exec co \"$@\" >$filename"
1468 "" ; dummy argument for shell's $0
1469 filename
1470 (if writable "-l")
1471 (concat "-p" rev))
1472 (setq failed nil))
1473 (set-default-file-modes default-modes)
1474 (and failed (file-exists-p filename) (delete-file filename))))
1475 (vc-do-command 0 "co" file
1476 (if writable "-l")
1477 (and rev (concat "-r" rev))))
1434 ) 1478 )
1435 (vc-do-command 0 "co" file ;; RCS 1479 (or workfile
1436 (if writable "-l") 1480 (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file))))
1437 (and rev (concat "-r" rev))) 1481 (message "Checking out %s...done" filename))
1438 )
1439 (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file)))
1440 (message "Checking out %s...done" file)
1441 ) 1482 )
1442 1483
1443(defun vc-backend-logentry-check (file) 1484(defun vc-backend-logentry-check (file)
@@ -1572,6 +1613,7 @@ These bindings are added to the global keymap when you enter this mode:
1572\\[vc-revert-buffer] revert buffer to latest version 1613\\[vc-revert-buffer] revert buffer to latest version
1573\\[vc-cancel-version] undo latest checkin 1614\\[vc-cancel-version] undo latest checkin
1574\\[vc-diff] show diffs between file versions 1615\\[vc-diff] show diffs between file versions
1616\\[vc-version-other-window] visit old version in another window
1575\\[vc-directory] show all files locked by any user in or below . 1617\\[vc-directory] show all files locked by any user in or below .
1576\\[vc-update-change-log] add change log entry from recent checkins 1618\\[vc-update-change-log] add change log entry from recent checkins
1577 1619