1 ;;; vc-rcs.el --- support for RCS version-control
3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: FSF (see vc.el for full credits)
7 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 3, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
33 ;; - remove call to vc-expand-dirs by implementing our own (which can just
34 ;; list the RCS subdir instead).
39 ;;; Customization options
46 (defcustom vc-rcs-release nil
47 "*The release number of your RCS installation, as a string.
48 If nil, VC itself computes this value when it is first needed."
49 :type
'(choice (const :tag
"Auto" nil
)
50 (string :tag
"Specified")
51 (const :tag
"Unknown" unknown
))
54 (defcustom vc-rcs-register-switches nil
55 "*Extra switches for registering a file in RCS.
56 A string or list of strings. These are passed to the checkin program
57 by \\[vc-rcs-register]."
58 :type
'(choice (const :tag
"None" nil
)
59 (string :tag
"Argument String")
60 (repeat :tag
"Argument List"
66 (defcustom vc-rcs-diff-switches nil
67 "*A string or list of strings specifying extra switches for rcsdiff under VC."
68 :type
'(choice (const :tag
"None" nil
)
69 (string :tag
"Argument String")
70 (repeat :tag
"Argument List"
76 (defcustom vc-rcs-header
(or (cdr (assoc 'RCS vc-header-alist
)) '("\$Id\$"))
77 "*Header keywords to be inserted by `vc-insert-headers'."
78 :type
'(repeat string
)
82 (defcustom vc-rcsdiff-knows-brief nil
83 "*Indicates whether rcsdiff understands the --brief option.
84 The value is either `yes', `no', or nil. If it is nil, VC tries
85 to use --brief and sets this variable to remember whether it worked."
86 :type
'(choice (const :tag
"Work out" nil
) (const yes
) (const no
))
90 (defcustom vc-rcs-master-templates
91 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")
92 "*Where to look for RCS master files.
93 For a description of possible values, see `vc-check-master-templates'."
94 :type
'(choice (const :tag
"Use standard RCS file names"
95 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
96 (repeat :tag
"User-specified"
103 ;;; Properties of the backend
105 (defun vc-rcs-revision-granularity ()
109 ;;; State-querying functions
112 ;;; The autoload cookie below places vc-rcs-registered directly into
113 ;;; loaddefs.el, so that vc-rcs.el does not need to be loaded for
114 ;;; every file that is visited. The definition is repeated below
115 ;;; so that Help and etags can find it.
117 ;;;###autoload (defun vc-rcs-registered (f) (vc-default-registered 'RCS f))
118 (defun vc-rcs-registered (f) (vc-default-registered 'RCS f
))
120 (defun vc-rcs-state (file)
121 "Implementation of `vc-state' for RCS."
122 (or (boundp 'vc-rcs-headers-result
)
123 (and vc-consult-headers
124 (vc-rcs-consult-headers file
)))
126 ;; vc-working-revision might not be known; in that case the
127 ;; property is nil. vc-rcs-fetch-master-state knows how to
129 (vc-rcs-fetch-master-state file
130 (vc-file-getprop file
131 'vc-working-revision
))))
132 (if (not (eq state
'up-to-date
))
134 (if (vc-workfile-unchanged-p file
)
136 (if (eq (vc-checkout-model file
) 'locking
)
140 (defun vc-rcs-state-heuristic (file)
141 "State heuristic for RCS."
142 (let (vc-rcs-headers-result)
143 (if (and vc-consult-headers
144 (setq vc-rcs-headers-result
145 (vc-rcs-consult-headers file
))
146 (eq vc-rcs-headers-result
'rev-and-lock
))
147 (let ((state (vc-file-getprop file
'vc-state
)))
148 ;; If the headers say that the file is not locked, the
149 ;; permissions can tell us whether locking is used for
151 (if (and (eq state
'up-to-date
)
152 (not (vc-mistrust-permissions file
)))
154 ((string-match ".rw..-..-." (nth 8 (file-attributes file
)))
155 (vc-file-setprop file
'vc-checkout-model
'implicit
)
157 (if (vc-rcs-workfile-is-newer file
)
160 ((string-match ".r-..-..-." (nth 8 (file-attributes file
)))
161 (vc-file-setprop file
'vc-checkout-model
'locking
))))
163 (if (not (vc-mistrust-permissions file
))
164 (let* ((attributes (file-attributes file
'string
))
165 (owner-name (nth 2 attributes
))
166 (permissions (nth 8 attributes
)))
167 (cond ((string-match ".r-..-..-." permissions
)
168 (vc-file-setprop file
'vc-checkout-model
'locking
)
170 ((string-match ".rw..-..-." permissions
)
171 (if (eq (vc-checkout-model file
) 'locking
)
172 (if (file-ownership-preserved-p file
)
175 (if (vc-rcs-workfile-is-newer file
)
179 ;; Strange permissions. Fall through to
180 ;; expensive state computation.
181 (vc-rcs-state file
))))
182 (vc-rcs-state file
)))))
184 ;; XXX Experimental function for the vc-dired replacement.
185 (defun vc-rcs-dir-status (dir update-function
)
186 ;; XXX: quick hack, there should be a better way to do this,
187 ;; but it's not worse than vc-dired :-).
188 (let ((flist (vc-expand-dirs (list dir
)))
191 (let ((state (vc-state file
))
192 (frel (file-relative-name file
)))
193 (push (list frel state
) result
)))
194 (funcall update-function result
)))
196 (defun vc-rcs-working-revision (file)
197 "RCS-specific version of `vc-working-revision'."
198 (or (and vc-consult-headers
199 (vc-rcs-consult-headers file
)
200 (vc-file-getprop file
'vc-working-revision
))
202 (vc-rcs-fetch-master-state file
)
203 (vc-file-getprop file
'vc-working-revision
))))
205 (defun vc-rcs-latest-on-branch-p (file &optional version
)
206 "Return non-nil if workfile version of FILE is the latest on its branch.
207 When VERSION is given, perform check for that version."
208 (unless version
(setq version
(vc-working-revision file
)))
211 (if (vc-trunk-p version
)
213 ;; Compare VERSION to the head version number.
214 (vc-insert-file (vc-name file
) "^[0-9]")
215 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
216 ;; If we are not on the trunk, we need to examine the
217 ;; whole current branch.
218 (vc-insert-file (vc-name file
) "^desc")
219 (vc-rcs-find-most-recent-rev (vc-branch-part version
))))))
221 (defun vc-rcs-checkout-model (file)
222 "RCS-specific version of `vc-checkout-model'."
224 (when vc-consult-headers
225 (vc-file-setprop file
'vc-checkout-model nil
)
226 (vc-rcs-consult-headers file
)
227 (setq result
(vc-file-getprop file
'vc-checkout-model
)))
229 (progn (vc-rcs-fetch-master-state file
)
230 (vc-file-getprop file
'vc-checkout-model
)))))
232 (defun vc-rcs-workfile-unchanged-p (file)
233 "RCS-specific implementation of `vc-workfile-unchanged-p'."
234 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that,
235 ;; do a double take and remember the fact for the future
236 (let* ((version (concat "-r" (vc-working-revision file
)))
237 (status (if (eq vc-rcsdiff-knows-brief
'no
)
238 (vc-do-command nil
1 "rcsdiff" file version
)
239 (vc-do-command nil
2 "rcsdiff" file
"--brief" version
))))
241 (if (not vc-rcsdiff-knows-brief
)
242 (setq vc-rcsdiff-knows-brief
'no
243 status
(vc-do-command nil
1 "rcsdiff" file version
))
244 (error "rcsdiff failed"))
245 (if (not vc-rcsdiff-knows-brief
) (setq vc-rcsdiff-knows-brief
'yes
)))
246 ;; The workfile is unchanged if rcsdiff found no differences.
249 (defun vc-rcs-find-file-not-found-hook ()
251 (format "File %s was lost; check out from version control? "
252 (file-name-nondirectory buffer-file-name
)))
255 (let ((default-directory (file-name-directory buffer-file-name
)))
256 (not (vc-error-occurred (vc-checkout buffer-file-name
)))))))
259 ;;; State-changing functions
262 (defun vc-rcs-create-repo ()
263 "Create a new RCS repository."
264 ;; RCS is totally file-oriented, so all we have to do is make the directory
265 (make-directory "RCS"))
267 (defun vc-rcs-register (files &optional rev comment
)
268 "Register FILES into the RCS version-control system.
269 REV is the optional revision number for the files. COMMENT can be used
270 to provide an initial description for each FILES.
272 `vc-register-switches' and `vc-rcs-register-switches' are passed to
273 the RCS command (in that order).
275 Automatically retrieve a read-only version of the file with keywords
276 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
279 (and (not (file-exists-p
280 (setq subdir
(expand-file-name "RCS"
281 (file-name-directory file
)))))
282 (not (directory-files (file-name-directory file
)
284 (yes-or-no-p "Create RCS subdirectory? ")
285 (make-directory subdir
))
286 (apply 'vc-do-command nil
0 "ci" file
287 ;; if available, use the secure registering option
288 (and (vc-rcs-release-p "5.6.4") "-i")
289 (concat (if vc-keep-workfiles
"-u" "-r") rev
)
290 (and comment
(concat "-t-" comment
))
291 (vc-switches 'RCS
'register
))
292 ;; parse output to find master file name and workfile version
293 (with-current-buffer "*vc*"
294 (goto-char (point-min))
296 (if (looking-at (concat "^\\(.*\\) <-- "
297 (file-name-nondirectory file
)))
299 ;; if we couldn't find the master name,
300 ;; run vc-rcs-registered to get it
301 ;; (will be stored into the vc-name property)
302 (vc-rcs-registered file
)
303 (vc-file-setprop file
'vc-name
304 (if (file-name-absolute-p name
)
308 (file-name-directory file
))))))
309 (vc-file-setprop file
'vc-working-revision
310 (if (re-search-forward
311 "^initial revision: \\([0-9.]+\\).*\n"
313 (match-string 1))))))
315 (defun vc-rcs-responsible-p (file)
316 "Return non-nil if RCS thinks it would be responsible for registering FILE."
317 ;; TODO: check for all the patterns in vc-rcs-master-templates
318 (file-directory-p (expand-file-name "RCS" (file-name-directory file
))))
320 (defun vc-rcs-receive-file (file rev
)
321 "Implementation of receive-file for RCS."
322 (let ((checkout-model (vc-checkout-model file
)))
323 (vc-rcs-register file rev
"")
324 (when (eq checkout-model
'implicit
)
325 (vc-rcs-set-non-strict-locking file
))
326 (vc-rcs-set-default-branch file
(concat rev
".1"))))
328 (defun vc-rcs-unregister (file)
329 "Unregister FILE from RCS.
330 If this leaves the RCS subdirectory empty, ask the user
331 whether to remove it."
332 (let* ((master (vc-name file
))
333 (dir (file-name-directory master
))
334 (backup-info (find-backup-file-name master
)))
335 (if (not backup-info
)
337 (rename-file master
(car backup-info
) 'ok-if-already-exists
)
338 (dolist (f (cdr backup-info
)) (ignore-errors (delete-file f
))))
339 (and (string= (file-name-nondirectory (directory-file-name dir
)) "RCS")
340 ;; check whether RCS dir is empty, i.e. it does not
341 ;; contain any files except "." and ".."
342 (not (directory-files dir nil
343 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
344 (yes-or-no-p (format "Directory %s is empty; remove it? " dir
))
345 (delete-directory dir
))))
347 (defun vc-rcs-checkin (files rev comment
)
348 "RCS-specific version of `vc-backend-checkin'."
349 (let ((switches (vc-switches 'RCS
'checkin
)))
350 ;; Now operate on the files
352 (let ((old-version (vc-working-revision file
)) new-version
353 (default-branch (vc-file-getprop file
'vc-rcs-default-branch
)))
354 ;; Force branch creation if an appropriate
355 ;; default branch has been set.
358 (string-match (concat "^" (regexp-quote old-version
) "\\.")
360 (setq rev default-branch
)
361 (setq switches
(cons "-f" switches
)))
362 (if (and (not rev
) old-version
)
363 (setq rev
(vc-branch-part old-version
)))
364 (apply 'vc-do-command nil
0 "ci" (vc-name file
)
365 ;; if available, use the secure check-in option
366 (and (vc-rcs-release-p "5.6.4") "-j")
367 (concat (if vc-keep-workfiles
"-u" "-r") rev
)
368 (concat "-m" comment
)
370 (vc-file-setprop file
'vc-working-revision nil
)
372 ;; determine the new workfile version
374 (goto-char (point-min))
375 (when (or (re-search-forward
376 "new revision: \\([0-9.]+\\);" nil t
)
378 "reverting to previous revision \\([0-9.]+\\)" nil t
))
379 (setq new-version
(match-string 1))
380 (vc-file-setprop file
'vc-working-revision new-version
))
382 ;; if we got to a different branch, adjust the default
383 ;; branch accordingly
385 ((and old-version new-version
386 (not (string= (vc-branch-part old-version
)
387 (vc-branch-part new-version
))))
388 (vc-rcs-set-default-branch file
389 (if (vc-trunk-p new-version
) nil
390 (vc-branch-part new-version
)))
391 ;; If this is an old RCS release, we might have
392 ;; to remove a remaining lock.
393 (if (not (vc-rcs-release-p "5.6.2"))
394 ;; exit status of 1 is also accepted.
395 ;; It means that the lock was removed before.
396 (vc-do-command nil
1 "rcs" (vc-name file
)
397 (concat "-u" old-version
)))))))))
399 (defun vc-rcs-find-revision (file rev buffer
)
400 (apply 'vc-do-command
401 buffer
0 "co" (vc-name file
)
402 "-q" ;; suppress diagnostic output
404 (vc-switches 'RCS
'checkout
)))
406 (defun vc-rcs-checkout (file &optional editable rev
)
407 "Retrieve a copy of a saved version of FILE."
408 (let ((file-buffer (get-file-buffer file
))
410 (message "Checking out %s..." file
)
412 ;; Change buffers to get local value of vc-checkout-switches.
413 (if file-buffer
(set-buffer file-buffer
))
414 (setq switches
(vc-switches 'RCS
'checkout
))
415 ;; Save this buffer's default-directory
416 ;; and use save-excursion to make sure it is restored
417 ;; in the same buffer it was saved in.
418 (let ((default-directory default-directory
))
420 ;; Adjust the default-directory so that the check-out creates
421 ;; the file in the right place.
422 (setq default-directory
(file-name-directory file
))
424 ;; if we should go to the head of the trunk,
425 ;; clear the default branch first
426 (and rev
(string= rev
"")
427 (vc-rcs-set-default-branch file nil
))
428 ;; now do the checkout
429 (apply 'vc-do-command
430 nil
0 "co" (vc-name file
)
431 ;; If locking is not strict, force to overwrite
432 ;; the writable workfile.
433 (if (eq (vc-checkout-model file
) 'implicit
) "-f")
436 ;; a literal revision was specified
438 (let ((workrev (vc-working-revision file
)))
442 ;; no revision specified:
443 ;; use current workfile version
446 (if (not (vc-trunk-p workrev
))
447 ;; ... go to head of current branch
448 (vc-branch-part workrev
)
449 ;; ... go to head of trunk
450 (vc-rcs-set-default-branch file
454 ;; determine the new workfile version
455 (with-current-buffer "*vc*"
457 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1)))
458 (vc-file-setprop file
'vc-working-revision new-version
)
459 ;; if necessary, adjust the default branch
460 (and rev
(not (string= rev
""))
461 (vc-rcs-set-default-branch
463 (if (vc-rcs-latest-on-branch-p file new-version
)
464 (if (vc-trunk-p new-version
) nil
465 (vc-branch-part new-version
))
467 (message "Checking out %s...done" file
)))))
469 (defun vc-rcs-rollback (files)
470 "Roll back, undoing the most recent checkins of FILES."
472 (error "RCS backend doesn't support directory-level rollback."))
474 (let* ((discard (vc-working-revision file
))
475 (previous (if (vc-trunk-p discard
) "" (vc-branch-part discard
)))
476 (config (current-window-configuration))
478 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
481 (message "Removing revision %s from %s." discard file
)
482 (vc-do-command nil
0 "rcs" (vc-name file
) (concat "-o" discard
))
483 ;; Check out the most recent remaining version. If it
484 ;; fails, because the whole branch got deleted, do a
485 ;; double-take and check out the version where the branch
490 (vc-do-command nil
0 "co" (vc-name file
) "-f"
491 (concat "-u" previous
))
493 (error (set-buffer "*vc*")
494 (goto-char (point-min))
495 (if (search-forward "no side branches present for" nil t
)
496 (progn (setq previous
(vc-branch-part previous
))
497 (vc-rcs-set-default-branch file previous
)
498 ;; vc-do-command popped up a window with
499 ;; the error message. Get rid of it, by
500 ;; restoring the old window configuration.
501 (set-window-configuration config
))
502 ;; No, it was some other error: re-signal it.
503 (signal (car err
) (cdr err
)))))))))
505 (defun vc-rcs-revert (file &optional contents-done
)
506 "Revert FILE to the version it was based on."
507 (vc-do-command nil
0 "co" (vc-name file
) "-f"
508 (concat (if (eq (vc-state file
) 'edited
) "-u" "-r")
509 (vc-working-revision file
))))
511 (defun vc-rcs-merge (file first-version
&optional second-version
)
512 "Merge changes into current working copy of FILE.
513 The changes are between FIRST-VERSION and SECOND-VERSION."
514 (vc-do-command nil
1 "rcsmerge" (vc-name file
)
515 "-kk" ; ignore keyword conflicts
516 (concat "-r" first-version
)
517 (if second-version
(concat "-r" second-version
))))
519 (defun vc-rcs-steal-lock (file &optional rev
)
520 "Steal the lock on the current workfile for FILE and revision REV.
521 Needs RCS 5.6.2 or later for -M."
522 (vc-do-command nil
0 "rcs" (vc-name file
) "-M" (concat "-u" rev
))
523 ;; Do a real checkout after stealing the lock, so that we see
525 (vc-do-command nil
0 "co" (vc-name file
) "-f" (concat "-l" rev
)))
527 (defun vc-rcs-modify-change-comment (files rev comment
)
528 "Modify the change comments change on FILES on a specified REV."
530 (vc-do-command nil
0 "rcs" (vc-name file
)
531 (concat "-m" rev
":" comment
))))
535 ;;; History functions
538 (defun vc-rcs-print-log (files &optional buffer
)
539 "Get change log associated with FILE."
540 (vc-do-command buffer
0 "rlog" (mapcar 'vc-name files
)))
542 (defun vc-rcs-diff (files &optional oldvers newvers buffer
)
543 "Get a difference report using RCS between two sets of files."
544 (apply 'vc-do-command
(or buffer
"*vc-diff*")
545 1 ;; Always go synchronous, the repo is local
546 "rcsdiff" (vc-expand-dirs files
)
548 (and oldvers
(concat "-r" oldvers
))
549 (and newvers
(concat "-r" newvers
)))
550 (vc-switches 'RCS
'diff
))))
552 (defun vc-rcs-wash-log ()
553 "Remove all non-comment information from log output."
554 (let ((separator (concat "^-+\nrevision [0-9.]+\ndate: .*\n"
555 "\\(branches: .*;\n\\)?"
556 "\\(\\*\\*\\* empty log message \\*\\*\\*\n\\)?")))
557 (goto-char (point-max)) (forward-line -
1)
558 (while (looking-at "=*\n")
559 (delete-char (- (match-end 0) (match-beginning 0)))
561 (goto-char (point-min))
562 (if (looking-at "[\b\t\n\v\f\r ]+")
563 (delete-char (- (match-end 0) (match-beginning 0))))
564 (goto-char (point-min))
565 (re-search-forward separator nil t
)
566 (delete-region (point-min) (point))
567 (while (re-search-forward separator nil t
)
568 (delete-region (match-beginning 0) (match-end 0)))))
570 (defun vc-rcs-annotate-command (file buffer
&optional revision
)
571 "Annotate FILE, inserting the results in BUFFER.
572 Optional arg REVISION is a revision to annotate from."
573 (vc-setup-buffer buffer
)
574 ;; Aside from the "head revision on the trunk", the instructions for
575 ;; each revision on the trunk are an ordered list of kill and insert
576 ;; commands necessary to go from the chronologically-following
577 ;; revision to this one. That is, associated with revision N are
578 ;; edits that applied to revision N+1 would result in revision N.
580 ;; On a branch, however, (some) things are inverted: the commands
581 ;; listed are those necessary to go from the chronologically-preceding
582 ;; revision to this one. That is, associated with revision N are
583 ;; edits that applied to revision N-1 would result in revision N.
585 ;; So, to get per-line history info, we apply reverse-chronological
586 ;; edits, starting with the head revision on the trunk, all the way
587 ;; back through the initial revision (typically "1.1" or similar),
588 ;; then apply forward-chronological edits -- keeping track of which
589 ;; revision is associated with each inserted line -- until we reach
590 ;; the desired revision for display (which may be either on the trunk
592 (let* ((tree (with-temp-buffer
593 (insert-file-contents (vc-rcs-registered file
))
595 (revisions (cdr (assq 'revisions tree
)))
596 ;; The revision N whose instructions we currently are processing.
597 (cur (cdr (assq 'head
(cdr (assq 'headers tree
)))))
598 ;; Alist from the parse tree for N.
599 (meta (cdr (assoc cur revisions
)))
600 ;; Point and temporary string, respectively.
602 ;; "Next-branch list". Nil means the desired revision to
603 ;; display lives on the trunk. Non-nil means it lives on a
604 ;; branch, in which case the value is a list of revision pairs
605 ;; (PARENT . CHILD), the first PARENT being on the trunk, that
606 ;; links each series of revisions in the path from the initial
607 ;; revision to the desired revision to display.
609 ;; "Path-accumulate-predicate plus revision/date/author".
610 ;; Until set, forward-chronological edits are not accumulated.
611 ;; Once set, its value (updated every revision) is used for
612 ;; the text property `:vc-rcs-r/d/a' for inserts during
613 ;; processing of forward-chronological instructions for N.
614 ;; See internal func `r/d/a'.
616 ;; List of forward-chronological instructions, each of the
617 ;; form: (POS . ACTION), where POS is a buffer position. If
618 ;; ACTION is a string, it is inserted, otherwise it is taken as
619 ;; the number of characters to be deleted.
621 ;; N+1. When `cur' is "", this is the initial revision.
625 (unless (assoc revision revisions
)
626 (error "No such revision: %s" revision
))
627 ;; Find which branches (if any) must be included in the edits.
630 (while (setq bpt
(vc-branch-part par
)
631 par
(vc-branch-part bpt
))
632 (setq kids
(cdr (assq 'branches
(cdr (assoc par revisions
)))))
633 ;; A branchpoint may have multiple children. Find the right one.
634 (while (not (string= bpt
(vc-branch-part (car kids
))))
635 (setq kids
(cdr kids
)))
636 (push (cons par
(car kids
)) nbls
)))
637 ;; Start with the full text.
639 (insert (cdr (assq 'text meta
)))
640 ;; Apply reverse-chronological edits on the trunk, computing and
641 ;; accumulating forward-chronological edits after some point, for
643 (flet ((r/d
/a
() (vector pre
644 (cdr (assq 'date meta
))
645 (cdr (assq 'author meta
)))))
646 (while (when (setq pre cur cur
(cdr (assq 'next meta
)))
647 (not (string= "" cur
)))
649 ;; Start accumulating the forward-chronological edits when N+1
650 ;; on the trunk is either the desired revision to display, or
651 ;; the appropriate branchpoint for it. Do this before
652 ;; updating `meta' since `r/d/a' uses N+1's `meta' value.
653 prda
(when (or prda
(string= (if nbls
(caar nbls
) revision
) pre
))
655 meta
(cdr (assoc cur revisions
)))
656 ;; Edits in the parse tree specify a line number (in the buffer
657 ;; *BEFORE* editing occurs) to start from, but line numbers
658 ;; change as a result of edits. To DTRT, we apply edits in
659 ;; order of descending buffer position so that edits further
660 ;; down in the buffer occur first w/o corrupting specified
661 ;; buffer positions of edits occurring towards the beginning of
662 ;; the buffer. In this way we avoid using markers. A pleasant
663 ;; property of this approach is ability to push instructions
664 ;; onto `path' directly, w/o need to maintain rev boundaries.
665 (dolist (insn (cdr (assq :insn meta
)))
666 (goto-line (pop insn
))
669 (k (setq s
(buffer-substring-no-properties
670 p
(progn (forward-line (car insn
))
673 (push `(,p .
,(propertize s
:vc-rcs-r
/d
/a prda
)) path
))
674 (delete-region p
(point)))
675 (i (setq s
(car insn
))
677 (push `(,p .
,(length s
)) path
))
679 ;; For the initial revision, setting `:vc-rcs-r/d/a' directly is
680 ;; equivalent to pushing an insert instruction (of the entire buffer
681 ;; contents) onto `path' then erasing the buffer, but less wasteful.
682 (put-text-property (point-min) (point-max) :vc-rcs-r
/d
/a
(r/d
/a
))
683 ;; Now apply the forward-chronological edits for the trunk.
685 (goto-char (pop insn
))
689 ;; Now apply the forward-chronological edits (directly from the
690 ;; parse-tree) for the branch(es), if necessary. We re-use vars
691 ;; `pre' and `meta' for the sake of internal func `r/d/a'.
693 (setq pre
(cdr (pop nbls
)))
695 (setq meta
(cdr (assoc pre revisions
))
697 (dolist (insn (cdr (assq :insn meta
)))
698 (goto-line (pop insn
))
701 (point) (progn (forward-line (car insn
))
703 (i (insert (propertize
706 (or prda
(setq prda
(r/d
/a
))))))))
707 (prog1 (not (string= (if nbls
(caar nbls
) revision
) pre
))
708 (setq pre
(cdr (assq 'next meta
)))))))))
709 ;; Lastly, for each line, insert at bol nicely-formatted history info.
710 ;; We do two passes to collect summary information used to minimize
711 ;; the annotation's usage of screen real-estate: (1) Consider rendered
712 ;; width of revision plus author together as a unit; and (2) Omit
713 ;; author entirely if all authors are the same as the user.
714 (let ((ht (make-hash-table :test
'eq
))
715 (me (user-login-name))
719 (goto-char (point-max))
722 (setq rda
(get-text-property (point) :vc-rcs-r
/d
/a
))
723 (unless (gethash rda ht
)
725 all-me
(and all-me
(string= a me
)))
726 (puthash rda
(setq w
(+ (length (aref rda
0))
729 (setq maxw
(max w maxw
))))
730 (let ((padding (make-string maxw
32)))
731 (flet ((pad (w) (substring-no-properties padding w
))
732 (render (rda &rest ls
)
735 (format-time-string "%Y-%m-%d" (aref rda
1))
739 :vc-annotate-prefix t
744 (puthash rda
(render rda
(pad w
) ": ") ht
))
746 (puthash rda
(render rda
" " (pad w
) " " (aref rda
2) ": ") ht
)))
749 (insert (gethash (get-text-property (point) :vc-rcs-r
/d
/a
) ht
))
752 (defun vc-rcs-annotate-current-time ()
753 "Return the current time, based at midnight of the current day, and
754 encoded as fractional days."
755 (vc-annotate-convert-time
756 (apply 'encode-time
0 0 0 (nthcdr 3 (decode-time (current-time))))))
758 (defun vc-rcs-annotate-time ()
759 "Return the time of the next annotation (as fraction of days)
760 systime, or nil if there is none. Also, reposition point."
762 (prog1 (vc-annotate-convert-time
763 (aref (get-text-property (point) :vc-rcs-r
/d
/a
) 1))
764 (goto-char (next-single-property-change (point) :vc-annotate-prefix
)))))
766 (defun vc-rcs-annotate-extract-revision-at-line ()
767 (aref (get-text-property (point) :vc-rcs-r
/d
/a
) 0))
774 (defun vc-rcs-assign-name (file name
)
775 "Assign to FILE's latest version a given NAME."
776 (vc-do-command nil
0 "rcs" (vc-name file
) (concat "-n" name
":")))
783 (defun vc-rcs-check-headers ()
784 "Check if the current file has any headers in it."
786 (goto-char (point-min))
787 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
788 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t
)))
790 (defun vc-rcs-clear-headers ()
791 "Implementation of vc-clear-headers for RCS."
792 (let ((case-fold-search nil
))
793 (goto-char (point-min))
794 (while (re-search-forward
795 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|"
796 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$")
798 (replace-match "$\\1$"))))
800 (defun vc-rcs-rename-file (old new
)
801 ;; Just move the master file (using vc-rcs-master-templates).
802 (vc-rename-master (vc-name old
) new vc-rcs-master-templates
))
806 ;;; Internal functions
809 (defun vc-rcs-root (dir)
810 (vc-find-root dir
"RCS" t
))
812 (defun vc-rcs-workfile-is-newer (file)
813 "Return non-nil if FILE is newer than its RCS master.
814 This likely means that FILE has been changed with respect
815 to its master version."
816 (let ((file-time (nth 5 (file-attributes file
)))
817 (master-time (nth 5 (file-attributes (vc-name file
)))))
818 (or (> (nth 0 file-time
) (nth 0 master-time
))
819 (and (= (nth 0 file-time
) (nth 0 master-time
))
820 (> (nth 1 file-time
) (nth 1 master-time
))))))
822 (defun vc-rcs-find-most-recent-rev (branch)
823 "Find most recent revision on BRANCH."
824 (goto-char (point-min))
825 (let ((latest-rev -
1) value
)
826 (while (re-search-forward (concat "^\\(" (regexp-quote branch
)
827 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;")
829 (let ((rev (string-to-number (match-string 2))))
830 (when (< latest-rev rev
)
831 (setq latest-rev rev
)
832 (setq value
(match-string 1)))))
834 (vc-branch-part branch
))))
836 (defun vc-rcs-fetch-master-state (file &optional working-revision
)
837 "Compute the master file's idea of the state of FILE.
838 If a WORKFILE-VERSION is given, compute the state of that version,
839 otherwise determine the workfile version based on the master file.
840 This function sets the properties `vc-working-revision' and
841 `vc-checkout-model' to their correct values, based on the master
844 (if (or (not (vc-insert-file (vc-name file
) "^[0-9]"))
845 (progn (goto-char (point-min))
846 (not (looking-at "^head[ \t\n]+[^;]+;$"))))
847 (error "File %s is not an RCS master file" (vc-name file
)))
848 (let ((workfile-is-latest nil
)
849 (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1)))
850 (vc-file-setprop file
'vc-rcs-default-branch default-branch
)
851 (unless working-revision
852 ;; Workfile version not known yet. Determine that first. It
853 ;; is either the head of the trunk, the head of the default
854 ;; branch, or the "default branch" itself, if that is a full
858 ((or (not default-branch
) (string= "" default-branch
))
859 (setq working-revision
860 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
861 (setq workfile-is-latest t
))
862 ;; default branch is actually a revision
863 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$"
865 (setq working-revision default-branch
))
866 ;; else, search for the head of the default branch
867 (t (vc-insert-file (vc-name file
) "^desc")
868 (setq working-revision
869 (vc-rcs-find-most-recent-rev default-branch
))
870 (setq workfile-is-latest t
)))
871 (vc-file-setprop file
'vc-working-revision working-revision
))
872 ;; Check strict locking
873 (goto-char (point-min))
874 (vc-file-setprop file
'vc-checkout-model
875 (if (re-search-forward ";[ \t\n]*strict;" nil t
)
877 ;; Compute state of workfile version
878 (goto-char (point-min))
880 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):"
881 (regexp-quote working-revision
)
887 (if (or workfile-is-latest
888 (vc-rcs-latest-on-branch-p file working-revision
))
889 ;; workfile version is latest on branch
891 ;; workfile version is not latest on branch
893 ;; locked by the calling user
894 ((and (stringp locking-user
)
895 (string= locking-user
(vc-user-login-name file
)))
896 (if (or (eq (vc-checkout-model file
) 'locking
)
898 (vc-rcs-latest-on-branch-p file working-revision
))
900 ;; Locking is not used for the file, but the owner does
901 ;; have a lock, and there is a higher version on the current
902 ;; branch. Not sure if this can occur, and if it is right
903 ;; to use `needs-merge' in this case.
905 ;; locked by somebody else
906 ((stringp locking-user
)
909 (error "Error getting state of RCS file")))))))
911 (defun vc-rcs-consult-headers (file)
912 "Search for RCS headers in FILE, and set properties accordingly.
914 Returns: nil if no headers were found
915 'rev if a workfile revision was found
916 'rev-and-lock if revision and lock info was found"
918 ((not (get-file-buffer file
)) nil
)
919 ((let (status version locking-user
)
921 (set-buffer (get-file-buffer file
))
922 (goto-char (point-min))
924 ;; search for $Id or $Header
925 ;; -------------------------
926 ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
927 ((or (and (search-forward "$Id\ : " nil t
)
928 (looking-at "[^ ]+ \\([0-9.]+\\) "))
929 (and (progn (goto-char (point-min))
930 (search-forward "$Header\ : " nil t
))
931 (looking-at "[^ ]+ \\([0-9.]+\\) ")))
932 (goto-char (match-end 0))
933 ;; if found, store the revision number ...
934 (setq version
(match-string-no-properties 1))
935 ;; ... and check for the locking state
938 (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
939 "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
940 "[^ ]+ [^ ]+ ")) ; author & state
941 (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
945 (setq locking-user
'none
)
946 (setq status
'rev-and-lock
))
947 ;; revision is locked by some user
948 ((looking-at "\\([^ ]+\\) \\$")
949 (setq locking-user
(match-string-no-properties 1))
950 (setq status
'rev-and-lock
))
951 ;; everything else: false
953 ;; unexpected information in
954 ;; keyword string --> quit
956 ;; search for $Revision
957 ;; --------------------
958 ((re-search-forward (concat "\\$"
959 "Revision: \\([0-9.]+\\) \\$")
961 ;; if found, store the revision number ...
962 (setq version
(match-string-no-properties 1))
963 ;; and see if there's any lock information
964 (goto-char (point-min))
965 (if (re-search-forward (concat "\\$" "Locker:") nil t
)
966 (cond ((looking-at " \\([^ ]+\\) \\$")
967 (setq locking-user
(match-string-no-properties 1))
968 (setq status
'rev-and-lock
))
969 ((looking-at " *\\$")
970 (setq locking-user
'none
)
971 (setq status
'rev-and-lock
))
973 (setq locking-user
'none
)
974 (setq status
'rev-and-lock
)))
976 ;; else: nothing found
977 ;; -------------------
979 (if status
(vc-file-setprop file
'vc-working-revision version
))
980 (and (eq status
'rev-and-lock
)
981 (vc-file-setprop file
'vc-state
983 ((eq locking-user
'none
) 'up-to-date
)
984 ((string= locking-user
(vc-user-login-name file
))
987 ;; If the file has headers, we don't want to query the
988 ;; master file, because that would eliminate all the
989 ;; performance gain the headers brought us. We therefore
990 ;; use a heuristic now to find out whether locking is used
991 ;; for this file. If we trust the file permissions, and the
992 ;; file is not locked, then if the file is read-only we
993 ;; assume that locking is used for the file, otherwise
994 ;; locking is not used.
995 (not (vc-mistrust-permissions file
))
996 (vc-up-to-date-p file
)
997 (if (string-match ".r-..-..-." (nth 8 (file-attributes file
)))
998 (vc-file-setprop file
'vc-checkout-model
'locking
)
999 (vc-file-setprop file
'vc-checkout-model
'implicit
)))
1002 (defun vc-release-greater-or-equal (r1 r2
)
1003 "Compare release numbers, represented as strings.
1004 Release components are assumed cardinal numbers, not decimal fractions
1005 \(5.10 is a higher release than 5.9\). Omitted fields are considered
1006 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end
1007 of the string is found, or a non-numeric component shows up \(5.6.7 is
1008 earlier than \"5.6.7 beta\", which is probably not what you want in
1009 some cases\). This code is suitable for existing RCS release numbers.
1010 CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5\)."
1013 (or (and (string-match "^\\.?\\([0-9]+\\)" r1
)
1014 (setq i1
(match-end 0))
1015 (setq v1
(string-to-number (match-string 1 r1
)))
1016 (or (and (string-match "^\\.?\\([0-9]+\\)" r2
)
1017 (setq i2
(match-end 0))
1018 (setq v2
(string-to-number (match-string 1 r2
)))
1019 (if (> v1 v2
) (throw 'done t
)
1020 (if (< v1 v2
) (throw 'done nil
)
1022 (vc-release-greater-or-equal
1024 (substring r2 i2
)))))))
1026 (or (and (string-match "^\\.?\\([0-9]+\\)" r2
)
1030 (defun vc-rcs-release-p (release)
1031 "Return t if we have RELEASE or better."
1032 (let ((installation (vc-rcs-system-release)))
1033 (if (and installation
1034 (not (eq installation
'unknown
)))
1035 (vc-release-greater-or-equal installation release
))))
1037 (defun vc-rcs-system-release ()
1038 "Return the RCS release installed on this system, as a string.
1039 Return symbol UNKNOWN if the release cannot be deducted. The user can
1040 override this using variable `vc-rcs-release'.
1042 If the user has not set variable `vc-rcs-release' and it is nil,
1043 variable `vc-rcs-release' is set to the returned value."
1045 (setq vc-rcs-release
1046 (or (and (zerop (vc-do-command nil nil
"rcs" nil
"-V"))
1047 (with-current-buffer (get-buffer "*vc*")
1048 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1)))
1051 (defun vc-rcs-set-non-strict-locking (file)
1052 (vc-do-command nil
0 "rcs" file
"-U")
1053 (vc-file-setprop file
'vc-checkout-model
'implicit
)
1054 (set-file-modes file
(logior (file-modes file
) 128)))
1056 (defun vc-rcs-set-default-branch (file branch
)
1057 (vc-do-command nil
0 "rcs" (vc-name file
) (concat "-b" branch
))
1058 (vc-file-setprop file
'vc-rcs-default-branch branch
))
1060 (defun vc-rcs-parse (&optional buffer
)
1061 "Parse current buffer, presumed to be in RCS-style masterfile format.
1062 Optional arg BUFFER specifies another buffer to parse. Return an alist
1063 of two elements, w/ keys `headers' and `revisions' and values in turn
1064 sub-alists. For `headers', the values unless otherwise specified are
1065 strings and the keys are:
1068 head -- latest revision
1069 branch -- the branch the \"head revision\" lies on;
1070 absent if the head revision lies on the trunk
1072 symbols -- sub-alist of (SYMBOL . REVISION) elements
1073 locks -- if file is checked out, something like \"ttn:1.7\"
1074 strict -- t if \"strict locking\" is in effect, otherwise nil
1075 comment -- may be absent; typically something like \"# \" or \"; \"
1076 expand -- may be absent; ???
1078 For `revisions', the car is REVISION (string), the cdr a sub-alist,
1079 with string values (unless otherwise specified) and keys:
1081 date -- a time value (like that returned by `encode-time'); as a
1082 special case, a year value less than 100 is augmented by 1900
1084 state -- typically \"Exp\" or \"Rel\"
1085 branches -- list of revisions that begin branches from this revision
1086 next -- on the trunk: the chronologically-preceding revision, or \"\";
1087 on a branch: the chronologically-following revision, or \"\"
1088 log -- change log entry
1089 text -- for the head revision on the trunk, the body of the file;
1090 other revisions have `:insn' instead
1091 :insn -- for non-head revisions, a list of parsed instructions
1092 in one of two forms, in both cases START meaning \"first
1094 - `(START k COUNT)' -- kill COUNT lines
1095 - `(START i TEXT)' -- insert TEXT (a string)
1096 The list is in descending order by START.
1098 The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
1099 (setq buffer
(get-buffer (or buffer
(current-buffer))))
1101 ;; An RCS masterfile can be viewed as containing four regular (for the
1102 ;; most part) sections: (a) the "headers", (b) the "rev headers", (c)
1103 ;; the "description" and (d) the "rev bodies", in that order. In the
1104 ;; returned alist (see docstring), elements from (b) and (d) are
1105 ;; combined pairwise to form the "revisions", while those from (a) and
1106 ;; (c) are simply combined to form the "headers".
1108 ;; Loosely speaking, each section contains a series of alternating
1109 ;; "tags" and "printed representations". In the (b) and (d), many
1110 ;; such series can appear, and a revision number on a line by itself
1111 ;; precedes the series of tags and printed representations associated
1114 ;; In (a) and (b), the printed representations (with the exception of
1115 ;; the `comment' tag in the headers) terminate with a semicolon, which
1116 ;; is NOT part of the "value" finally associated with the tag. All
1117 ;; other printed representations are in "@@-format"; there is an "@",
1118 ;; the middle part (to be translated into the value), another "@" and
1119 ;; a newline. Each "@@" in the middle part indicates the position of
1120 ;; a single "@" (and consequently the requirement of an additional
1121 ;; initial step when translating to the value).
1123 ;; Parser state includes vars that collect parts of the return value...
1124 (let ((desc nil
) (headers nil
) (revs nil
)
1125 ;; ... as well as vars that support a single-pass, tag-assisted,
1126 ;; minimal-data-copying scan. Basically -- skirting around the
1127 ;; grouping by revision required in (b) and (d) -- we repeatedly
1128 ;; and context-sensitively read a tag (that MUST be present),
1129 ;; determine the bounds of the printed representation, translate
1130 ;; it into a value, and push the tag plus value onto one of the
1131 ;; collection vars. Finally, we return the parse tree
1132 ;; incorporating the values of the collection vars (see "rv").
1134 ;; A symbol or string to keep track of context (for error messages).
1136 ;; A symbol, the current tag.
1138 ;; Region (begin and end buffer positions) of the printed
1139 ;; representation for the current tag.
1141 ;; A list of buffer positions where "@@" can be found within the
1142 ;; printed representation region. For each location, we push two
1143 ;; elements onto the list, 1+ and 2+ the location, respectively,
1144 ;; with the 2+ appearing at the head. In this way, the expression
1145 ;; `(,e ,@@-holes ,b)
1146 ;; describes regions that can be concatenated (in reverse order)
1147 ;; to "de-@@-format" the printed representation as the first step
1148 ;; to translating it into some value. See internal func `gather'.
1150 (flet ((sw () (skip-chars-forward " \t\n")) ; i.e., `[:space:]'
1151 (at (tag) (save-excursion (eq tag
(read buffer
))))
1152 (to-eol () (buffer-substring-no-properties
1153 (point) (progn (forward-line 1)
1155 (to-semi () (setq b
(point)
1156 e
(progn (search-forward ";")
1158 (to-one@ () (setq @-holes nil
1159 b
(progn (search-forward "@") (point))
1160 e
(progn (while (and (search-forward "@")
1163 (push (point) @-holes
)
1165 (push (point) @-holes
))))
1167 (tok+val
(set-b+e name
&optional proc
)
1168 (unless (eq name
(setq tok
(read buffer
)))
1169 (error "Missing `%s' while parsing %s" name context
))
1174 (buffer-substring-no-properties b e
))))
1175 (k-semi (name &optional proc
) (tok+val
'to-semi name proc
))
1176 (gather () (let ((pairs `(,e
,@@-holes
,b
))
1179 (push (buffer-substring-no-properties
1180 (cadr pairs
) (car pairs
))
1182 (setq pairs
(cddr pairs
)))
1183 (apply 'concat acc
)))
1184 (k-one@ (name &optional later
) (tok+val
'to-one
@ name
1189 (goto-char (point-min))
1191 (setq context
'headers
)
1192 (flet ((hpush (name &optional proc
)
1193 (push (k-semi name proc
) headers
)))
1200 (mapcar (lambda (together)
1201 (let ((two (split-string together
":")))
1202 (setcar two
(intern (car two
)))
1203 (setcdr two
(cadr two
))
1206 (buffer-substring-no-properties b e
)))))
1208 (push `(strict .
,(when (at 'strict
)
1209 (search-forward ";")
1213 (push (k-one@ 'comment
) headers
)
1214 (search-forward ";"))
1216 (push (k-one@ 'expand
) headers
)
1217 (search-forward ";"))
1218 (setq headers
(nreverse headers
))
1220 (sw) (setq context
'rev-headers
)
1221 (while (looking-at "[0-9]")
1225 (let ((ls (mapcar 'string-to-number
1227 (buffer-substring-no-properties
1230 ;; Hack the year -- verified to be the
1231 ;; same algorithm used in RCS 5.7.
1232 (when (< (car ls
) 100)
1233 (setcar ls
(+ 1900 (car ls
))))
1234 (apply 'encode-time
(nreverse ls
)))))
1235 ,@(mapcar 'k-semi
'(author state
))
1239 (buffer-substring-no-properties b e
))))
1243 (setq revs
(nreverse revs
))
1245 (sw) (setq context
'desc
1246 desc
(k-one@ 'desc
))
1249 ;; Element of `revs' that initially holds only header info.
1250 ;; "Pairwise combination" occurs when we add body info.
1252 ;; Components of the editing commands (aside from the actual
1253 ;; text) that comprise the `text' printed representations
1254 ;; (not including the "head" revision).
1256 ;; Ascending (reversed) `@-holes' which the internal func
1257 ;; `incg' pops to effect incremental gathering.
1259 ;; Function to extract text (for the `a' command), either
1260 ;; `incg' or `buffer-substring-no-properties'. (This is
1261 ;; for speed; strictly speaking, it is sufficient to use
1262 ;; only the former since it behaves identically to the
1263 ;; latter in the absense of "@@".)
1265 (flet ((incg (beg end
) (let ((b beg
) (e end
) @-holes
)
1266 (while (and asc
(< (car asc
) e
))
1267 (push (pop asc
) @-holes
))
1268 ;; Self-deprecate when work is done.
1269 ;; Folding many dimensions into one.
1270 ;; Thanks B.Mandelbrot, for complex sum.
1271 ;; O beauteous math! --the Unvexed Bum
1273 (setq sub
'buffer-substring-no-properties
))
1277 (setq context
(to-eol)
1278 rev
(or (assoc context revs
)
1279 (error "Rev `%s' has body but no head"
1281 (push (k-one@ 'log
) (cdr rev
))
1282 ;; For rev body `text' tags, delay translation slightly...
1283 (push (k-one@ 'text t
) (cdr rev
))
1284 ;; ... until we decide which tag and value is appropriate to
1285 ;; collect. For the "head" revision, compute the value of the
1286 ;; `text' printed representation by simple `gather'. For all
1287 ;; other revisions, replace the `text' tag+value with `:insn'
1288 ;; plus value, always scanning in-place.
1289 (if (string= context
(cdr (assq 'head headers
)))
1290 (setcdr (cadr rev
) (gather))
1292 (setq asc
(nreverse @-holes
)
1294 (setq sub
'buffer-substring-no-properties
))
1297 (while (< (point) e
)
1299 (setq cmd
(char-before)
1300 start
(read (current-buffer))
1301 act
(read (current-buffer)))
1305 ;; `d' means "delete lines".
1306 ;; For Emacs spirit, we use `k' for "kill".
1309 ;; `a' means "append after this line" but
1310 ;; internally we normalize it so that START
1311 ;; specifies the actual line for insert, thus
1312 ;; requiring less hair in the realization algs.
1313 ;; For Emacs spirit, we use `i' for "insert".
1315 ,(funcall sub
(point) (progn (forward-line act
)
1317 (t (error "Bad command `%c' in `text' for rev `%s'"
1321 (setcar (cdr rev
) (cons :insn acc
)))))))
1323 `((headers ,desc
,@headers
)
1324 (revisions ,@revs
)))))
1328 ;; arch-tag: 759b4916-5b0d-431d-b647-b185b8c652cf
1329 ;;; vc-rcs.el ends here