annotate lisp/ediff-vers.el @ 16713:490b479ce48a

(perform-replace): Delete the code that checked whether the regexp could match again right after this match. It made the loop too slow.
author Richard M. Stallman <rms@gnu.org>
date Wed, 18 Dec 1996 02:22:34 +0000
parents b2fae8abc5b0
children 0b9d9cbf3cd4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1 ;;; ediff-vers.el --- version control interface to Ediff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
2
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
3 ;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
4
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
6
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
12 ;; any later version.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17 ;; GNU General Public License for more details.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
23
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
24
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
25 ;;; Code:
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
26
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
27 ;; Compiler pacifier
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
28 (defvar rcs-default-co-switches)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
29 (defvar sc-mode)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
30 (defvar cvs-shell)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
31 (defvar cvs-program)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
32 (defvar cvs-cookie-handle)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
33
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
34 (and noninteractive
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
35 (eval-when-compile
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
36 (load "pcl-cvs" 'noerror)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
37 (load "rcs" 'noerror)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
38 (load "generic-sc" 'noerror)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
39 (load "vc" 'noerror)))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
40 ;; end pacifier
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
41
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
42 ;; VC.el support
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
43 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
44 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
45 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
46 ;; If the current buffer is named `F', the version is named `F.~REV~'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
47 ;; If `F.~REV~' already exists, it is used instead of being re-created.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
48 (let (file1 file2 rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
49 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
50 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
51 (setq rev1buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
52 file1 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
53 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
54 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
55 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
56 (setq rev2buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
57 file2 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
58 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
59 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
60 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
61 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
62 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
63 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
64 (ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
65 rev1buf rev2buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
66 startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
67 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
68
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 ;; RCS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
70 (defun rcs-ediff-view-revision (&optional rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
71 ;; View previous RCS revision of current file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
72 ;; With prefix argument, prompts for a revision name.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
73 (interactive (list (if current-prefix-arg
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
74 (read-string "Revision: "))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
75 (let* ((filename (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
76 (switches (append '("-p")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
77 (if rev (list (concat "-r" rev)) nil)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
78 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
79 (message "Working ...")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
80 (setq filename (expand-file-name filename))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
81 (with-output-to-temp-buffer buff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
83 (delete-windows-on output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
84 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
85 (set-buffer output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
86 (apply 'call-process "co" nil t nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
87 ;; -q: quiet (no diagnostics)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
88 (append switches rcs-default-co-switches
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
89 (list "-q" filename)))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
90 (message "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
91 buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
92
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 (defun ediff-rcs-get-output-buffer (file name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
94 ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
95 ;; Optional NAME is name to use instead of `*RCS-output*'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
96 ;; This is a modified version from rcs.el v1.1. I use it here to make
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
97 ;; Ediff immune to changes in rcs.el
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
98 (let* ((default-major-mode 'fundamental-mode) ; no frills!
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
99 (buf (get-buffer-create name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 (set-buffer buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102 (setq buffer-read-only nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 default-directory (file-name-directory (expand-file-name file)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
104 (erase-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
105 buf))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
106
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
107 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
109 ;; If REV2 is "" then use current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110 (let ((rev2buf (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 (rcs-ediff-view-revision rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 (rev1buf (rcs-ediff-view-revision rev1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
115 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121 ;; GENERIC-SC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (defun generic-sc-get-latest-rev ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (cond ((eq sc-mode 'CCASE)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 (eval "main/LATEST"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (t (eval ""))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
127
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
128 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
129 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
130 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
131 ;; If the current buffer is named `F', the version is named `F.~REV~'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132 ;; If `F.~REV~' already exists, it is used instead of being re-created.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133 (let (rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 (if (or (not rev1) (string= rev1 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
138 (setq rev1buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
139 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
140 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (setq rev2buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
145
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146 ;;; Merge with Version Control
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
148 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
156 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
159 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 (vc-version-other-window ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
165 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
168 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
173 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
181 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
183 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
184 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
185 (setq buf1 (rcs-ediff-view-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
186 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
188 (rcs-ediff-view-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
189 ancestor-buf (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
191 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
192 (rcs-ediff-view-revision ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
193 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
194 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
195 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
196 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
197 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
198 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
199 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
200
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
201 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
202 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
203 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
204 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
205 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
206 (if (string= rev1 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
207 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
208 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
209 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
210 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
211 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
212 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
215 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
216 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 (sc-visit-previous-revision ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
220 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
221 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
222 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
223 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
225
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
226 ;; PCL-CVS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
228 (defun ediff-pcl-cvs-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 ;; Run Ediff on a pair of revisions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
230 ;; If REV1 is "", use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
231 ;; If REV2 is "", use the current buffer as the second file to compare.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
233 orig-file-name buf1 buf2 file1 file2)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
235 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
236 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
238 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
240 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 (ediff-pcl-cvs-view-revision orig-file-name rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 file1 (buffer-file-name buf1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 file2 (buffer-file-name buf2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
244 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
245 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
248 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
250 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252 ;; This function is the standard Ediff's interface to pcl-cvs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
253 ;; Works like with other interfaces: runs ediff on versions of the file in the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 ;; current buffer.
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
255 (defun ediff-pcl-cvs-merge-internal (rev1 rev2 ancestor-rev
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258 ;; If REV1 is "" then use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259 ;; If REV2 is "" then merge current buffer's file with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 ;; If ANCESTOR-REV is nil, then merge without the ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
263 orig-file-name buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
264
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
270 (setq buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
271 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
272 (ediff-pcl-cvs-view-revision orig-file-name rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
273 (if (stringp ancestor-rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
274 (setq ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
277 (ediff-pcl-cvs-view-revision orig-file-name ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
280 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
286 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
287 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
288 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
289 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
290
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 (if ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
293 buf1 buf2 ancestor-buf startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
297 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
298
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 (defun ediff-pcl-cvs-view-revision (file rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 ;; if rev = "", get the latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (let ((temp-name (make-temp-name
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302 (concat ediff-temp-file-prefix
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 "ediff_" rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
304 (cvs-kill-buffer-visiting temp-name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
305 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 (message "Retrieving revision %s..." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
307 (message "Retrieving latest revision..."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308 (let ((res (call-process cvs-shell nil nil nil "-c"
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
309 (concat cvs-program " update -p "
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
310 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
311 (concat "-r " rev " ")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
312 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313 file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
314 " > " temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
315 (if (and res (not (and (integerp res) (zerop res))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
316 (error "Failed to retrieve revision: %s" res))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
317
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
318 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
319 (message "Retrieving revision %s... Done." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
320 (message "Retrieving latest revision... Done."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
321 (find-file-noselect temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
322
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
323
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
324 (defun cvs-run-ediff-on-file-descriptor (tin)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
325 ;; This is a replacement for cvs-emerge-mode
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
326 ;; Run after cvs-update.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
328 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
329 (type (cvs-fileinfo->type fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
330 (tmp-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
331 (cvs-retrieve-revision-to-tmpfile fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332 ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
333
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 (or (memq type '(MERGED CONFLICT MODIFIED))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
335 (error
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
336 "Can only merge `Modified', `Merged' or `Conflict' files"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
337
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
338 (cond ((memq type '(MERGED CONFLICT))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
339 (setq ancestor-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
340 (cvs-retrieve-revision-to-tmpfile
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
341 fileinfo
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
342 ;; revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
343 (cvs-fileinfo->base-revision fileinfo)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
344 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
345 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
346 (find-file-noselect (cvs-fileinfo->backup-file fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
347 (find-file-noselect ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
348 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
349 'ediff-merge-revisions-with-ancestor))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
350 ((eq type 'MODIFIED)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
351 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
352 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
353 (find-file-noselect (cvs-fileinfo->full-path fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
354 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
355 'ediff-merge-revisions)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
356 (if (stringp tmp-file) (delete-file tmp-file))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
357 (if (stringp ancestor-file) (delete-file ancestor-file))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
358
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
359 ;;; Local Variables:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
360 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
361 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
362 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
363 ;;; End:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
364
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
365 (provide 'ediff-vers)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
366
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
367 ;;; ediff-vers.el ends here