annotate lisp/pcl-cvs/pcl-cvs.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 49a24b4fd526
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;;#ident "@(#)OrigId: pcl-cvs.el,v 1.93 1993/05/31 22:44:00 ceder Exp "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;;#ident "@(#)cvs/contrib/pcl-cvs:$Name: r19-14 $:$Id: pcl-cvs.el,v 1.1.1.1 1996/12/18 03:32:27 steve Exp $"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; pcl-cvs.el -- A Front-end to CVS 1.3 or later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; Release 1.05-CVS-$Name: r19-14 $.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (C) 1991, 1992, 1993 Per Cederqvist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; the Free Software Foundation; either version 2 of the License, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; (at your option) any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; See below for installation instructions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; There is an TeXinfo file that describes this package. You should read it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; to get the most from this package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Mail questions and bug reports regarding this version (as included in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; CVS-1.7 or newer) to the pcl-cvs support team at <pcl-cvs@cyclic.com>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Don't try to use this with CVS 1.2 or earlier. It won't work. Get CVS 1.7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; or newer. Use the version of RCS best suited for the version of CVS you're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ; (require 'cookie) ; from ELIB-1.0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (load "cookie.el")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (require 'add-log) ; for all the ChangeLog goodies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (provide 'pcl-cvs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; -------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; START OF THINGS TO CHECK WHEN INSTALLING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; also use $GNU here, since may folks might install CVS as a GNU package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defvar local-path (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ((getenv "LOCAL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (getenv "LOCAL"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ((getenv "GNU")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (getenv "GNU"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 "/usr/local"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "*Path prefix for most locally installed things.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; this isn't likely to be right all the time....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar local-gnu-path (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ((getenv "GNU")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (getenv "GNU"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "/usr/local")) ; or "/usr/gnu"?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "*Path prefix for locally installed GNU software.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defvar cvs-program (concat local-path "/bin/cvs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "*Full path to the cvs executable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; SunOS-4.1.1_U1 has "diff.c 1.12 88/08/04 SMI; from UCB 4.6 86/04/03"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defvar cvs-diff-program (concat local-gnu-path "/bin/diff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "*Full path to the best diff program you've got.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 NOTE: there are some nasty bugs in the context diff variants of some vendor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 versions, such as the one in SunOS-4.1.1_U1")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (defvar cvs-rmdir-program "/bin/rmdir"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "*Full path to the rmdir program. Typically /bin/rmdir.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (defvar cvs-shell "/bin/sh"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "*Full path to a shell that can do redirection on stdout.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;; Options to control various features:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defvar cvs-changelog-full-paragraphs t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "If non-nil, include full ChangeLog paragraphs in the CVS log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 This may be set in the ``local variables'' section of a ChangeLog, to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 indicate the policy for that ChangeLog.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 A ChangeLog paragraph is a bunch of log text containing no blank lines;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 a paragraph usually describes a set of changes with a single purpose,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 but perhaps spanning several functions in several files. Changes in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 different paragraphs are unrelated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 You could argue that the CVS log entry for a file should contain the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 full ChangeLog paragraph mentioning the change to the file, even though
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 it may mention other files, because that gives you the full context you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 need to understand the change. This is the behaviour you get when this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 variable is set to t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 On the other hand, you could argue that the CVS log entry for a change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 should contain only the text for the changes which occurred in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 file, because the CVS log is per-file. This is the behaviour you get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 when this variable is set to nil.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defvar cvs-cvsroot-required nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 "*Specifies whether CVS needs to be told where the repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 In CVS 1.3, if your CVSROOT environment variable is not set, and you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 do not set the `cvs-cvsroot' lisp variable, CVS will have no idea
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 where to find the repository, and refuse to run. CVS 1.4 and later
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 store the repository path with the working directories, so most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 operations don't need to be told where the repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 If you work with multiple repositories with CVS 1.4, it's probably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 advisable to leave your CVSROOT environment variable unset, set this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 variable to nil, and let CVS figure out where the repository is for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 itself.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defvar cvs-cvsroot nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "*Specifies where the (current) cvs master repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 Overrides the $CVSROOT variable by sending \" -d dir\" to all cvs commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 This switch is useful if you have multiple CVS repositories, and are not using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 a modern version of CVS that stores the current repository in CVS/Root.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; Uncomment the following line if you are running on 18.57 or earlier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;(setq delete-exited-processes nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ;; Emacs version 18.57 and earlier is likely to crash if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; delete-exited-processes is t, since the sentinel uses lots of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;; memory, and 18.57 forgets to GCPROT a variable if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; delete-exited-processes is t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;;; END OF THINGS TO CHECK WHEN INSTALLING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;;; --------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defconst pcl-cvs-version "1.05-CVS-$Name: r19-14 $"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 "A string denoting the current release version of pcl-cvs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;; You are NOT allowed to disable this message by default. However, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;; are encouraged to inform your users that by adding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;; (setq cvs-inhibit-copyright-message t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;; to their .emacs they can get rid of it. Just don't add that line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; to your default.el!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (defvar cvs-inhibit-copyright-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 "*Non-nil means don't display a Copyright message in the ``*cvs*'' buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (defconst cvs-startup-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (if cvs-inhibit-copyright-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 "PCL-CVS release 1.05-CVS-$Name: r19-14 $"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "PCL-CVS release 1.05 from CVS release $Name: r19-14 $.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 Copyright (C) 1992, 1993 Per Cederqvist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Pcl-cvs comes with absolutely no warranty; for details consult the manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 This is free software, and you are welcome to redistribute it under certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 conditions; again, consult the TeXinfo manual for details.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 "*Startup message for CVS.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defconst pcl-cvs-bugs-address "pcl-cvs-auto-bugs@cyclic.com"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "The destination address used for the default bug report form.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defvar cvs-stdout-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "Name of the file that holds the output that CVS sends to stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 This variable is buffer local.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (defvar cvs-lock-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 "Full path to a lock file that CVS is waiting for (or was waiting for).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defvar cvs-bakprefix ".#"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "The prefix that CVS prepends to files when rcsmerge'ing.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (defvar cvs-erase-input-buffer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "*Non-nil if input buffers should be cleared before asking for new info.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (defvar cvs-auto-remove-handled nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "*Non-nil if cvs-mode-remove-handled should be called automatically.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 If this is set to any non-nil value, entries that do not need to be checked in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 will be removed from the *cvs* buffer after every cvs-mode-commit command.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defvar cvs-auto-remove-handled-directories nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "*Non-nil if cvs-mode-remove-handled and cvs-update should automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 remove empty directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 If this is set to any non-nil value, directories that do not contain any files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 to be checked in will be removed from the *cvs* buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defvar cvs-sort-ignore-file t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "*Non-nil if cvs-mode-ignore should sort the .cvsignore automatically.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (defvar cvs-auto-revert-after-commit t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 "*Non-nil if committed buffers should be automatically reverted.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defconst cvs-cursor-column 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 "Column to position cursor in in cvs-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 Column 0 is left-most column.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (defvar cvs-mode-map nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 "Keymap for the cvs mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (defvar cvs-edit-mode-map nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "Keymap for the cvs edit mode (used when editing cvs log messages).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defvar cvs-buffer-name "*cvs*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "Name of the cvs buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (defvar cvs-commit-prompt-buffer "*cvs-commit-message*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 "Name of buffer in which the user is prompted for a log message when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 committing files.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (defvar cvs-commit-buffer-require-final-newline t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "*t says silently put a newline at the end of commit log messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 Non-nil but not t says ask user whether to add a newline in each such case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 nil means don't add newlines.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (defvar cvs-temp-buffer-name "*cvs-tmp*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 "*Name of the cvs temporary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 Output from cvs is placed here by synchronous commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (defvar cvs-diff-ignore-marks nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 "*Non-nil if cvs-diff and cvs-mode-diff-backup should ignore any marked files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 Normally they run diff on the files that are marked (with cvs-mode-mark),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 or the file under the cursor if no files are marked. If this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 is set to a non-nil value they will always run diff on the file on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 current line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;;; (setq cvs-status-flags '("-v"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (defvar cvs-status-flags '("-v")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 "*List of flags to pass to ``cvs status''. Default is \"-v\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;;; (setq cvs-log-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (defvar cvs-log-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "*List of flags to pass to ``cvs log''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;;; (setq cvs-tag-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (defvar cvs-tag-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "*List of extra flags to pass to ``cvs tag''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;;; (setq cvs-rtag-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (defvar cvs-rtag-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 "*List of extra flags to pass to ``cvs rtag''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;;; (setq cvs-diff-flags '("-u"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (defvar cvs-diff-flags '("-u")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 "*List of flags to use as flags to pass to ``diff'' and ``cvs diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 Used by cvs-mode-diff-cvs and cvs-mode-diff-backup. Default is \"-u\".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 Set this to \"-u\" to get a Unidiff format, or \"-c\" to get context diffs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;;; (setq cvs-update-optional-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (defvar cvs-update-optional-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "*List of strings to use as optional flags to pass to ``cvs update''. Used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 by cvs-do-update, called by cvs-update, cvs-update-other-window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 cvs-mode-update-no-prompt, and cvs-examine. Default is none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 For example set this to \"-j VENDOR_PREV_RELEASE -j VENDOR_TOP_RELEASE\" to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 perform an update after a new vendor release has been imported.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 To restrict the update to the current working directory, set this to \"-l\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (defvar cvs-update-prog-output-skip-regexp "$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 "*A regexp that matches the end of the output from all cvs update programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 That is, output from any programs that are run by CVS (by the flag -u in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 `modules' file - see cvs(5)) when `cvs update' is performed should terminate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 with a line that this regexp matches. It is enough that some part of the line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 is matched.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 The default (a single $) fits programs without output.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;; --------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;;; The variables below are used internally by pcl-cvs. You should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;;; never change them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (defvar cvs-buffers-to-delete nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 "List of temporary buffers that should be discarded as soon as possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 Due to a bug in emacs 18.57 the sentinel can't discard them reliably.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (defvar cvs-update-running nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 "This is set to nil when no process is running, and to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 the process when a cvs update process is running.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (defvar cvs-cookie-handle nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "Handle for the cookie structure that is displayed in the *cvs* buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (defvar cvs-commit-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 "Used internally by pcl-cvs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;;; The cvs data structure:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;; When the `cvs update' is ready we parse the output. Every file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;;; that is affected in some way is added as a cookie of fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;;; (as defined below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;;; cvs-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;;; Constructor:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (defun cvs-create-fileinfo (type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 full-log)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 "Create a fileinfo from all parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 Arguments: TYPE DIR FILE-NAME FULL-LOG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 A fileinfo is a vector with the following fields:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 [0] handled True if this file doesn't require further action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 [1] marked t/nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 [2] type One of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 UPDATED - file copied from repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 PATCHED - file update with patch from repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 MODIFIED - modified by you, unchanged in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ADDED - added by you, not yet committed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 REMOVED - removed by you, not yet committed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 CVS-REMOVED- removed, since file no longer exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 MERGED - successful merge
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 CONFLICT - conflict when merging (if pcl-cvs did it)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 REM-CONFLICT-removed in repository, but altered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 MOD-CONFLICT-removed locally, changed in repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 REM-EXIST - removed locally, but still exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 DIRCHANGE - A change of directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 UNKNOWN - An unknown file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 UNKNOWN-DIR- An unknown directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 MOVE-AWAY - A file that is in the way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 REPOS-MISSING- The directory has vanished from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 MESSAGE - This is a special fileinfo that is used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 to display a text that should be in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 full-log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 [3] dir Directory the file resides in. Should not end with slash.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 [4] file-name The file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 [5] backup-file The name of a backup file created during a merge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 [6] base-revision The revision that the working file was based on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 [7] head-revision The revision that the newly merged changes came from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 [8] backup-revision The revision of the cvs backup file (original working rev.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 [9] cvs-diff-buffer A buffer that contains a 'cvs diff file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 [10] vendor-diff-buffer A buffer that contains a 'diff base-file head-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 [11] backup-diff-buffer A buffer that contains a 'diff file backup-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 [12] full-log The output from cvs, unparsed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 [13] mod-time Modification time of file used for *-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 'CVS-FILEINFO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (vector nil nil type dir file-name nil nil nil nil nil nil nil full-log nil nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;;; Selectors:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (defun cvs-fileinfo->handled (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 "Get the `handled' field from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (elt (cdr cvs-fileinfo) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (defun cvs-fileinfo->marked (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 "Check if CVS-FILEINFO is marked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (elt (cdr cvs-fileinfo) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (defun cvs-fileinfo->type (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 "Get type from CVS-FILEINFO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 Type is one of UPDATED, PATCHED, MODIFIED, ADDED, REMOVED, CVS-REMOVED, MERGED,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 CONFLICT, REM-CONFLICT, MOD-CONFLICT, REM-EXIST, DIRCHANGE, UNKNOWN,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 UNKNOWN-DIR, MOVE-AWAY, REPOS-MISSING or MESSAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (elt (cdr cvs-fileinfo) 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (defun cvs-fileinfo->dir (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 "Get dir from CVS-FILEINFO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 The directory name does not end with a slash."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (elt (cdr cvs-fileinfo) 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (defun cvs-fileinfo->file-name (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 "Get file-name from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (elt (cdr cvs-fileinfo) 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (defun cvs-fileinfo->backup-file (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 "Get backup-file from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (elt (cdr cvs-fileinfo) 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (defun cvs-fileinfo->base-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 "Get the base revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (elt (cdr cvs-fileinfo) 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (defun cvs-fileinfo->head-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 "Get the head revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (elt (cdr cvs-fileinfo) 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (defun cvs-fileinfo->backup-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 "Get the backup revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (elt (cdr cvs-fileinfo) 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (defun cvs-fileinfo->cvs-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 "Get cvs-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (elt (cdr cvs-fileinfo) 9))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (defun cvs-fileinfo->vendor-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 "Get backup-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (elt (cdr cvs-fileinfo) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (defun cvs-fileinfo->backup-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 "Get backup-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (elt (cdr cvs-fileinfo) 11))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (defun cvs-fileinfo->full-log (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 "Get full-log from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (elt (cdr cvs-fileinfo) 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (defun cvs-fileinfo->mod-time (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 "Get mod-time from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (elt (cdr cvs-fileinfo) 13))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;;; Modifiers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (defun cvs-set-fileinfo->handled (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 "Set handled in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (aset (cdr cvs-fileinfo) 0 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (defun cvs-set-fileinfo->marked (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 "Set marked in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (aset (cdr cvs-fileinfo) 1 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (defun cvs-set-fileinfo->type (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 "Set type in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (aset (cdr cvs-fileinfo) 2 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (defun cvs-set-fileinfo->dir (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 "Set dir in CVS-FILEINFO to NEWVAL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 The directory should now end with a slash."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (aset (cdr cvs-fileinfo) 3 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (defun cvs-set-fileinfo->file-name (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 "Set file-name in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (aset (cdr cvs-fileinfo) 4 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defun cvs-set-fileinfo->backup-file (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "Set backup-file in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (aset (cdr cvs-fileinfo) 5 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (defun cvs-set-fileinfo->base-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 "Set base-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (aset (cdr cvs-fileinfo) 6 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (defun cvs-set-fileinfo->head-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 "Set head-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (aset (cdr cvs-fileinfo) 7 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (defun cvs-set-fileinfo->backup-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "Set backup-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (aset (cdr cvs-fileinfo) 8 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (defun cvs-set-fileinfo->cvs-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 "Set cvs-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (aset (cdr cvs-fileinfo) 9 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (defun cvs-set-fileinfo->vendor-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 "Set vendor-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (aset (cdr cvs-fileinfo) 10 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defun cvs-set-fileinfo->backup-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Set backup-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (aset (cdr cvs-fileinfo) 11 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (defun cvs-set-fileinfo->full-log (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 "Set full-log in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (aset (cdr cvs-fileinfo) 12 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (defun cvs-set-fileinfo->mod-time (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 "Set full-log in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (aset (cdr cvs-fileinfo) 13 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;;; Predicate:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (defun cvs-fileinfo-p (object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 "Return t if OBJECT is a cvs-fileinfo."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (eq (car-safe object) 'CVS-FILEINFO))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;;;; End of types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (defun cvs-use-temp-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 "Display a temporary buffer in another window and select it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 The selected window will not be changed. The temporary buffer will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 be erased and writable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (let ((dir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (display-buffer (get-buffer-create cvs-temp-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (set-buffer cvs-temp-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (setq default-directory dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (erase-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (defun cvs-examine (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 "Run a 'cvs -n update' in the current working directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 That is, check what needs to be done, but don't change the disc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Feed the output to a *cvs* buffer and run cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 WARNING: this doesn't work very well yet...."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;; TODO: this should do everything cvs-update does...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;; for example, for CONFLICT files, it should setup fileinfo appropriately
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (interactive (list (read-file-name "CVS Update (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (cvs-do-update directory local 'noupdate))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (defun cvs-update (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 "Run a 'cvs update' in the current working directory. Feed the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 output to a *cvs* buffer and run cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (interactive (list (read-file-name "CVS Update (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (cvs-do-update directory local nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (switch-to-buffer cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (defun cvs-update-other-window (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 "Run a 'cvs update' in the current working directory. Feed the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 output to a *cvs* buffer, display it in the other window, and run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (interactive (list (read-file-name "CVS Update other window (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (cvs-do-update directory local nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (switch-to-buffer-other-window cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defun cvs-filter (predicate list &rest extra-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 "Apply PREDICATE to each element on LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 Args: PREDICATE LIST &rest EXTRA-ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 Return a new list consisting of those elements that PREDICATE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 returns non-nil for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 If more than two arguments are given the remaining args are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 passed to PREDICATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;; Avoid recursion - this should work for LONG lists also!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (let* ((head (cons 'dummy-header nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (tail head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (if (apply predicate (car list) extra-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (setq tail (setcdr tail (list (car list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (cdr head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (defun cvs-mode-update-no-prompt ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 "Run cvs update in current directory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (cvs-do-update default-directory nil nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (defun cvs-do-update (directory local dont-change-disc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 "Do a 'cvs update' in DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 Args: DIRECTORY LOCAL DONT-CHANGE-DISC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 If LOCAL is non-nil 'cvs update -l' is executed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 If DONT-CHANGE-DISC is non-nil 'cvs -n update' is executed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 Both LOCAL and DONT-CHANGE-DISC may be non-nil simultaneously.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 *Note*: DONT-CHANGE-DISC does not yet work. The parser gets confused."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;; Ensure that it is safe to do an update. If not, ask user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;; for confirmation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (if (and (boundp 'cvs-cookie-handle) (collection-buffer cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (if (collection-collect-tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 '(lambda (cookie) (eq (cvs-fileinfo->type cookie) 'CONFLICT)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (if (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 "Only update if conflicts have been resolved. Continue? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (error "Update aborted by user request."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (if (not (file-exists-p cvs-program))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (error "%s: file not found (check setting of cvs-program)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 cvs-program))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (let* ((this-dir (file-name-as-directory (expand-file-name directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (update-buffer (generate-new-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (concat " " (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (substring this-dir 0 -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 "-update")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (temp-name (make-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (or (getenv "TMPDIR") "/tmp"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 "pcl-cvs.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (args nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ;; Check that this-dir exists and is a directory that is under CVS contr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (if (not (file-directory-p this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (error "%s is not a directory." this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (if (not (file-directory-p (concat this-dir "CVS")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (error "%s does not contain CVS controlled files." this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (if (file-readable-p (concat this-dir "CVS/Root"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (save-excursion ; read CVS/Root into cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (find-file (concat this-dir "CVS/Root"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq cvs-cvsroot (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (if (not cvs-cvsroot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (error "Invalid contents of %sCVS/Root" this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (if (and cvs-cvsroot-required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (not (or (getenv "CVSROOT") cvs-cvsroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (error "Both cvs-cvsroot and environment variable CVSROOT are unset, and no CVS/Root.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;; Check that at most one `cvs update' is run at any time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (if (and cvs-update-running (process-status cvs-update-running)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (or (eq (process-status cvs-update-running) 'run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (eq (process-status cvs-update-running) 'stop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (error "Can't run two `cvs update' simultaneously."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (if (not (listp cvs-update-optional-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (error "cvs-update-optional-flags should be set using cvs-set-update-optional-flags"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;; Generate "-d /master -n update -l".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (setq args (concat (if cvs-cvsroot (concat " -d " cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (if dont-change-disc " -n ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 " update "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (if local " -l ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (if cvs-update-optional-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (copy-sequence cvs-update-optional-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;; Set up the buffer that receives the stderr output from "cvs update".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (set-buffer update-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (setq default-directory this-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (make-local-variable 'cvs-stdout-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (setq cvs-stdout-file temp-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (setq cvs-update-running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (let ((process-connection-type nil)) ; Use a pipe, not a pty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (start-process "cvs" update-buffer cvs-shell "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (concat cvs-program " " args " > " temp-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (symbol-name (process-status cvs-update-running))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (redraw-modeline) ; Update the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (set-process-sentinel cvs-update-running 'cvs-sentinel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (set-process-filter cvs-update-running 'cvs-update-filter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (set-marker (process-mark cvs-update-running) (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (set-buffer (get-buffer-create cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (cvs-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (setq cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (collection-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 cvs-buffer-name 'cvs-pp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 cvs-startup-message ;See comment above cvs-startup-message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 "---------- End -----"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (cookie-enter-first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 'MESSAGE nil nil (concat "\n Running `cvs " args "' in " this-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 "...\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (symbol-name (process-status cvs-update-running))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (redraw-modeline) ; Update the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (setq buffer-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;; Work around a bug in emacs 18.57 and earlier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (setq cvs-buffers-to-delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (cvs-delete-unused-temporary-buffers cvs-buffers-to-delete)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; The following line is said to improve display updates on some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;; emacses. It shouldn't be needed, but it does no harm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (sit-for 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (defun cvs-delete-unused-temporary-buffers (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 "Delete all buffers on LIST that is not visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 Return a list of all buffers that still is alive."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ((null list) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ((get-buffer-window (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (cons (car list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (cvs-delete-unused-temporary-buffers (cdr list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (kill-buffer (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (cvs-delete-unused-temporary-buffers (cdr list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (put 'cvs-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (defun cvs-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 "\\<cvs-mode-map>Mode used for pcl-cvs, a front-end to CVS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 To get to the \"*cvs*\" buffer you should use ``\\[execute-extended-command] cvs-update''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 Full documentation is in the Texinfo file. Here are the most useful commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 \\[cvs-mode-previous-line] Move up. \\[cvs-mode-next-line] Move down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 \\[cvs-mode-commit] Commit file. \\[cvs-mode-update-no-prompt] Re-update directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 \\[cvs-mode-mark] Mark file/dir. \\[cvs-mode-unmark] Unmark file/dir.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 \\[cvs-mode-mark-all-files] Mark all files. \\[cvs-mode-unmark-all-files] Unmark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 \\[cvs-mode-find-file] Edit file/run Dired. \\[cvs-mode-find-file-other-window] Find file or run Dired in other window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 \\[cvs-mode-ignore] Add file to ./.cvsignore. \\[cvs-mode-add-change-log-entry-other-window] Write ChangeLog in other window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 \\[cvs-mode-add] Add to repository. \\[cvs-mode-remove-file] Remove file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 \\[cvs-mode-diff-cvs] Diff with base revision. \\[cvs-mode-diff-backup] Diff backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 \\[cvs-mode-ediff] Ediff base rev & backup. \\[cvs-mode-diff-vendor] Show merge from vendor branch.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 \\[cvs-mode-emerge] Emerge base rev & backup. \\[cvs-mode-diff-backup] Diff backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 \\[cvs-mode-acknowledge] Delete line from buffer. \\[cvs-mode-remove-handled] Remove processed entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 \\[cvs-mode-log] Run ``cvs log''. \\[cvs-mode-status] Run ``cvs status''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 \\[cvs-mode-tag] Run ``cvs tag''. \\[cvs-mode-rtag] Run ``cvs rtag''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 \\[cvs-mode-changelog-commit] Like \\[cvs-mode-commit], but get default log text from ChangeLog.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 \\[cvs-mode-undo-local-changes] Revert the last checked in version - discard your changes to the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 Entry to this mode runs cvs-mode-hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 This description is updated for release 1.05-CVS-$Name: r19-14 $ of pcl-cvs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 All bindings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 \\{cvs-mode-map}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (setq major-mode 'cvs-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (setq mode-name "CVS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (setq mode-line-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 ;; for older v18 emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ;;(buffer-flush-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (make-local-variable 'goal-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (setq goal-column cvs-cursor-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (use-local-map cvs-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (run-hooks 'cvs-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (defun cvs-sentinel (proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 "Sentinel for the cvs update process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 This is responsible for parsing the output from the cvs update when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 it is finished."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 ((null (buffer-name (process-buffer proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 ;; buffer killed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (set-process-buffer proc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ((memq (process-status proc) '(signal exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (let* ((obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (omax (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (opoint (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 ;; save-excursion isn't the right thing if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 ;; process-buffer is current-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (symbol-name (process-status proc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (let* ((out-file cvs-stdout-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (stdout-buffer (find-file-noselect out-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (set-buffer stdout-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (rename-buffer (concat " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (file-name-nondirectory out-file)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (cvs-parse-update stdout-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (setq cvs-buffers-to-delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (cons (process-buffer proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (cons stdout-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 cvs-buffers-to-delete)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (delete-file out-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (message "CVS update process has completed.") ; XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (set-buffer-modified-p (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (setq cvs-update-running nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (if (equal obuf (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (if (< opoint omax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (goto-char opoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (set-buffer obuf))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (defun cvs-update-filter (proc string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 "Filter function for pcl-cvs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 This function gets the output that CVS sends to stderr. It inserts it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 into (process-buffer proc) but it also checks if CVS is waiting for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 lock file. If so, it inserts a message cookie in the *cvs* buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (let ((old-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (data (match-data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ;; Insert the text, moving the process-marker.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (goto-char (process-mark proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (insert string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (set-marker (process-mark proc) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 ;; Delete any old lock message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (if (tin-nth cvs-cookie-handle 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (tin-delete cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (tin-nth cvs-cookie-handle 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 ;; Check if CVS is waiting for a lock.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (beginning-of-line 0) ;Move to beginning of last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 ;complete line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 "^cvs \\(update\\|server\\): \\[..:..:..\\] waiting for \\(.*\\)lock in \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (setq cvs-lock-file (buffer-substring (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (cookie-enter-last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 'MESSAGE nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (concat "\tWaiting for "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 "lock in " cvs-lock-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ".\n\t (type M-x cvs-delete-lock to delete it)")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (store-match-data data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (set-buffer old-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (defun cvs-delete-lock ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 "Delete the lock file that CVS is waiting for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 Note that this can be dangerous. You should only do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 if you are convinced that the process that created the lock is dead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ((not (or (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (concat (file-name-as-directory cvs-lock-file) "#cvs.lock"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (cvs-filter (function cvs-lock-file-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (directory-files cvs-lock-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (error "No lock files found."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 ((yes-or-no-p (concat "Really delete locks in " cvs-lock-file "? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 ;; Re-read the directory -- the locks might have disappeared.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (let ((locks (cvs-filter (function cvs-lock-file-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (directory-files cvs-lock-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (while locks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (delete-file (concat (file-name-as-directory cvs-lock-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (car locks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (setq locks (cdr locks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (cvs-remove-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (concat (file-name-as-directory cvs-lock-file) "#cvs.lock"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (defun cvs-remove-directory (dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 "Remove a directory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (if (file-directory-p dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (call-process cvs-rmdir-program nil nil nil dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (error "Not a directory: %s" dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (if (file-exists-p dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (error "Could not remove directory %s" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (defun cvs-lock-file-p (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 "Return true if FILE looks like a CVS lock file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (string-match "^#cvs.tfl.[0-9]+$" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (string-match "^#cvs.rfl.[0-9]+$" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (string-match "^#cvs.wfl.[0-9]+$" file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (defun cvs-quote-multiword-string (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 "Return STR surrounded in single quotes if it contains whitespace."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (cond ((string-match "[ \t\n]" str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (concat "'" str "'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 ;; this should be in subr.el or some similar place....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (defun parse-string (str &optional regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 "Explode the string STR into a list of words ala strtok(3). Optional REGEXP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 defines regexp matching word separator, which defaults to \"[ \\t\\n]+\"."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (let (str-list ; new list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 str-token ; "index" of next token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (str-start 0) ; "index" of current token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (str-sep (if regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 "[ \t\n]+")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (while (setq str-token (string-match str-sep str str-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (setq str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (nconc str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (list (substring str str-start str-token))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (setq str-start (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ;; tag on the remainder as the final item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (if (not (>= str-start (length str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (setq str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (nconc str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (list (substring str str-start)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 str-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (defun cvs-make-list (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 "Return list of words made from the string STR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (cond ((string-match "[ \t\n]+" str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (let ((new-str (parse-string str "[ \t\n]+")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; this is ugly, but assume if the first element is empty, there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; no more elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (cond ((string= (car new-str) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 new-str))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ((string= str "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (list str))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (defun cvs-skip-line (stdout stderr regexp &optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 "Like forward-line, but check that the skipped line matches REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 Args: STDOUT STDERR REGEXP &optional ARG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 If it doesn't match REGEXP a bug report is generated and displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 STDOUT and STDERR is only used to do that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 If optional ARG, a number, is given the ARGth parenthesized expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 in the REGEXP is returned as a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 Point should be in column 1 when this function is called."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 ((looking-at regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (if arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (buffer-substring (match-beginning arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (match-end arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (cvs-parse-error stdout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 stderr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (if (eq (current-buffer) stdout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 'STDOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 'STDERR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 regexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (defun cvs-get-current-dir (root-dir dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 "Return current working directory, suitable for cvs-parse-update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 Args: ROOT-DIR DIRNAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 Concatenates ROOT-DIR and DIRNAME to form an absolute path."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (if (string= "." dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (substring root-dir 0 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (concat root-dir dirname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (defun cvs-compare-fileinfos (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 "Compare fileinfo A with fileinfo B and return t if A is `less'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 ;; Sort acording to directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ((string< (cvs-fileinfo->dir a) (cvs-fileinfo->dir b)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 ((not (string= (cvs-fileinfo->dir a) (cvs-fileinfo->dir b))) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 ;; The DIRCHANGE entry is always first within the directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ((and (eq (cvs-fileinfo->type a) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (not (eq (cvs-fileinfo->type b) 'DIRCHANGE))) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 ((and (eq (cvs-fileinfo->type b) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (not (eq (cvs-fileinfo->type a) 'DIRCHANGE))) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 ;; All files are sorted by file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 ((string< (cvs-fileinfo->file-name a) (cvs-fileinfo->file-name b)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (defun cvs-parse-error (stdout-buffer stderr-buffer err-buf pos &optional indicator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 "Handle a parse error when parsing the output from cvs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 Args: STDOUT-BUFFER STDERR-BUFFER ERR-BUF POS &optional INDICATOR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 ERR-BUF should be 'STDOUT or 'STDERR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (setq pos (1- pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (insert "To: " pcl-cvs-bugs-address "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (insert "Subject: pcl-cvs release" pcl-cvs-version " parse error.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (insert (concat mail-header-separator "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (insert "This bug report is automatically generated by pcl-cvs\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (insert "because it doesn't understand some output from CVS. Below\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (insert "is detailed information about the error. Please send\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (insert "this, together with any information you think might be\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (insert "useful for me to fix the bug, to the address above. But\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (insert "please check the \"known problems\" section of the\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (insert "documentation first. Note that this buffer contains\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (insert "information that you might consider confidential. You\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (insert "are encouraged to read through it before sending it.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (insert "Press C-c C-c to send this email.\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (insert "Please state the version of these programs you are using:\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (insert "RCS: \ndiff: \n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (let* ((stdout (save-excursion (set-buffer stdout-buffer) (buffer-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (stderr (save-excursion (set-buffer stderr-buffer) (buffer-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (errstr (if (eq err-buf 'STDOUT) stdout stderr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (errline-end (string-match "\n" errstr pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (errline (substring errstr pos errline-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (insert (format "Offending line (%d chars): >" (- errline-end pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (insert errline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (insert "<\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (insert "Sent to " (symbol-name err-buf) " at pos " (format "%d\n" pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (if indicator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (insert "Optional args: \"" indicator "\".\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (insert "\nEmacs-version: " (emacs-version) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (insert "Pcl-cvs Version: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 "@(#)OrigId: pcl-cvs.el,v 1.93 1993/05/31 22:44:00 ceder Exp\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (insert "CVS Version: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 "@(#)cvs/contrib/pcl-cvs:$Name: r19-14 $:$Id: pcl-cvs.el,v 1.1.1.1 1996/12/18 03:32:27 steve Exp $\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (insert (format "--- Contents of stdout buffer (%d chars) ---\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (length stdout)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (insert stdout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (insert "--- End of stdout buffer ---\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (insert (format "--- Contents of stderr buffer (%d chars) ---\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (length stderr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (insert stderr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (insert "--- End of stderr buffer ---\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (insert "\nEnd of bug report.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (require 'sendmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (error "CVS parse error - please report this bug.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (defun cvs-parse-update (stdout-buffer stderr-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 "Parse the output from `cvs update'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 Args: STDOUT-BUFFER STDERR-BUFFER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 This functions parses the from `cvs update' (which should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 separated in its stdout- and stderr-components) and prints a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 pretty representation of it in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 Signals an error if unexpected output was detected in the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (let* ((head (cons 'dummy nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (tail (cvs-parse-stderr stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 head default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (root-dir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (cvs-parse-stdout stdout-buffer stderr-buffer tail root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (setq head (sort (cdr head) (function cvs-compare-fileinfos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (collection-clear cvs-cookie-handle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (collection-append-cookies cvs-cookie-handle head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (cvs-remove-stdout-shadows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (if cvs-auto-remove-handled-directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (cvs-remove-empty-directories))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (cvs-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 ;; XEmacs - tedium should let you know when it's ended...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (if (pos-visible-in-window-p (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 nil ; assume that the user will see it...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (ding t 'ready)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (message "CVS update is ready."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (tin-goto-previous cvs-cookie-handle (point-min) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (setq default-directory root-dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (defun cvs-remove-stdout-shadows ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 "Remove entries in the *cvs* buffer that comes from both stdout and stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 If there is two entries for a single file the second one should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 deleted. (Remember that sort uses a stable sort algorithm, so one can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 be sure that the stderr entry is always first)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (collection-filter-tins cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (not (cvs-shadow-entry-p tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (defun cvs-shadow-entry-p (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 "Return non-nil if TIN is a shadow entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 Args: TIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 A TIN is a shadow entry if the previous tin contains the same file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (let* ((previous-tin (tin-previous cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (curr (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (prev (and previous-tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (tin-cookie cvs-cookie-handle previous-tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 prev curr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (string= (cvs-fileinfo->file-name prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (cvs-fileinfo->file-name curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (string= (cvs-fileinfo->dir prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (cvs-fileinfo->dir curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (and (eq (cvs-fileinfo->type prev) 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (eq (cvs-fileinfo->type curr) 'CONFLICT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (and (eq (cvs-fileinfo->type prev) 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (eq (cvs-fileinfo->type curr) 'MODIFIED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (and (eq (cvs-fileinfo->type prev) 'REM-EXIST)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (eq (cvs-fileinfo->type curr) 'REMOVED))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (defun cvs-find-backup-file (filename &optional dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 "Look for a backup file for FILENAME, optionally in directory DIRNAME, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 there is one, return the name of the first file found as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (if (eq dirname nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (setq dirname default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (car (directory-files dirname nil (concat "^\\" cvs-bakprefix filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 "\\."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (defun cvs-find-backup-revision (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 "Take FILENAME as the name of a cvs backup file and return the revision of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 that file as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (substring filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (+ 1 (string-match "\\.\\([0-9.]+\\)$" filename))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (defun cvs-parse-stderr (stdout-buffer stderr-buffer head dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 "Parse the output from CVS that is written to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 Args: STDOUT-BUFFER STDERR-BUFFER HEAD DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 STDOUT-BUFFER holds the output that cvs sent to stdout. It is only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 used to create a bug report in case there is a parse error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 STDERR-BUFFER is the buffer that holds the output to parse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 HEAD is a cons-cell, the head of the list that is built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 DIR is the directory the `cvs update' was run in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 This function returns the last cons-cell in the list that is built."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (set-buffer stderr-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (let ((current-dir dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (root-dir dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; CVS is descending a subdirectory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 "^cvs \\(server\\|update\\): Updating \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (setq current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (cvs-get-current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 root-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (buffer-substring (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 'DIRCHANGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 "." ; the old version had nil here???
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 ;; File removed, since it is removed (by third party) in repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 ((or (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 "^cvs \\(update\\|server\\): warning: \\(.*\\) is not (any longer) pertinent")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 "^cvs \\(update\\|server\\): \\(.*\\) is no longer in the repository"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 'CVS-REMOVED
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 ;; File removed by you, but recreated by cvs. Ignored. Will say
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 ;; "Updated" on the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 "^cvs \\(update\\|server\\): warning: .* was lost$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 ;; File unknown for some reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 ;; FIXME: is it really a good idea to add this as unknown here?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 "cvs \\(update\\|server\\): nothing known about \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (let ((filename (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (if (file-directory-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 'UNKNOWN-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 'UNKNOWN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (file-name-nondirectory filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (match-end 0)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 ;; A file that has been created by you, but added to the cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 ;; repository by another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 "^cvs \\(update\\|server\\): move away \\(.*\\); it is in the way$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 'MOVE-AWAY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 ;; Cvs waits for a lock. Ignore.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 "^cvs \\(update\\|server\\): \\[..:..:..\\] waiting for .*lock in ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 ;; File removed in repository, but edited by you.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 "^cvs \\(update\\|server\\): conflict: \\(.*\\) is modified but no longer in the repository$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (setcdr head (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 'REM-CONFLICT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 ;; File removed in repository, but edited by someone else.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 "^cvs \\(update\\|server\\): conflict: removed \\(.*\\) was modified by second party")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (setcdr head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 'MOD-CONFLICT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 ;; File removed in repository, but not in local directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 "^cvs \\(update\\|server\\): \\(.*\\) should be removed and is still there")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (setcdr head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 'REM-EXIST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ;; Error searching for repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 "^cvs \\(update\\|server\\): in directory ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (regexp-quote "cvs [update aborted]: there is no repository "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 'REPOS-MISSING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (buffer-substring start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 ;; Silly warning from attempted conflict resolution. Ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 ;; FIXME: Should it be?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 ;; eg.: "cvs update: cannot find revision APC-web-update in file .cvsignore"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 "^cvs \\(update\\|server\\): cannot find revision \\(.*\\) in file \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (message "%s" (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 ;; CVS has decided to merge someone elses changes into this document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 ;; About to start an rcsmerge operation...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 "^RCS file: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 ;; skip the "RCS file:" line...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 (let ((complex-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 base-revision ; the first revision retrieved to merge from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 head-revision ; the second revision retrieved to merge from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 filename ; the name of the file being merged
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 backup-file ; the name of the backup of the working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 backup-revision) ; the revision of the original working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 (setq base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 "^retrieving revision \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (setq head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 "^retrieving revision \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (setq filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 "^Merging differences between [0-9.]+ and [0-9.]+ into \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (setq backup-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (cvs-find-backup-file filename current-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (setq backup-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (cvs-find-backup-revision backup-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 ;; Was there a conflict during the merge?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 ;;;; From CVS-1.3 & RCS-5.6.0.1 with GNU-Diffutils-2.5:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 ;;;; "cvs update -j OLD-REV -j NEW-REV ."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 ;; RCS file: /big/web-CVS/apc/cmd/Main/logout.sh,v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 ;; retrieving revision 1.1.1.1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 ;; retrieving revision 1.1.1.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 ;; Merging differences between 1.1.1.1 and 1.1.1.2 into logout.sh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 ;; rcsmerge warning: overlaps during merge
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 ;; Allow both RCS 5.5 and 5.6. (5.6 prints "rcs" and " warning").
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 "^\\(rcs\\)?merge[:]*\\( warning\\)?: \\((overlaps\\|conflicts\\) during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 ;; Yes, this is a conflict.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 "^\\(rcs\\)?merge[:]*\\( warning\\)?: \\(overlaps\\|conflicts\\) during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 ;; this line doesn't seem to appear in all cases -- perhaps only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 ;; in "-j A -j B" usage, in which case this indicates ????
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 "^cvs \\(update\\|server\\): conflicts found in ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 'CONFLICT current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 ;; squirrel away info about the files that were retrieved for merging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (cvs-set-fileinfo->base-revision fileinfo base-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (cvs-set-fileinfo->head-revision fileinfo head-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (cvs-set-fileinfo->backup-revision fileinfo backup-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (cvs-set-fileinfo->backup-file fileinfo backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 ;; Was it a conflict, and was RCS compiled without DIFF3_BIN, in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 ;; which case this is a failed conflict resolution?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 ;; Allow both RCS 5.5 and 5.6. (5.6 prints "rcs" and " warning").
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 "^\\(rcs\\)?merge\\( warning\\)?: overlaps or other problems during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 "^\\(rcs\\)?merge\\( warning\\)?: overlaps or other problems during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 "^cvs update: could not merge ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 "^cvs update: restoring .* from backup file ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 'CONFLICT current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 ;; Not a conflict; it must be a succesful merge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 'MERGED current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (cvs-set-fileinfo->base-revision fileinfo base-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (cvs-set-fileinfo->head-revision fileinfo head-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (cvs-set-fileinfo->backup-revision fileinfo backup-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (cvs-set-fileinfo->backup-file fileinfo backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 (setq head (cdr head)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 ;; Error messages from CVS (incomplete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 "^cvs \\(update\\|server\\): \\(invalid option .*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (error "Interface problem with CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (buffer-substring (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 ;; network errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 ;; Kerberos connection attempted but failed. This is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 ;; really an error, as CVS will automatically fall back to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 ;; rsh. Plus it tries kerberos, if available, even when rsh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 ;; is what you really wanted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 "^cvs update: kerberos connect:.*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (message "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 ;; And when kerberos *does* fail, cvs prints out some stuff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ;; as it tries rsh. Ignore that stuff too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 "^cvs update: trying to start server using rsh$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 "^\\([^:]*\\) Connection timed out")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 "^Permission denied.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 "^cvs \\[update aborted\\]: premature end of file from server")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 ;; Empty line. Probably inserted by mistake by user (or developer :-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 ;; Ignore.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 "^$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 ;; top-level parser (cond) default clause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 "^UN-MATCHABLE-OUTPUT"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 ;; cause this function to return the head of the parser output list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (defun cvs-parse-stdout (stdout-buffer stderr-buffer head root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 "Parse the output from CVS that is written to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 Args: STDOUT-BUFFER STDERR-BUFFER HEAD ROOT-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 STDOUT-BUFFER is the buffer that holds the output to parse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 STDERR-BUFFER holds the output that cvs sent to stderr. It is only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 used to create a bug report in case there is a parse error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 HEAD is a cons-cell, the head of the list that is built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 ROOT-DIR is the directory the `cvs update' was run in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 This function doesn't return anything particular."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (set-buffer stdout-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 ;; M: The file is modified by the user, and untouched in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ;; A: The file is "cvs add"ed, but not "cvs ci"ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 ;; R: The file is "cvs remove"ed, but not "cvs ci"ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 ;; C: Conflict (only useful if a join was done and stderr has info...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 ;; U: The file is copied from the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ;; ?: Unknown file or directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 "^\\([MARCUP?]\\) \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (let*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 ((c (char-after (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (full-path (concat (file-name-as-directory root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (isdir (file-directory-p full-path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (fileinfo (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 (cond ((eq c ?M) 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 ((eq c ?A) 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 ((eq c ?R) 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 ((eq c ?C) 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ((eq c ?U) 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 ((eq c ?P) 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 ((eq c ??) (if isdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 'UNKNOWN-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 'UNKNOWN)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (substring (file-name-directory full-path) 0 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 (file-name-nondirectory full-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (buffer-substring (match-beginning 0) (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 ;; Updated and Patched files require no further action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (if (memq c '(?U ?P))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 (cvs-set-fileinfo->handled fileinfo t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 ;; Link this last on the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 ;; Executing a program because of the -u option in modules.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 "^cvs \\(update\\|server\\): Executing")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 ;; Skip by any output the program may generate to stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 ;; Note that pcl-cvs will get seriously confused if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 ;; program prints anything to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (re-search-forward cvs-update-prog-output-skip-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (cvs-parse-error stdout-buffer stderr-buffer 'STDOUT (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 "cvs-parse-stdout"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (defun cvs-pp (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 "Pretty print FILEINFO. Insert a printed representation in current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 For use by the cookie package."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (let ((a (cvs-fileinfo->type fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 (s (if (cvs-fileinfo->marked fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 "*" " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (f (cvs-fileinfo->file-name fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (ci (if (cvs-fileinfo->handled fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 " " "ci")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 ((eq a 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (format "%s Updated %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 ((eq a 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (format "%s Patched %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 ((eq a 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 (format "%s Modified %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 ((eq a 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 (format "%s Merged %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 ((eq a 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 (format "%s Conflict %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 ((eq a 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (format "%s Added %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ((eq a 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (format "%s Removed %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 ((eq a 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 (format "%s Unknown %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 ((eq a 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (format "%s Unknown dir %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 ((eq a 'CVS-REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (format "%s Removed from repository: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 ((eq a 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 (format "%s Conflict: Removed from repository, changed by you: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 ((eq a 'MOD-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 (format "%s Conflict: Removed by you, changed in repository: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 ((eq a 'REM-EXIST)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 (format "%s Conflict: Removed by you, but still exists: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 ((eq a 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 (format "\nIn directory %s:" (cvs-fileinfo->dir fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 ((eq a 'MOVE-AWAY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (format "%s Move away %s - it is in the way" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 ((eq a 'REPOS-MISSING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 (format " This repository directory is missing! Remove this directory manually."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 ((eq a 'MESSAGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (cvs-fileinfo->full-log fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (format "%s Internal error! %s" s f))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 ;;; You can define your own keymap in .emacs. pcl-cvs.el won't overwrite it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (if cvs-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (setq cvs-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (suppress-keymap cvs-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (define-prefix-command 'cvs-mode-map-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (define-key cvs-mode-map "\C-?" 'cvs-mode-unmark-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (define-key cvs-mode-map "\C-k" 'cvs-mode-acknowledge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 (define-key cvs-mode-map "\C-n" 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 (define-key cvs-mode-map "\C-p" 'cvs-mode-previous-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 ;; ^C- keys are used to set various flags to control CVS features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 (define-key cvs-mode-map "\C-c" 'cvs-mode-map-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 (define-key cvs-mode-map "\C-cc" 'cvs-change-cvsroot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (define-key cvs-mode-map "\C-cd" 'cvs-set-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 (define-key cvs-mode-map "\C-cl" 'cvs-set-log-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 (define-key cvs-mode-map "\C-cs" 'cvs-set-status-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (define-key cvs-mode-map "\C-cu" 'cvs-set-update-optional-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 ;; M- keys are usually those that operate on modules
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (define-key cvs-mode-map "\M-\C-?" 'cvs-mode-unmark-all-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (define-key cvs-mode-map "\M-C" 'cvs-mode-rcs2log) ; i.e. "Create a ChangeLog"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (define-key cvs-mode-map "\M-a" 'cvs-mode-admin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (define-key cvs-mode-map "\M-c" 'cvs-mode-checkout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (define-key cvs-mode-map "\M-o" 'cvs-mode-checkout-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 (define-key cvs-mode-map "\M-p" 'cvs-mode-rdiff) ; i.e. "create a Patch"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (define-key cvs-mode-map "\M-r" 'cvs-mode-release)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (define-key cvs-mode-map "\M-t" 'cvs-mode-rtag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 ;; keys that operate on files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 (define-key cvs-mode-map " " 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 (define-key cvs-mode-map "?" 'describe-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (define-key cvs-mode-map "A" 'cvs-mode-add-change-log-entry-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (define-key cvs-mode-map "B" 'cvs-mode-byte-compile-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 (define-key cvs-mode-map "C" 'cvs-mode-changelog-commit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 (define-key cvs-mode-map "E" 'cvs-mode-emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 (define-key cvs-mode-map "G" 'cvs-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 (define-key cvs-mode-map "M" 'cvs-mode-mark-all-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (define-key cvs-mode-map "Q" 'cvs-examine)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 (define-key cvs-mode-map "R" 'cvs-mode-revert-updated-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (define-key cvs-mode-map "U" 'cvs-mode-undo-local-changes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (define-key cvs-mode-map "a" 'cvs-mode-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 (define-key cvs-mode-map "b" 'cvs-mode-diff-backup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (define-key cvs-mode-map "c" 'cvs-mode-commit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (define-key cvs-mode-map "d" 'cvs-mode-diff-cvs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (define-key cvs-mode-map "e" 'cvs-mode-ediff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 (define-key cvs-mode-map "f" 'cvs-mode-find-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 (define-key cvs-mode-map "g" 'cvs-mode-update-no-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 (define-key cvs-mode-map "i" 'cvs-mode-ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (define-key cvs-mode-map "l" 'cvs-mode-log)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 (define-key cvs-mode-map "m" 'cvs-mode-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (define-key cvs-mode-map "n" 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (define-key cvs-mode-map "o" 'cvs-mode-find-file-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (define-key cvs-mode-map "p" 'cvs-mode-previous-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (define-key cvs-mode-map "q" 'bury-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (define-key cvs-mode-map "r" 'cvs-mode-remove-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 (define-key cvs-mode-map "s" 'cvs-mode-status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (define-key cvs-mode-map "t" 'cvs-mode-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (define-key cvs-mode-map "u" 'cvs-mode-unmark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 (define-key cvs-mode-map "v" 'cvs-mode-diff-vendor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 (define-key cvs-mode-map "x" 'cvs-mode-remove-handled))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 (defun cvs-get-marked (&optional ignore-marks ignore-contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 "Return a list of all selected tins.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 Args: &optional IGNORE-MARKS IGNORE-CONTENTS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 If there are any marked tins, and IGNORE-MARKS is nil, return them. Otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 if the cursor selects a directory, return all files in it, unless there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 none, in which case just return the directory; or unless IGNORE-CONTENTS is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 nil, in which case also just return the directory. Otherwise return (a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 containing) the file the cursor points to, or an empty list if it doesn't point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 to a file at all."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 ;; Any marked cookies?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 ((and (not ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 (collection-collect-tin cvs-cookie-handle 'cvs-fileinfo->marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 ;; Nope.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 ((and (not ignore-contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 (let ((sel (tin-locate cvs-cookie-handle (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 ;; If a directory is selected, all it members are returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 ((and sel (eq (cvs-fileinfo->type (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 sel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 (let ((retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 (collection-collect-tin cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 'cvs-dir-member-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (cvs-fileinfo->dir (tin-cookie
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 cvs-cookie-handle sel)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (if retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 (list sel))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (list sel))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (list (tin-locate cvs-cookie-handle (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 (defun cvs-dir-member-p (fileinfo dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 "Return true if FILEINFO represents a file in directory DIR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 (string= (cvs-fileinfo->dir fileinfo) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 (defun cvs-dir-empty-p (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 "Return non-nil if TIN is a directory that is empty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 Args: CVS-BUF TIN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (and (eq (cvs-fileinfo->type (tin-cookie cvs-cookie-handle tin)) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (or (not (tin-next cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (eq (cvs-fileinfo->type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 (tin-next cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 'DIRCHANGE))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 (defun cvs-mode-revert-updated-buffers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 "Revert any buffers that are UPDATED, PATCHED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (cookie-map (function cvs-revert-fileinfo) cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 (defun cvs-revert-fileinfo (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 "Revert the buffer that holds the file in FILEINFO if it has changed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 and if the type is UPDATED, PATCHED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (let* ((type (cvs-fileinfo->type fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 (file (cvs-fileinfo->full-path fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (buffer (get-file-buffer file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 ;; For a revert to happen...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 ((and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 ;; ...the type must be one that justifies a revert...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 (or (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 (eq type 'CONFLICT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 ;; ...and the user must be editing the file...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 ((buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 (error "%s: edited since last cvs-update."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 ;; Go ahead and revert the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (t (revert-buffer 'dont-use-auto-save-file 'dont-ask))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 (defun cvs-mode-remove-handled ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 "Remove all lines that are handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 Empty directories are removed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 ;; Pass one: remove files that are handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (collection-filter-cookies cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 (lambda (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 (not (cvs-fileinfo->handled fileinfo)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 ;; Pass two: remove empty directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 (if cvs-auto-remove-handled-directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 (cvs-remove-empty-directories)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (defun cvs-remove-empty-directories ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 "Remove empty directories in the *cvs* buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 (collection-filter-tins cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 (not (cvs-dir-empty-p tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 (defun cvs-mode-mark (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 "Mark a fileinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 Args: POS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 If the fileinfo is a directory, all the contents of that directory are marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 instead. A directory can never be marked. POS is a buffer position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (let* ((tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 (sel (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 ;; Does POS point to a directory? If so, mark all files in that directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 ((eq (cvs-fileinfo->type sel) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (cookie-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 (function (lambda (f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 ((cvs-dir-member-p f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 (cvs-set-fileinfo->marked f t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 t)))) ; Tell cookie to redisplay this cookie.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (cvs-fileinfo->dir sel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (cvs-set-fileinfo->marked sel t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 (tin-goto-next cvs-cookie-handle pos 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 (defun cvs-committable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 "Check if the TIN is committable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 It is committable if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 a) is not handled and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 b) is either MODIFIED, ADDED, REMOVED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (and (not (cvs-fileinfo->handled fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (or (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (eq type 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (eq type 'CONFLICT)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (defun cvs-mode-commit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 "Check in all marked files, or the current file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 The user will be asked for a log message in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 If cvs-erase-input-buffer is non-nil that buffer will be erased.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 Otherwise mark and point will be set around the entire contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 buffer so that it is easy to kill the contents of the buffer with \\[kill-region]."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 (marked (cvs-filter (function cvs-committable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (if (null marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (error "Nothing to commit!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 (pop-to-buffer (get-buffer-create cvs-commit-prompt-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (if cvs-erase-input-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (push-mark (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 (cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (make-local-variable 'cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 (setq cvs-commit-list marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (message "Press C-c C-c when you are done editing."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (defun cvs-edit-done ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 "Commit the files to the repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (if (null cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (error "You have already committed the files"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (if (and (> (point-max) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (/= (char-after (1- (point-max))) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 (or (eq cvs-commit-buffer-require-final-newline t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (and cvs-commit-buffer-require-final-newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 (format "Buffer %s does not end in newline. Add one? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (buffer-name))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (insert ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 (let ((cc-list cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (cc-buffer (get-buffer cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 (msg-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (msg (buffer-substring (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (pop-to-buffer cc-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (bury-buffer msg-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 (message "Committing...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (if (cvs-execute-list cc-list cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 (list "-d" cvs-cvsroot "commit" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (list "commit" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 "Committing %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (error "Something went wrong. Check the %s buffer carefully."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 cvs-temp-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 ;; FIXME: don't do any of this if the commit fails.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 (let ((ccl cc-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 (while ccl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (cvs-after-commit-function (tin-cookie cvs-cookie-handle (car ccl)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (setq ccl (cdr ccl))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (apply 'tin-invalidate cvs-cookie-handle cc-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 (set-buffer msg-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (setq cvs-commit-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 (set-buffer cc-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 (if cvs-auto-remove-handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 (cvs-mode-remove-handled)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 (message "Committing... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 (defun cvs-after-commit-function (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 "Do everything that needs to be done when FILEINFO has been committed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 The fileinfo->handle is set, and if the buffer is present it is reverted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (if cvs-auto-revert-after-commit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 (let* ((file (cvs-fileinfo->full-path fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 (buffer (get-file-buffer file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 ;; For a revert to happen...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 (if buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 ;; ...the user must be editing the file...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (if (not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 ;; ...but it must be unmodified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (revert-buffer 'dont-use-auto-save-file 'dont-ask)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 (defun cvs-execute-list (tin-list program constant-args &optional message-fmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 "Run PROGRAM on all elements on TIN-LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 Args: TIN-LIST PROGRAM CONSTANT-ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 The PROGRAM will be called with pwd set to the directory the files reside
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 in. CONSTANT-ARGS should be a list of strings. The arguments given to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 program will be CONSTANT-ARGS followed by all the files (from TIN-LIST) that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 resides in that directory. If the files in TIN-LIST resides in different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 directories the PROGRAM will be run once for each directory (if all files in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 the same directory appears after each other).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 Any output from PROGRAM will be inserted in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 This function return nil if all went well, or the numerical exit status or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 signal name as a string. Note that PROGRAM might be called several times. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 will return non-nil if something goes wrong, but there is no way to know which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 process that failed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 If MESSAGE-FMT is not nil, then message is called to display progress with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 MESSAGE-FMT as the string. MESSAGE-FMT should contain one %s for the arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 being passed to PROGRAM."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 ;; FIXME: something seems wrong with the error checking here....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (let ((exitstatus nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (while tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 (let ((current-dir (cvs-fileinfo->dir (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (car tin-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 arg-str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 ;; Collect all marked files in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 (while (and tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 (string= current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (cvs-fileinfo->dir (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 (setq arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (cons (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 (tin-cookie cvs-cookie-handle (car tin-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (setq tin-list (cdr tin-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 (setq arg-list (nreverse arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 ;; Execute the command on all the files that were collected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (message message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 (setq default-directory (file-name-as-directory current-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 (nconc (copy-sequence constant-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 arg-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (let ((res (apply 'call-process program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (nconc (copy-sequence constant-args) arg-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 ;; Remember the first, or highest, exitstatus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 (if (and (not (and (integerp res) (zerop res)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 (or (null exitstatus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 (and (integerp exitstatus) (= 1 exitstatus))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 (setq exitstatus res)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (message message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 (nconc (copy-sequence arg-list) '("Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 exitstatus))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 ;;;; +++ not currently used!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 (defun cvs-execute-single-file-list (tin-list extractor program constant-args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 &optional cleanup message-fmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 "Run PROGRAM on all elements on TIN-LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 Args: TIN-LIST EXTRACTOR PROGRAM CONSTANT-ARGS &optional CLEANUP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 The PROGRAM will be called with pwd set to the directory the files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 reside in. CONSTANT-ARGS is a list of strings to pass as arguments to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 PROGRAM. The arguments given to the program will be CONSTANT-ARGS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 followed by the list that EXTRACTOR returns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 EXTRACTOR will be called once for each file on TIN-LIST. It is given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 one argument, the cvs-fileinfo. It can return t, which means ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 this file, or a list of arguments to send to the program.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 If CLEANUP is not nil, the filenames returned by EXTRACTOR are deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 If MESSAGE-FMT is not nil, then message is called to display progress with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 MESSAGE-FMT as the string. MESSAGE-FMT should contain one %s for the arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 being passed to PROGRAM."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 (while tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 (let ((current-dir (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 (arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 (funcall extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 (tin-cookie cvs-cookie-handle (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 ;; Execute the command unless extractor returned t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 (if (eq arg-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 (setq default-directory current-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 (nconc (copy-sequence constant-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 arg-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 (message message-fmt (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (apply 'call-process program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 (nconc (copy-sequence constant-args) arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 (message message-fmt (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 (nconc arg-list '("Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (if cleanup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (while arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 ;;;; (kill-buffer ?????)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 (delete-file (car arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 (setq arg-list (cdr arg-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 (setq tin-list (cdr tin-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 (defun cvs-edit-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 "\\<cvs-edit-mode-map>Mode for editing cvs log messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 Commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 \\[cvs-edit-done] checks in the file when you are ready.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 This mode is based on fundamental mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 (use-local-map cvs-edit-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 (setq major-mode 'cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 (setq mode-name "CVS Log")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 (auto-fill-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 (if cvs-edit-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (setq cvs-edit-mode-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 (define-prefix-command 'cvs-edit-mode-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 (define-key cvs-edit-mode-map "\C-c" 'cvs-edit-mode-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 (define-key cvs-edit-mode-map "\C-c\C-c" 'cvs-edit-done))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 (defun cvs-diffable (tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 "Return a list of all tins on TINS that it makes sense to run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 ``cvs diff'' on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 ;; +++ There is an unnecessary (nreverse) here. Get the list the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 ;; other way around instead!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 (let ((result nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 (while tins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 (let ((type (cvs-fileinfo->type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 (tin-cookie cvs-cookie-handle (car tins)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 (if (or (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 (eq type 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 (eq type 'REMOVED) ;+++Does this line make sense?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 (eq type 'ADDED)) ;+++Does this line make sense?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 (setq result (cons (car tins) result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 (setq tins (cdr tins))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 (nreverse result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 (defun cvs-mode-diff-cvs (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 "Diff the selected files against the head revisions in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 If the variable cvs-diff-ignore-marks is non-nil any marked files will not be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 considered to be selected. An optional prefix argument will invert the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 The flags in the variable cvs-diff-flags will be passed to ``cvs diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 The resulting diffs are placed in the cvs-fileinfo->cvs-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 (message "cvsdiffing...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (let ((marked-file-list (cvs-diffable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (or (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 (car marked-file-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 (message "cvsdiffing %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 ;; FIXME: this seems messy to test and set buffer name at this point....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 (if (not (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 (cvs-set-fileinfo->cvs-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 "-in-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 (set-buffer (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 (insert (format "=== cvs %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 (nconc (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 (list "-d" cvs-cvsroot "diff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 '("diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 (list (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 (if (apply 'call-process cvs-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 (nconc (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 (list "-d" cvs-cvsroot "diff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 '("diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 (list (cvs-fileinfo->file-name fileinfo-to-diff))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 (message "cvsdiffing %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 (message "cvsdiffing %s... No differences found."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 (cvs-fileinfo->file-name fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 (message "cvsdiffing... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 (defun cvs-mode-diff-backup (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 "Diff the files against the backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 This command can be used on files that are marked with \"Merged\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 or \"Conflict\" in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 If the variable cvs-diff-ignore-marks is non-nil any marked files will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 not be considered to be selected. An optional prefix argument will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 invert the influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 The flags in cvs-diff-flags will be passed to ``diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 The resulting diffs are placed in the cvs-fileinfo->backup-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 (let ((marked-file-list (cvs-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 (function cvs-backup-diffable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (if (null marked-file-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 (error "No ``Conflict'' or ``Merged'' file selected!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 (message "backup diff...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 (backup-temp-files (cvs-diff-backup-extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188 (message "backup diff %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 ;; FIXME: this seems messy to test and set buffer name at this point....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 (if (not (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 (cvs-set-fileinfo->backup-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 (cvs-fileinfo->backup-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 "-to-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 "-in"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 (set-buffer (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 cvs-diff-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 (nconc (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 backup-temp-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 (apply 'call-process cvs-diff-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 (nconc (copy-sequence cvs-diff-flags) backup-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (message "backup diff %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 (message "backup diff... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 (defun cvs-mode-diff-vendor (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226 "Diff the revisions merged into the current file. I.e. show what changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 were merged in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 This command can be used on files that are marked with \"Merged\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 or \"Conflict\" in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 If the variable cvs-diff-ignore-marks is non-nil any marked files will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 not be considered to be selected. An optional prefix argument will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 invert the influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 The flags in cvs-diff-flags will be passed to ``diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 The resulting diffs are placed in the cvs-fileinfo->vendor-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 (let ((marked-file-list (cvs-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (function cvs-vendor-diffable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 (if (null marked-file-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 (error "No ``Conflict'' or ``Merged'' file selected!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252 (message "vendor diff...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 (vendor-temp-files (cvs-diff-vendor-extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 (message "vendor diff %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 (if (not (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 (cvs-set-fileinfo->vendor-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 "-of-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 "-to-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 "-in-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 (set-buffer (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 cvs-diff-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (nconc (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 vendor-temp-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 (apply 'call-process cvs-diff-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 (nconc (copy-sequence cvs-diff-flags) vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 (message "vendor diff %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 (while vendor-temp-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 (cvs-kill-buffer-visiting (car vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 (delete-file (car vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 (setq vendor-temp-files (cdr vendor-temp-files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 (message "vendor diff... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 (defun cvs-backup-diffable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 "Check if the TIN is backup-diffable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 It must have a backup file to be diffable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 (file-readable-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 (cvs-fileinfo->backup-file (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 (defun cvs-vendor-diffable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 "Check if the TIN is vendor-diffable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315 It must have head and base revision info to be diffable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 (cvs-fileinfo->base-revision (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 (cvs-fileinfo->head-revision (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 (defun cvs-diff-backup-extractor (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 "Return the filename and the name of the backup file as a list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 Signal an error if there is no backup file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 (if (not (file-readable-p (cvs-fileinfo->backup-file fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 (error "%s has no backup file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 (file-name-as-directory (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 (cvs-fileinfo->file-name fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 (list (cvs-fileinfo->backup-file fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 (defun cvs-diff-vendor-extractor (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336 "Retrieve and return the filenames of the vendor branch revisions as a list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337 Signal an error if there is no info for the vendor revisions."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 (list (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 (defun cvs-mode-find-file-other-window (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348 "Select a buffer containing the file in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 (let ((tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 (let ((type (cvs-fileinfo->type (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 ((or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 (error "Can't visit a removed file."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 (let ((obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 (odir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 (setq default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 (dired-other-window default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (set-buffer obuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 (setq default-directory odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370 (find-file-other-window (cvs-full-path tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 (error "There is no file to find."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 (defun cvs-fileinfo->full-path (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 "Return the full path for the file that is described in FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 (defun cvs-full-path (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 "Return the full path for the file that is described in TIN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 (cvs-fileinfo->full-path (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 (defun cvs-mode-find-file (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 "Select a buffer containing the file in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 ((or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 (error "Can't visit a removed file."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 (let ((odir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 (setq default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 (file-name-as-directory (cvs-fileinfo->dir fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 (dired default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 (set-buffer cvs-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 (setq default-directory odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 (find-file (cvs-full-path tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 (error "There is no file to find."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 (defun cvs-mode-mark-all-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 "Mark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 Directories are not marked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 (cookie-map (function (lambda (cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 ((not (eq (cvs-fileinfo->type cookie) 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 (cvs-set-fileinfo->marked cookie t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 (defun cvs-mode-unmark (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 "Unmark a fileinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 (let* ((tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 (sel (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 ((eq (cvs-fileinfo->type sel) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 (cookie-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 (function (lambda (f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 ((cvs-dir-member-p f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 (cvs-set-fileinfo->marked f nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 (cvs-fileinfo->dir sel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 (cvs-set-fileinfo->marked sel nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 (tin-goto-next cvs-cookie-handle pos 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 (defun cvs-mode-unmark-all-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 "Unmark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 Directories are also unmarked, but that doesn't matter, since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 they should always be unmarked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 (cookie-map (function (lambda (cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 (cvs-set-fileinfo->marked cookie nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 (defun cvs-do-removal (tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 "Remove files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 Args: TINS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 TINS is a list of tins that the user wants to delete. The files are deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 If the type of the tin is 'UNKNOWN or 'UNKNOWN-DIR the tin is removed from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 buffer. If it is anything else the file is added to a list that should be `cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 remove'd and the tin is changed to be of type 'REMOVED.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 Returns a list of tins files that should be `cvs remove'd."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (mapcar 'cvs-insert-full-path tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 ((and tins (yes-or-no-p (format "Delete %d files? " (length tins))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 (let (files-to-remove)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 (while tins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 (let* ((tin (car tins))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (filepath (cvs-full-path tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 (if (or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 ;; if it doesn't exist, as a file or directory, ignore it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 (cond ((file-directory-p filepath)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 (call-process cvs-rmdir-program nil nil nil filepath))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 ((file-exists-p filepath)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 (delete-file filepath)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 (if (or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (eq type 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 (eq type 'MOVE-AWAY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 (tin-delete cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 (setq files-to-remove (cons tin files-to-remove))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 (cvs-set-fileinfo->type fileinfo 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 (cvs-set-fileinfo->handled fileinfo nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 (tin-invalidate cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (setq tins (cdr tins)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 files-to-remove))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 (defun cvs-mode-remove-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 "Remove all marked files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 (let ((files-to-remove (cvs-do-removal (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 (if (null files-to-remove)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 (message "removing from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 (if (cvs-execute-list files-to-remove cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 (list "-d" cvs-cvsroot "remove")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 '("remove"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 "removing %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 (message "removing from repository... Done.")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 (defun cvs-mode-undo-local-changes ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 "Undo local changes to all marked files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 The file is removed and `cvs update FILE' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 (let ((tins-to-undo (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 (mapcar 'cvs-insert-full-path tins-to-undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 ((and tins-to-undo (yes-or-no-p (format "Undo changes to %d files? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 (length tins-to-undo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 (let (files-to-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (while tins-to-undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 (let* ((tin (car tins-to-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 ((or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 (eq type 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (eq type 'CVS-REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 (eq type 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (eq type 'MOVE-AWAY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (eq type 'REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 (if (not (eq type 'REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 (delete-file (cvs-full-path tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 (setq files-to-update (cons tin files-to-update))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 (cvs-set-fileinfo->type fileinfo 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 (tin-invalidate cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 ((eq type 'MOD-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558 (error "Use cvs-mode-add instead on %s."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 ((eq type 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 (error "Can't deal with a file you have removed and recreated."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 (error "Undo on directories not supported (yet)."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 ((eq type 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 (error "There is no old revision to get for %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 (t (error "cvs-mode-undo-local-changes: can't handle an %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 (setq tins-to-undo (cdr tins-to-undo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (message "Re-getting files from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 (if (cvs-execute-list files-to-update cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 (list "-d" cvs-cvsroot "update")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 '("update"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 "Re-getting %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 (message "Re-getting files from repository... Done.")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 (defun cvs-mode-acknowledge ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 "Remove all marked files from the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (mapcar (function (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 (tin-delete cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 (defun cvs-mode-unmark-up (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595 "Unmark the file on the previous line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 Takes one argument POS, a buffer position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 (let ((tin (tin-goto-previous cvs-cookie-handle pos 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 (tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 (cvs-set-fileinfo->marked (tin-cookie cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 (tin-invalidate cvs-cookie-handle tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 (defun cvs-mode-previous-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 "Go to the previous line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 If a prefix argument is given, move by that many lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 (tin-goto-previous cvs-cookie-handle (point) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 (defun cvs-mode-next-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 "Go to the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 If a prefix argument is given, move by that many lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 (tin-goto-next cvs-cookie-handle (point) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 (defun cvs-add-file-update-buffer (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 "Sub-function to cvs-mode-add. Internal use only. Update the display. Return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 non-nil if `cvs add' should be called on this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 Args: TIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 Returns 'DIR, 'ADD, 'ADD-DIR, or 'RESURRECT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 (let ((fileinfo (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 ((eq (cvs-fileinfo->type fileinfo) 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 (cvs-set-fileinfo->full-log fileinfo "new directory added with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 'ADD-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635 ((eq (cvs-fileinfo->type fileinfo) 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 (cvs-set-fileinfo->type fileinfo 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 (cvs-set-fileinfo->full-log fileinfo "new file added with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 'ADD)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 ((eq (cvs-fileinfo->type fileinfo) 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 (cvs-set-fileinfo->type fileinfo 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 (cvs-set-fileinfo->full-log fileinfo "file resurrected with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 'RESURRECT))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 (defun cvs-add-sub (cvs-buf candidates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 "Internal use only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 Args: CVS-BUF CANDIDATES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 CANDIDATES is a list of tins. Updates the CVS-BUF and returns a list of lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 The first list is unknown tins that shall be `cvs add -m msg'ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654 The second list is unknown directory tins that shall be `cvs add -m msg'ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 The third list is removed files that shall be `cvs add'ed (resurrected)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (let (add add-dir resurrect)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (while candidates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 (let ((type (cvs-add-file-update-buffer (car candidates))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660 (cond ((eq type 'ADD)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 (setq add (cons (car candidates) add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 ((eq type 'ADD-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 (setq add-dir (cons (car candidates) add-dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 ((eq type 'RESURRECT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (setq resurrect (cons (car candidates) resurrect)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 (setq candidates (cdr candidates)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 (list add add-dir resurrect)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 (defun cvs-mode-add ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 "Add marked files to the cvs repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 (let* ((buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 (marked (cvs-get-marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 (result (cvs-add-sub buf marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 (added (car result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 (newdirs (car (cdr result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (resurrect (car (cdr (cdr result))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 (msg (if (or added newdirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 (read-from-minibuffer "Enter description: "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 (if (or resurrect (or added newdirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684 (cvs-use-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 (cond (resurrect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 (message "Resurrecting files from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 (if (cvs-execute-list resurrect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 (list "-d" cvs-cvsroot "add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 '("add"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 "Resurrecting %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 (message "Resurrecting files from repository... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 (cond (added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698 (message "Adding new files to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 (if (cvs-execute-list added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 (list "-d" cvs-cvsroot "add" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 (list "add" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 "Adding %s to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 (message "Adding new files to repository... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 (cond (newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 (message "Adding new directories to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 (if (cvs-execute-list newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 (list "-d" cvs-cvsroot "add" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 (list "add" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 "Adding %s to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 (while newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718 (let* ((tin (car newdirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 (newdir (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 (cvs-set-fileinfo->dir fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 (concat (cvs-fileinfo->dir fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 "/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 newdir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 (cvs-set-fileinfo->type fileinfo 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726 (cvs-set-fileinfo->file-name fileinfo ".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 (setq newdirs (cdr newdirs))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 ;; FIXME: this should really run cvs-update-no-prompt on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 ;; subdir and insert everthing in the current list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 (message "You must re-update to visit the new directories."))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 (defun cvs-mode-ignore ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735 "Arrange so that CVS ignores the selected files and directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 This command ignores files/dirs that are flagged as `Unknown'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739 (mapcar (function (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 (cond ((or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 (eq type 'UNKNOWN-DIR))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 (cvs-append-to-ignore fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745 (tin-delete cvs-cookie-handle tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749 (defun cvs-append-to-ignore (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 "Append the file in fileinfo to the .cvsignore file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 (set-buffer (find-file-noselect (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754 (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 ".cvsignore")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 (if (not (zerop (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 (insert (cvs-fileinfo->file-name fileinfo) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 (if cvs-sort-ignore-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 (sort-lines nil (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 (save-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2763
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765 (defun cvs-mode-status ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 "Show cvs status for all marked files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 (if (not (listp cvs-status-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 (error "cvs-status-flags should be set using cvs-set-status-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772 (let ((marked (cvs-get-marked nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 (message "Running cvs status ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 (list "-Q" "status")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779 cvs-status-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 "Running cvs -Q status %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782 (message "Running cvs -Q status ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785 (defun cvs-mode-log ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 "Display the cvs log of all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2789 (if (not (listp cvs-log-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 (error "cvs-log-flags should be set using cvs-set-log-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791 (let ((marked (cvs-get-marked nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 (message "Running cvs log ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 (list "log")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2798 cvs-log-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 "Running cvs log %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 (message "Running cvs log ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 (defun cvs-mode-tag ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 "Run 'cvs tag' on all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 (if (not (listp cvs-tag-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 (error "cvs-tag-flags should be set using cvs-set-tag-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 (let ((marked (cvs-get-marked nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 (tag-args (cvs-make-list (read-string "Tag name (and flags): "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 (message "Running cvs tag ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817 (list "tag")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818 cvs-tag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 tag-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 "Running cvs tag %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 (message "Running cvs tag ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825 (defun cvs-mode-rtag ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 "Run 'cvs rtag' on all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 (if (not (listp cvs-rtag-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 (error "cvs-rtag-flags should be set using cvs-set-rtag-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 (let ((marked (cvs-get-marked nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832 ;; FIXME: should give selection from the modules file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833 (module-name (read-string "Module name: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 ;; FIXME: should also ask for an existing tag *or* date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 (rtag-args (cvs-make-list (read-string "Tag name (and flags): "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837 (message "Running cvs rtag ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2840 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841 (list "rtag")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842 cvs-rtag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 rtag-args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844 (list module-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 "Running cvs rtag %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2846 (error "CVS rtag exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2847 (message "Running cvs rtag ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850 (defun cvs-mode-byte-compile-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 "Run byte-compile-file on all selected files that end in '.el'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 (let ((marked (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855 (while marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 (let ((filename (cvs-full-path (car marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 (if (string-match "\\.el$" filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858 (byte-compile-file filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 (setq marked (cdr marked)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862 (defun cvs-insert-full-path (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 "Insert full path to the file described in TIN in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 (insert (format "%s\n" (cvs-full-path tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 (defun cvs-mode-add-change-log-entry-other-window (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 "Add a ChangeLog entry in the ChangeLog of the current directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 (odir default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 (obfname buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 (tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878 (fname (cvs-fileinfo->file-name fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879 (dname (file-name-as-directory (cvs-fileinfo->dir fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 (setq change-log-default-name nil) ; this rarely correct in 19.28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 (setq buffer-file-name (cond (fname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885 (setq default-directory (cond (dname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886 dname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 (add-change-log-entry-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 (set-buffer cvs-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891 (setq default-directory odir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 (setq buffer-file-name obfname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 (defun print-cvs-tin (foo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896 "Debug utility."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2897
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 (let ((cookie (tin-cookie cvs-cookie-handle foo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 (stream (get-buffer-create "pcl-cvs-debug")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 (princ "==============\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901 (princ (cvs-fileinfo->file-name cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903 (princ (cvs-fileinfo->dir cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 (princ (cvs-fileinfo->full-log cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907 (princ (cvs-fileinfo->marked cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 (princ "\n" stream)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 ;; NOTE: the variable cvs-emerge-tmp-head-file will be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 (defun cvs-mode-emerge (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913 "Emerge appropriate revisions of the selected file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 (if (boundp 'cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 (error "There can only be one emerge session active at a time."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 ((eq type 'MODIFIED) ; merge repository head rev. with working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 (require 'emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 (setq cvs-emerge-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 (cvs-retrieve-revision-to-tmpfile fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 (if (not (emerge-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 t ; arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 cvs-emerge-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 (cvs-fileinfo->full-path fileinfo) ; file-out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 nil ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 '(lambda () ; quit-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 (delete-file cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 (makunbound 'cvs-emerge-tmp-head-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 (error "Emerge session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 ;; re-do the same merge rcsmerge supposedly just did....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 ((or (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 (eq type 'CONFLICT)) ; merge backup-working=A, head=B, base=ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 (require 'emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 (setq cvs-emerge-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 (let ((cvs-emerge-tmp-backup-working-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 (cvs-fileinfo->backup-file fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 (cvs-emerge-tmp-ancestor-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2957 (if (not (emerge-files-with-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2958 t ; arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2959 cvs-emerge-tmp-backup-working-file ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2960 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961 cvs-emerge-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962 cvs-emerge-tmp-ancestor-file ; file-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963 (cvs-fileinfo->full-path fileinfo) ; file-out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964 nil ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 '(lambda () ; quit-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 (delete-file cvs-emerge-tmp-backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 (delete-file cvs-emerge-tmp-ancestor-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 (delete-file cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969 (makunbound 'cvs-emerge-tmp-head-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 (error "Emerge session failed")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 (error "Can only e-merge \"Modified\", \"Merged\" or \"Conflict\" files"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973 (error "There is no file to e-merge."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 ;; NOTE: the variable ediff-version may be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 (defun cvs-mode-ediff (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978 "Ediff appropriate revisions of the selected file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 (if (boundp 'cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 (error "There can only be one ediff session active at a time."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 (require 'ediff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 (if (and (boundp 'ediff-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 (>= (string-to-number ediff-version) 2.0)) ; FIXME real number?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987 (run-ediff-from-cvs-buffer pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988 (cvs-old-ediff-interface pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2990 (defun cvs-old-ediff-interface (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991 "Emerge like interface for older ediffs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 Args: POS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 ((eq type 'MODIFIED) ; diff repository head rev. with working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001 ;; should this be inside the unwind-protect, and should the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 ;; makeunbound be an unwindform?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 (cvs-retrieve-revision-to-tmpfile fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3005 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006 (if (not (ediff-files ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 '(lambda () ; startup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 (error "Ediff session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3020 ;; look at the merge rcsmerge supposedly just did....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 ((or (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 (eq type 'CONFLICT)) ; diff backup-working=A, head=B, base=ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3023 (if (not (boundp 'ediff-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024 (error "ediff version way too old for 3-way diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025 (if (<= (string-to-number ediff-version) 1.9) ; FIXME real number?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3026 (error "ediff version %s too old for 3-way diff" ediff-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3027 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3028 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3029 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 (let ((cvs-ediff-tmp-backup-working-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 (cvs-fileinfo->backup-file fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033 (cvs-ediff-tmp-ancestor-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3038 (if (not (ediff-files3 ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 cvs-ediff-tmp-backup-working-file ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3040 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3041 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3042 cvs-ediff-tmp-ancestor-file ; file-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3043 '(lambda () ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3044 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3045 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3046 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3047 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3048 (delete-file cvs-ediff-tmp-backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3049 (delete-file cvs-ediff-tmp-ancestor-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3050 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3051 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3052 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3053 (error "Ediff session failed")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3055 ((not (or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3056 (eq type 'UNKNOWN-DIR))) ; i.e. UPDATED or PATCHED ????
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057 ;; this should really diff the current working file with the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058 ;; rev. on the current branch (i.e. not the head, since that's what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059 ;; the current file should be)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3061 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3062 (read-string "Rev #/tag to diff against: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3063 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3064 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3065 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3066 (if (not (ediff-files ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3067 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3068 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3069 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3070 '(lambda () ; startup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3071 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3072 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3073 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3074 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3075 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3076 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3077 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3078 (error "Ediff session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3079 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3080 (error "Can not ediff \"Unknown\" files"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3081 (error "There is no file to ediff."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3083 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3084 (defun cvs-retrieve-revision-to-tmpfile (fileinfo &optional revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3085 "Retrieve the latest revision of the file in FILEINFO to a temporary file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3086 If second optional argument REVISION is given, retrieve that revision instead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3088 (let
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3089 ((temp-name (make-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3090 (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3091 (or (getenv "TMPDIR") "/tmp"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3092 "pcl-cvs." revision))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3093 (cvs-kill-buffer-visiting temp-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3094 (if (and revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3095 (stringp revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096 (not (string= revision "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3097 (message "Retrieving revision %s..." revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3098 (message "Retrieving latest revision..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3099 (let ((res (call-process cvs-shell nil nil nil "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3100 (concat cvs-program " update -p "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3101 (if (and revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3102 (stringp revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3103 (not (string= revision "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3104 (concat "-r " revision " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3105 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3106 (cvs-fileinfo->full-path fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3107 " > " temp-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108 (if (and res (not (and (integerp res) (zerop res))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3109 (error "Something went wrong retrieving revision %s: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3110 revision res))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3112 (if revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3113 (message "Retrieving revision %s... Done." revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3114 (message "Retrieving latest revision... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3115 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3116 (set-buffer (find-file-noselect temp-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3117 (rename-buffer (concat " " (file-name-nondirectory temp-name)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3118 temp-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3120 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3121 (defun cvs-kill-buffer-visiting (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3122 "If there is any buffer visiting FILENAME, kill it (without confirmation)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3124 (let ((l (buffer-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3125 (while l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3126 (if (string= (buffer-file-name (car l)) filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3127 (kill-buffer (car l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3128 (setq l (cdr l)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3130 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3131 (defun cvs-change-cvsroot ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3132 "Ask for a new cvsroot."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3134 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 (cvs-set-cvsroot (read-file-name "New CVSROOT: " cvs-cvsroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138 (defun cvs-set-cvsroot (newroot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 "Change the cvsroot."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3141 (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3142 (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3143 " Change cvs-cvsroot anyhow?")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3144 (setq cvs-cvsroot newroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3146 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3147 (defun cvs-set-diff-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3148 "Ask for new setting of cvs-diff-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 (copy-sequence cvs-diff-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153 (setq cvs-diff-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154 (cvs-make-list (read-string "Diff flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3156 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3157 (defun cvs-set-update-optional-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3158 "Ask for new setting of cvs-update-optional-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162 (copy-sequence cvs-update-optional-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163 (setq cvs-update-optional-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3164 (cvs-make-list (read-string "Update optional flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3166 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167 (defun cvs-set-status-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168 "Ask for new setting of cvs-status-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3170 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3171 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3172 (copy-sequence cvs-status-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173 (setq cvs-status-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174 (cvs-make-list (read-string "Status flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3176 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177 (defun cvs-set-log-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 "Ask for new setting of cvs-log-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182 (copy-sequence cvs-log-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183 (setq cvs-log-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184 (cvs-make-list (read-string "Log flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3186 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3187 (defun cvs-set-tag-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3188 "Ask for new setting of cvs-tag-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192 (copy-sequence cvs-tag-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193 (setq cvs-tag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 (cvs-make-list (read-string "Tag flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197 (defun cvs-set-rtag-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198 "Ask for new setting of cvs-rtag-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 (copy-sequence cvs-rtag-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203 (setq cvs-rtag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 (cvs-make-list (read-string "Rtag flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3207 (if (string-match "XEmacs" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209 ;; now marked to autload in pcl-cvs-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210 ;(autoload 'pcl-cvs-fontify "pcl-cvs-xemacs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3211 (add-hook 'cvs-mode-hook 'pcl-cvs-fontify)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213 (defun cvs-changelog-name (directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 "Return the name of the ChangeLog file that handles DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 This is in DIRECTORY or one of its parents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3216 Signal an error if we can't find an appropriate ChangeLog file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3217 (let ((dir (file-name-as-directory directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3218 file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219 (while (and dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 (not (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 (setq file (expand-file-name "ChangeLog" dir)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222 (let ((last dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 (setq dir (file-name-directory (directory-file-name dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224 (if (equal last dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 (setq dir nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226 (or dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227 (error "Can't find ChangeLog for %s" directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228 file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230 (defun cvs-narrow-changelog ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231 "Narrow to the top page of the current buffer, a ChangeLog file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 Actually, the narrowed region doesn't include the date line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 A \"page\" in a ChangeLog file is the area between two dates."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234 (or (eq major-mode 'change-log-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3235 (error "cvs-narrow-changelog: current buffer isn't a ChangeLog"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 ;; Skip date line and subsequent blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241 (if (looking-at "[ \t\n]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3245 (forward-page 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 (goto-char (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249 (defun cvs-changelog-paragraph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250 "Return the bounds of the ChangeLog paragraph containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 If we are between paragraphs, return the previous paragraph."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 (if (looking-at "^[ \t]*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 (skip-chars-backward " \t\n" (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256 (list (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257 (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260 (if (re-search-forward "^[ \t\n]*$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3264 (defun cvs-changelog-subparagraph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265 "Return the bounds of the ChangeLog subparagraph containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3266 A subparagraph is a block of non-blank lines beginning with an asterisk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3267 If we are between sub-paragraphs, return the previous subparagraph."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3268 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3269 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3270 (if (search-backward "*" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3271 (list (progn (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3272 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3273 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3274 (if (re-search-forward "^[ \t]*[\n*]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277 (list (point) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3279 (defun cvs-changelog-entry ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 "Return the bounds of the ChangeLog entry containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 The variable `cvs-changelog-full-paragraphs' decides whether an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 \"entry\" is a paragraph or a subparagraph; see its documentation string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3283 for more details."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3284 (if cvs-changelog-full-paragraphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3285 (cvs-changelog-paragraph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286 (cvs-changelog-subparagraph)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 ;; NOTE: the variable user-full-name may be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289 (defun cvs-changelog-ours-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3290 "See if ChangeLog entry at point is for the current user, today.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3291 Return non-nil iff it is."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3292 ;; Code adapted from add-change-log-entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3293 (looking-at (concat (regexp-quote (substring (current-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3294 0 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3295 ".* "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3296 (regexp-quote (substring (current-time-string) -4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3297 "[ \t]+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3298 (regexp-quote (if (and (boundp 'add-log-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3299 add-log-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3300 add-log-full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3301 user-full-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3302 " <"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3303 (regexp-quote (if (and (boundp 'add-log-mailing-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3304 add-log-mailing-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3305 add-log-mailing-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3306 user-mail-address)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3308 (defun cvs-relative-path (base child)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3309 "Return a directory path relative to BASE for CHILD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3310 If CHILD doesn't seem to be in a subdirectory of BASE, just return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3311 the full path to CHILD."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3312 (let ((base (file-name-as-directory (expand-file-name base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3313 (child (expand-file-name child)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3314 (or (string= base (substring child 0 (length base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3315 (error "cvs-relative-path: %s isn't in %s" child base))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3316 (substring child (length base))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3318 (defun cvs-changelog-entries (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3319 "Return the ChangeLog entries for FILE, and the ChangeLog they came from.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3320 The return value looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3321 (LOGBUFFER (ENTRYSTART . ENTRYEND) ...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3322 where LOGBUFFER is the name of the ChangeLog buffer, and each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3323 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3324 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3325 (set-buffer (find-file-noselect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3326 (cvs-changelog-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3327 (file-name-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3328 (expand-file-name file)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3329 (or (eq major-mode 'change-log-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3330 (change-log-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3331 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3332 (if (looking-at "[ \t\n]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3333 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3334 (if (not (cvs-changelog-ours-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3335 (list (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3336 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3337 (cvs-narrow-changelog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3338 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3340 ;; Search for the name of FILE relative to the ChangeLog. If that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3341 ;; doesn't occur anywhere, they're not using full relative
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3342 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3343 ;; some false positives.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3344 (let ((pattern (cvs-relative-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3345 (file-name-directory buffer-file-name) file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3346 (if (or (string= pattern "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3347 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3348 (search-forward pattern nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3349 (setq pattern file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3351 (let (texts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3352 (while (search-forward pattern nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3353 (let ((entry (cvs-changelog-entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3354 (setq texts (cons entry texts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3355 (goto-char (elt entry 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3357 (cons (current-buffer) texts)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3359 (defun cvs-changelog-insert-entries (buffer regions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3360 "Insert those regions in BUFFER specified in REGIONS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3361 Sort REGIONS front-to-back first."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3362 (let ((regions (sort regions 'car-less-than-car))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3363 (last))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3364 (while regions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3365 (if (and last (< last (car (car regions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3366 (newline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3367 (setq last (elt (car regions) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3368 (apply 'insert-buffer-substring buffer (car regions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3369 (setq regions (cdr regions)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3371 (defun cvs-union (set1 set2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3372 "Return the union of SET1 and SET2, according to `equal'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373 (while set2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374 (or (member (car set2) set1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3375 (setq set1 (cons (car set2) set1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3376 (setq set2 (cdr set2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3377 set1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3379 (defun cvs-insert-changelog-entries (files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3380 "Given a list of files FILES, insert the ChangeLog entries for them."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3381 (let ((buffer-entries nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3383 ;; Add each buffer to buffer-entries, and associate it with the list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3384 ;; of entries we want from that file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3385 (while files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386 (let* ((entries (cvs-changelog-entries (car files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387 (pair (assq (car entries) buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 (if pair
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 (setcdr pair (cvs-union (cdr pair) (cdr entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3390 (setq buffer-entries (cons entries buffer-entries))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3391 (setq files (cdr files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393 ;; Now map over each buffer in buffer-entries, sort the entries for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 ;; each buffer, and extract them as strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395 (while buffer-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396 (cvs-changelog-insert-entries (car (car buffer-entries))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 (cdr (car buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 (if (and (cdr buffer-entries) (cdr (car buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399 (newline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 (setq buffer-entries (cdr buffer-entries)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 (defun cvs-edit-delete-common-indentation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403 "Unindent the current buffer rigidly until at least one line is flush left."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 (let ((common 100000))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3406 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3407 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3408 (if (not (looking-at "^[ \t]*$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3409 (setq common (min common (current-indentation))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3411 (indent-rigidly (point-min) (point-max) (- common)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3413 (defun cvs-mode-changelog-commit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3414 "Check in all marked files, or the current file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3415 Ask the user for a log message in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417 This is just like `\\[cvs-mode-commit]', except that it tries to provide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3418 appropriate default log messages by looking at the ChangeLog. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3419 idea is to write your ChangeLog entries first, and then use this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3420 command to commit your changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3422 To select default log text, we:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3423 - find the ChangeLog entries for the files to be checked in,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424 - verify that the top entry in the ChangeLog is on the current date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425 and by the current user; if not, we don't provide any default text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 - search the ChangeLog entry for paragraphs containing the names of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427 the files we're checking in, and finally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 - use those paragraphs as the log text."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3432 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3433 (marked (cvs-filter (function cvs-committable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3434 (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435 (if (null marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436 (error "Nothing to commit!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437 (pop-to-buffer (get-buffer-create cvs-commit-prompt-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3440 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3441 (cvs-insert-changelog-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3442 (mapcar (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3443 (let ((cookie (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3444 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3445 (cvs-fileinfo->file-name cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446 (cvs-fileinfo->dir cookie))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447 marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448 (cvs-edit-delete-common-indentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 (cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 (make-local-variable 'cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3452 (setq cvs-commit-list marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3453 (message "Press C-c C-c when you are done editing."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3455 ;;;; end of file pcl-cvs.el