Mercurial > emacs
annotate lisp/ediff-vers.el @ 49705:11a1f873b7e8
(DONTCOMPILE): Add malayalam.el and tamil.el.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 11 Feb 2003 01:45:02 +0000 |
parents | 37645a051842 |
children | 695cf19ef79e d7ddb3e565de |
rev | line source |
---|---|
14234 | 1 ;;; ediff-vers.el --- version control interface to Ediff |
2 | |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
3 ;;; Copyright (C) 1995, 96, 97, 2002 Free Software Foundation, Inc. |
14234 | 4 |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
5 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
14234 | 6 |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35109
diff
changeset
|
24 ;;; Commentary: |
14234 | 25 |
26 ;;; Code: | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
27 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
28 ;; Compiler pacifier |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
29 (defvar rcs-default-co-switches) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
30 (defvar sc-mode) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
31 (defvar cvs-shell) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
32 (defvar cvs-program) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
33 (defvar cvs-cookie-handle) |
18054 | 34 (defvar ediff-temp-file-prefix) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
35 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
36 (and noninteractive |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
37 (eval-when-compile |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
38 (let ((load-path (cons (expand-file-name ".") load-path))) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
39 (load "pcl-cvs" 'noerror) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
40 (load "rcs" 'noerror) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
41 ;; On 8+3 MS-DOS filesystems, generic-x.el is loaded |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
42 ;; instead of (the missing) generic-sc.el. Since the |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
43 ;; version of Emacs which supports MS-DOS doesn't have |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
44 ;; generic-sc, we simply avoid loading it. |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
45 (or (and (fboundp 'msdos-long-file-names) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
46 (not (msdos-long-file-names))) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
47 (load "generic-sc" 'noerror)) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
48 ;; (load "vc" 'noerror) ; this sometimes causes compiler error |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
49 (or (featurep 'ediff-init) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
50 (load "ediff-init.el" nil nil 'nosuffix)) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
51 ))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
52 ;; end pacifier |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
53 |
14234 | 54 ;; VC.el support |
49428
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
55 |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
56 (defun ediff-vc-latest-version (file) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
57 "Return the version level of the latest version of FILE in repository." |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
58 (if (fboundp 'vc-latest-version) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
59 (vc-latest-version file) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
60 (or (vc-file-getprop file 'vc-latest-version) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
61 (cond ((vc-backend file) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
62 (vc-call state file) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
63 (vc-file-getprop file 'vc-latest-version)) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
64 (t (error "File %s is not under version control" file)))) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
65 )) |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
66 |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
67 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
68 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) |
49428
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
69 ;; Run Ediff on versions of the current buffer. |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
70 ;; If REV1 is "", use the latest version of the current buffer's file. |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
71 ;; If REV2 is "" then compare current buffer with REV1. |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
72 ;; If the current buffer is named `F', the version is named `F.~REV~'. |
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
73 ;; If `F.~REV~' already exists, it is used instead of being re-created. |
14234 | 74 (let (file1 file2 rev1buf rev2buf) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
75 (if (string= rev1 "") |
49428
0f80cb4f9d29
2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
42602
diff
changeset
|
76 (setq rev1 (ediff-vc-latest-version (buffer-file-name)))) |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
77 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
78 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
79 (vc-version-other-window rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
80 (setq rev1buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
81 file1 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
82 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
83 (or (string= rev2 "") ; use current buffer |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
84 (vc-version-other-window rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
85 (setq rev2buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
86 file2 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
87 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
88 (cons `(lambda () |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
89 (delete-file ,file1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
90 (or ,(string= rev2 "") (delete-file ,file2))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
91 startup-hooks))) |
14234 | 92 (ediff-buffers |
93 rev1buf rev2buf | |
94 startup-hooks | |
95 'ediff-revision))) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
96 |
14234 | 97 ;; RCS.el support |
98 (defun rcs-ediff-view-revision (&optional rev) | |
99 ;; View previous RCS revision of current file. | |
100 ;; With prefix argument, prompts for a revision name. | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
101 (interactive (list (if current-prefix-arg |
14234 | 102 (read-string "Revision: ")))) |
103 (let* ((filename (buffer-file-name (current-buffer))) | |
104 (switches (append '("-p") | |
105 (if rev (list (concat "-r" rev)) nil))) | |
106 (buff (concat (file-name-nondirectory filename) ".~" rev "~"))) | |
107 (message "Working ...") | |
108 (setq filename (expand-file-name filename)) | |
109 (with-output-to-temp-buffer buff | |
33391
f8c8c2d3538e
(rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents:
33019
diff
changeset
|
110 (ediff-with-current-buffer standard-output |
f8c8c2d3538e
(rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents:
33019
diff
changeset
|
111 (fundamental-mode)) |
14234 | 112 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) |
113 (delete-windows-on output-buffer) | |
114 (save-excursion | |
115 (set-buffer output-buffer) | |
116 (apply 'call-process "co" nil t nil | |
117 ;; -q: quiet (no diagnostics) | |
118 (append switches rcs-default-co-switches | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
119 (list "-q" filename))))) |
14234 | 120 (message "") |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
121 buff))) |
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
122 |
14234 | 123 (defun ediff-rcs-get-output-buffer (file name) |
124 ;; Get a buffer for RCS output for FILE, make it writable and clean it up. | |
125 ;; Optional NAME is name to use instead of `*RCS-output*'. | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26039
diff
changeset
|
126 ;; This is a modified version from rcs.el v1.1. I use it here to make |
14234 | 127 ;; Ediff immune to changes in rcs.el |
128 (let* ((default-major-mode 'fundamental-mode) ; no frills! | |
129 (buf (get-buffer-create name))) | |
130 (save-excursion | |
131 (set-buffer buf) | |
132 (setq buffer-read-only nil | |
133 default-directory (file-name-directory (expand-file-name file))) | |
134 (erase-buffer)) | |
135 buf)) | |
136 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
137 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) |
14234 | 138 ;; Run Ediff on versions of the current buffer. |
139 ;; If REV2 is "" then use current buffer. | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
140 (let (rev2buf rev1buf) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
141 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
142 (setq rev2buf (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
143 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
144 (rcs-ediff-view-revision rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
145 rev1buf (rcs-ediff-view-revision rev1))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
146 |
14234 | 147 ;; rcs.el doesn't create temp version files, so we don't have to delete |
148 ;; anything in startup hooks to ediff-buffers | |
149 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision) | |
150 )) | |
151 | |
152 | |
153 ;; GENERIC-SC.el support | |
154 | |
155 (defun generic-sc-get-latest-rev () | |
156 (cond ((eq sc-mode 'CCASE) | |
157 (eval "main/LATEST")) | |
158 (t (eval "")))) | |
159 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
160 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 161 ;; Run Ediff on versions of the current buffer. |
162 ;; If REV2 is "" then compare current buffer with REV1. | |
163 ;; If the current buffer is named `F', the version is named `F.~REV~'. | |
164 ;; If `F.~REV~' already exists, it is used instead of being re-created. | |
165 (let (rev1buf rev2buf) | |
166 (save-excursion | |
167 (if (or (not rev1) (string= rev1 "")) | |
168 (setq rev1 (generic-sc-get-latest-rev))) | |
169 (sc-visit-previous-revision rev1) | |
170 (setq rev1buf (current-buffer))) | |
171 (save-excursion | |
172 (or (string= rev2 "") ; use current buffer | |
173 (sc-visit-previous-revision rev2)) | |
174 (setq rev2buf (current-buffer))) | |
175 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) | |
176 | |
177 | |
178 ;;; Merge with Version Control | |
179 | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
180 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev |
20206 | 181 &optional startup-hooks merge-buffer-file) |
14234 | 182 ;; If ANCESTOR-REV non-nil, merge with ancestor |
183 (let (buf1 buf2 ancestor-buf) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
184 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
185 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
186 (vc-version-other-window rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
187 (setq buf1 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
188 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
189 (or (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
190 (vc-version-other-window rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
191 (setq buf2 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
192 (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
193 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
194 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
195 (setq ancestor-rev (vc-workfile-version buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
196 (vc-version-other-window ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
197 (setq ancestor-buf (current-buffer)))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
198 (setq startup-hooks |
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
199 (cons |
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
200 `(lambda () |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
201 (delete-file ,(buffer-file-name buf1)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
202 (or ,(string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
203 (delete-file ,(buffer-file-name buf2))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
204 (or ,(string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
205 ,(not ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
206 (delete-file ,(buffer-file-name ancestor-buf))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
207 ) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
208 startup-hooks))) |
14234 | 209 (if ancestor-rev |
210 (ediff-merge-buffers-with-ancestor | |
211 buf1 buf2 ancestor-buf | |
20206 | 212 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
213 (ediff-merge-buffers | |
214 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)) | |
14234 | 215 )) |
216 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
217 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev |
20206 | 218 &optional |
219 startup-hooks merge-buffer-file) | |
14234 | 220 ;; If ANCESTOR-REV non-nil, merge with ancestor |
221 (let (buf1 buf2 ancestor-buf) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
222 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
223 (setq buf1 (rcs-ediff-view-revision rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
224 buf2 (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
225 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
226 (rcs-ediff-view-revision rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
227 ancestor-buf (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
228 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
229 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
230 (rcs-ediff-view-revision ancestor-rev))))) |
14234 | 231 ;; rcs.el doesn't create temp version files, so we don't have to delete |
232 ;; anything in startup hooks to ediff-buffers | |
233 (if ancestor-rev | |
234 (ediff-merge-buffers-with-ancestor | |
235 buf1 buf2 ancestor-buf | |
20206 | 236 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
237 (ediff-merge-buffers | |
238 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 239 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
240 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev |
20206 | 241 &optional |
242 startup-hooks merge-buffer-file) | |
14234 | 243 ;; If ANCESTOR-REV non-nil, merge with ancestor |
244 (let (buf1 buf2 ancestor-buf) | |
245 (save-excursion | |
246 (if (string= rev1 "") | |
247 (setq rev1 (generic-sc-get-latest-rev))) | |
248 (sc-visit-previous-revision rev1) | |
249 (setq buf1 (current-buffer))) | |
250 (save-excursion | |
251 (or (string= rev2 "") | |
252 (sc-visit-previous-revision rev2)) | |
253 (setq buf2 (current-buffer))) | |
254 (if ancestor-rev | |
255 (save-excursion | |
256 (or (string= ancestor-rev "") | |
257 (sc-visit-previous-revision ancestor-rev)) | |
258 (setq ancestor-buf (current-buffer)))) | |
259 (if ancestor-rev | |
260 (ediff-merge-buffers-with-ancestor | |
261 buf1 buf2 ancestor-buf | |
20206 | 262 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
263 (ediff-merge-buffers | |
264 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 265 |
266 | |
267 ;; PCL-CVS.el support | |
268 | |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
269 ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs |
14234 | 270 (defun cvs-run-ediff-on-file-descriptor (tin) |
271 ;; This is a replacement for cvs-emerge-mode | |
20206 | 272 ;; Runs after cvs-update. |
14234 | 273 ;; Ediff-merge appropriate revisions of the selected file. |
274 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin)) | |
275 (type (cvs-fileinfo->type fileinfo)) | |
276 (tmp-file | |
277 (cvs-retrieve-revision-to-tmpfile fileinfo)) | |
20343 | 278 (default-directory |
21940 | 279 (file-name-as-directory (cvs-fileinfo->dir fileinfo))) |
14234 | 280 ancestor-file) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
281 |
14234 | 282 (or (memq type '(MERGED CONFLICT MODIFIED)) |
283 (error | |
284 "Can only merge `Modified', `Merged' or `Conflict' files")) | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49428
diff
changeset
|
285 |
14234 | 286 (cond ((memq type '(MERGED CONFLICT)) |
287 (setq ancestor-file | |
288 (cvs-retrieve-revision-to-tmpfile | |
289 fileinfo | |
290 ;; revision | |
291 (cvs-fileinfo->base-revision fileinfo))) | |
292 (ediff-merge-buffers-with-ancestor | |
293 (find-file-noselect tmp-file) | |
294 (find-file-noselect (cvs-fileinfo->backup-file fileinfo)) | |
295 (find-file-noselect ancestor-file) | |
296 nil ; startup-hooks | |
297 'ediff-merge-revisions-with-ancestor)) | |
298 ((eq type 'MODIFIED) | |
20343 | 299 (ediff-buffers |
14234 | 300 (find-file-noselect tmp-file) |
301 (find-file-noselect (cvs-fileinfo->full-path fileinfo)) | |
302 nil ; startup-hooks | |
20343 | 303 'ediff-revisions))) |
14234 | 304 (if (stringp tmp-file) (delete-file tmp-file)) |
305 (if (stringp ancestor-file) (delete-file ancestor-file)))) | |
306 | |
307 ;;; Local Variables: | |
308 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
19047 | 309 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
310 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
14234 | 311 ;;; End: |
312 | |
313 (provide 'ediff-vers) | |
314 | |
315 ;;; ediff-vers.el ends here |