Mercurial > emacs
annotate lisp/vc-sccs.el @ 50027:95d928fb74f3
(command-line-x-option-alist): Make --border-color set the border-color frame
parameter, not border-width.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 05 Mar 2003 16:31:44 +0000 |
parents | e88404e8f2cf |
children | b12a550504a4 d7ddb3e565de |
rev | line source |
---|---|
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1 ;;; vc-sccs.el --- support for SCCS version-control |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2 |
35830 | 3 ;; Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
4 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
5 ;; Author: FSF (see vc.el for full credits) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
7 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
8 ;; $Id: vc-sccs.el,v 1.20 2002/12/26 14:07:15 spiegel Exp $ |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
9 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
15 ;; any later version. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
16 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
21 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
25 ;; Boston, MA 02111-1307, USA. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
26 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
27 ;;; Commentary: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
29 ;;; Code: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
30 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
31 (eval-when-compile |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
32 (require 'vc)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
33 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
34 ;;; |
33560 | 35 ;;; Customization options |
36 ;;; | |
37 | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
38 (defcustom vc-sccs-register-switches nil |
31477 | 39 "*Extra switches for registering a file in SCCS. |
40 A string or list of strings passed to the checkin program by | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
41 \\[vc-sccs-register]." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
42 :type '(choice (const :tag "None" nil) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
43 (string :tag "Argument String") |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
44 (repeat :tag "Argument List" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
45 :value ("") |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 string)) |
31477 | 47 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
48 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
50 (defcustom vc-sccs-diff-switches nil |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
51 "*A string or list of strings specifying extra switches for `vcdiff', |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
52 the diff utility used for SCCS under VC." |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
53 :type '(choice (const :tag "None" nil) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
54 (string :tag "Argument String") |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
55 (repeat :tag "Argument List" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
56 :value ("") |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
57 string)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
58 :version "21.1" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
59 :group 'vc) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
60 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
61 (defcustom vc-sccs-header (or (cdr (assoc 'SCCS vc-header-alist)) '("%W%")) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 "*Header keywords to be inserted by `vc-insert-headers'." |
35179 | 63 :type '(repeat string) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
64 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
65 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 ;;;###autoload |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 (defcustom vc-sccs-master-templates |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
69 "*Where to look for SCCS master files. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
70 For a description of possible values, see `vc-check-master-templates'." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 :type '(choice (const :tag "Use standard SCCS file names" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 ("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
73 (repeat :tag "User-specified" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
74 (choice string |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 function))) |
31477 | 76 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 |
33560 | 79 |
80 ;;; | |
81 ;;; Internal variables | |
82 ;;; | |
83 | |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31385
diff
changeset
|
84 (defconst vc-sccs-name-assoc-file "VC-names") |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31385
diff
changeset
|
85 |
33560 | 86 |
87 ;;; | |
88 ;;; State-querying functions | |
89 ;;; | |
90 | |
48281
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
91 ;;; The autoload cookie below places vc-sccs-registered directly into |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
92 ;;; loaddefs.el, so that vc-sccs.el does not need to be loaded for |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
93 ;;; every file that is visited. The definition is repeated below |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
94 ;;; so that Help and etags can find it. |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
95 |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
96 ;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f)) |
48264
63fc09a69c40
(vc-sccs-registered): Handle the autoload cookie so that the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47806
diff
changeset
|
97 (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
98 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
99 (defun vc-sccs-state (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
100 "SCCS-specific function to compute the version control state." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
101 (with-temp-buffer |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
102 (if (vc-insert-file (vc-sccs-lock-file file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
103 (let* ((locks (vc-sccs-parse-locks)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
104 (workfile-version (vc-workfile-version file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
105 (locking-user (cdr (assoc workfile-version locks)))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
106 (if (not locking-user) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
107 (if (vc-workfile-unchanged-p file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
108 'up-to-date |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
109 'unlocked-changes) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 (if (string= locking-user (vc-user-login-name)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
111 'edited |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
112 locking-user))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 'up-to-date))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
115 (defun vc-sccs-state-heuristic (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
116 "SCCS-specific state heuristic." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
117 (if (not (vc-mistrust-permissions file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
118 ;; This implementation assumes that any file which is under version |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
119 ;; control and has -rw-r--r-- is locked by its owner. This is true |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
120 ;; for both RCS and SCCS, which keep unlocked files at -r--r--r--. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
121 ;; We have to be careful not to exclude files with execute bits on; |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
122 ;; scripts can be under version control too. Also, we must ignore the |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
123 ;; group-read and other-read bits, since paranoid users turn them off. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
124 (let* ((attributes (file-attributes file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
125 (owner-uid (nth 2 attributes)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
126 (permissions (nth 8 attributes))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 (if (string-match ".r-..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
128 'up-to-date |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 (if (string-match ".rw..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 (if (file-ownership-preserved-p file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 'edited |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 (vc-user-login-name owner-uid)) |
31477 | 133 ;; Strange permissions. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
134 ;; Fall through to real state computation. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
135 (vc-sccs-state file))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
136 (vc-sccs-state file)))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
137 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 (defun vc-sccs-workfile-version (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
139 "SCCS-specific version of `vc-workfile-version'." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
140 (with-temp-buffer |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
141 (vc-insert-file (vc-name file) "^\001e") |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
142 (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
143 |
31477 | 144 (defun vc-sccs-checkout-model (file) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
145 "SCCS-specific version of `vc-checkout-model'." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
146 'locking) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
147 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
148 (defun vc-sccs-workfile-unchanged-p (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
149 "SCCS-specific implementation of vc-workfile-unchanged-p." |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
150 (zerop (apply 'vc-do-command nil 1 "vcdiff" (vc-name file) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
151 (list "--brief" "-q" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
152 (concat "-r" (vc-workfile-version file)))))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
154 |
33560 | 155 ;;; |
156 ;;; State-changing functions | |
157 ;;; | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
158 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 (defun vc-sccs-register (file &optional rev comment) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 "Register FILE into the SCCS version-control system. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
161 REV is the optional revision number for the file. COMMENT can be used |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
162 to provide an initial description of FILE. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
163 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
164 `vc-register-switches' and `vc-sccs-register-switches' are passed to |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
165 the SCCS command (in that order). |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
166 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
167 Automatically retrieve a read-only version of the file with keywords |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
168 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." |
44006
1d4bea19e7d4
(vc-sccs-register): Fix handling of vc-[sccs-]register-switches.
André Spiegel <spiegel@gnu.org>
parents:
43535
diff
changeset
|
169 (let* ((switches (append |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 (if (stringp vc-register-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
171 (list vc-register-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 vc-register-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
173 (if (stringp vc-sccs-register-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
174 (list vc-sccs-register-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 vc-sccs-register-switches))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
176 (dirname (or (file-name-directory file) "")) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
177 (basename (file-name-nondirectory file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 (project-file (vc-sccs-search-project-dir dirname basename))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
179 (let ((vc-name |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
180 (or project-file |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
181 (format (car vc-sccs-master-templates) dirname basename)))|) |
37051
92a0a59a48ee
(vc-sccs-register): Use relative file names.
André Spiegel <spiegel@gnu.org>
parents:
36713
diff
changeset
|
182 (apply 'vc-do-command nil 0 "admin" vc-name |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
183 (and rev (concat "-r" rev)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
184 "-fb" |
37051
92a0a59a48ee
(vc-sccs-register): Use relative file names.
André Spiegel <spiegel@gnu.org>
parents:
36713
diff
changeset
|
185 (concat "-i" (file-relative-name file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 (and comment (concat "-y" comment)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 switches)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
188 (delete-file file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
189 (if vc-keep-workfiles |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 (vc-do-command nil 0 "get" (vc-name file))))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
191 |
33560 | 192 (defun vc-sccs-responsible-p (file) |
193 "Return non-nil if SCCS thinks it would be responsible for registering FILE." | |
194 ;; TODO: check for all the patterns in vc-sccs-master-templates | |
195 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) | |
196 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") | |
197 (file-name-nondirectory file))))) | |
198 | |
199 (defun vc-sccs-checkin (file rev comment) | |
200 "SCCS-specific version of `vc-backend-checkin'." | |
201 (let ((switches (if (stringp vc-checkin-switches) | |
202 (list vc-checkin-switches) | |
203 vc-checkin-switches))) | |
204 (apply 'vc-do-command nil 0 "delta" (vc-name file) | |
205 (if rev (concat "-r" rev)) | |
206 (concat "-y" comment) | |
207 switches) | |
208 (if vc-keep-workfiles | |
209 (vc-do-command nil 0 "get" (vc-name file))))) | |
210 | |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
211 (defun vc-sccs-find-version (file rev buffer) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
212 (apply 'vc-do-command |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
213 buffer 0 "get" (vc-name file) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
214 "-s" ;; suppress diagnostic output |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
215 "-p" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
216 (and rev |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
217 (concat "-r" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
218 (vc-sccs-lookup-triple file rev))) |
47806
10d173c975ef
(vc-sccs-find-version): Fix vc-checkout-switches use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47798
diff
changeset
|
219 (if (stringp vc-checkout-switches) |
10d173c975ef
(vc-sccs-find-version): Fix vc-checkout-switches use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47798
diff
changeset
|
220 (list vc-checkout-switches) |
10d173c975ef
(vc-sccs-find-version): Fix vc-checkout-switches use.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47798
diff
changeset
|
221 vc-checkout-switches))) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
222 |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
223 (defun vc-sccs-checkout (file &optional editable rev) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
224 "Retrieve a copy of a saved version of SCCS controlled FILE. |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
225 EDITABLE non-nil means that the file should be writable and |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
226 locked. REV is the revision to check out." |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
227 (let ((file-buffer (get-file-buffer file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
228 switches) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
229 (message "Checking out %s..." file) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
230 (save-excursion |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
231 ;; Change buffers to get local value of vc-checkout-switches. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
232 (if file-buffer (set-buffer file-buffer)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
233 (setq switches (if (stringp vc-checkout-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
234 (list vc-checkout-switches) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
235 vc-checkout-switches)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
236 ;; Save this buffer's default-directory |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
237 ;; and use save-excursion to make sure it is restored |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
238 ;; in the same buffer it was saved in. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
239 (let ((default-directory default-directory)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
240 (save-excursion |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
241 ;; Adjust the default-directory so that the check-out creates |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
242 ;; the file in the right place. |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
243 (setq default-directory (file-name-directory file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
244 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
245 (and rev (or (string= rev "") |
48967
9f461f463a94
(vc-sccs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48281
diff
changeset
|
246 (not (stringp rev))) |
9f461f463a94
(vc-sccs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48281
diff
changeset
|
247 (setq rev nil)) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
248 (apply 'vc-do-command nil 0 "get" (vc-name file) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
249 (if editable "-e") |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
250 (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
251 switches)))) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
252 (message "Checking out %s...done" file))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
253 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
254 (defun vc-sccs-revert (file &optional contents-done) |
33560 | 255 "Revert FILE to the version it was based on." |
256 (vc-do-command nil 0 "unget" (vc-name file)) | |
257 (vc-do-command nil 0 "get" (vc-name file)) | |
258 ;; Checking out explicit versions is not supported under SCCS, yet. | |
259 ;; We always "revert" to the latest version; therefore | |
260 ;; vc-workfile-version is cleared here so that it gets recomputed. | |
261 (vc-file-setprop file 'vc-workfile-version nil)) | |
262 | |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
263 (defun vc-sccs-cancel-version (file editable) |
33560 | 264 "Undo the most recent checkin of FILE. |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
265 EDITABLE non-nil means previous version should be locked." |
33560 | 266 (vc-do-command nil 0 "rmdel" |
267 (vc-name file) | |
268 (concat "-r" (vc-workfile-version file))) | |
269 (vc-do-command nil 0 "get" | |
270 (vc-name file) | |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
271 (if editable "-e"))) |
33560 | 272 |
273 (defun vc-sccs-steal-lock (file &optional rev) | |
274 "Steal the lock on the current workfile for FILE and revision REV." | |
275 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev))) | |
276 (vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev)))) | |
277 | |
278 | |
279 ;;; | |
280 ;;; History functions | |
281 ;;; | |
282 | |
283 (defun vc-sccs-print-log (file) | |
284 "Get change log associated with FILE." | |
36713
e7e3ef788639
(vc-sccs-print-log): Output to buffer *vc*, not the current buffer.
André Spiegel <spiegel@gnu.org>
parents:
35830
diff
changeset
|
285 (vc-do-command nil 0 "prs" (vc-name file))) |
33560 | 286 |
287 (defun vc-sccs-logentry-check () | |
288 "Check that the log entry in the current buffer is acceptable for SCCS." | |
289 (when (>= (buffer-size) 512) | |
290 (goto-char 512) | |
291 (error "Log must be less than 512 characters; point is now at pos 512"))) | |
292 | |
293 (defun vc-sccs-diff (file &optional oldvers newvers) | |
294 "Get a difference report using SCCS between two versions of FILE." | |
295 (setq oldvers (vc-sccs-lookup-triple file oldvers)) | |
296 (setq newvers (vc-sccs-lookup-triple file newvers)) | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
297 (apply 'vc-do-command "*vc-diff*" 1 "vcdiff" (vc-name file) |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
298 (append (list "-q" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
299 (and oldvers (concat "-r" oldvers)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
300 (and newvers (concat "-r" newvers))) |
43535
4f17582ed40a
(vc-sccs-diff): Use consistent parameter format for
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
301 (vc-diff-switches-list 'SCCS)))) |
33560 | 302 |
303 | |
304 ;;; | |
305 ;;; Snapshot system | |
306 ;;; | |
307 | |
308 (defun vc-sccs-assign-name (file name) | |
309 "Assign to FILE's latest version a given NAME." | |
310 (vc-sccs-add-triple name file (vc-workfile-version file))) | |
311 | |
312 | |
313 ;;; | |
314 ;;; Miscellaneous | |
315 ;;; | |
316 | |
317 (defun vc-sccs-check-headers () | |
318 "Check if the current file has any headers in it." | |
319 (save-excursion | |
320 (goto-char (point-min)) | |
321 (re-search-forward "%[A-Z]%" nil t))) | |
322 | |
323 (defun vc-sccs-rename-file (old new) | |
324 ;; Move the master file (using vc-rcs-master-templates). | |
325 (vc-rename-master (vc-name old) new vc-sccs-master-templates) | |
326 ;; Update the snapshot file. | |
327 (with-current-buffer | |
328 (find-file-noselect | |
329 (expand-file-name vc-sccs-name-assoc-file | |
330 (file-name-directory (vc-name old)))) | |
331 (goto-char (point-min)) | |
332 ;; (replace-regexp (concat ":" (regexp-quote old) "$") (concat ":" new)) | |
333 (while (re-search-forward (concat ":" (regexp-quote old) "$") nil t) | |
334 (replace-match (concat ":" new) nil nil)) | |
335 (basic-save-buffer) | |
336 (kill-buffer (current-buffer)))) | |
337 | |
338 | |
339 ;;; | |
340 ;;; Internal functions | |
341 ;;; | |
342 | |
343 ;; This function is wrapped with `progn' so that the autoload cookie | |
344 ;; copies the whole function itself into loaddefs.el rather than just placing | |
345 ;; a (autoload 'vc-sccs-search-project-dir "vc-sccs") which would not | |
346 ;; help us avoid loading vc-sccs. | |
347 ;;;###autoload | |
348 (progn (defun vc-sccs-search-project-dir (dirname basename) | |
349 "Return the name of a master file in the SCCS project directory. | |
350 Does not check whether the file exists but returns nil if it does not | |
351 find any project directory." | |
352 (let ((project-dir (getenv "PROJECTDIR")) dirs dir) | |
353 (when project-dir | |
354 (if (file-name-absolute-p project-dir) | |
355 (setq dirs '("SCCS" "")) | |
356 (setq dirs '("src/SCCS" "src" "source/SCCS" "source")) | |
357 (setq project-dir (expand-file-name (concat "~" project-dir)))) | |
358 (while (and (not dir) dirs) | |
359 (setq dir (expand-file-name (car dirs) project-dir)) | |
360 (unless (file-directory-p dir) | |
361 (setq dir nil) | |
362 (setq dirs (cdr dirs)))) | |
363 (and dir (expand-file-name (concat "s." basename) dir)))))) | |
364 | |
365 (defun vc-sccs-lock-file (file) | |
366 "Generate lock file name corresponding to FILE." | |
367 (let ((master (vc-name file))) | |
368 (and | |
369 master | |
370 (string-match "\\(.*/\\)\\(s\\.\\)\\(.*\\)" master) | |
371 (replace-match "p." t t master 2)))) | |
372 | |
373 (defun vc-sccs-parse-locks () | |
374 "Parse SCCS locks in current buffer. | |
375 The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)." | |
376 (let (master-locks) | |
377 (goto-char (point-min)) | |
378 (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?" | |
379 nil t) | |
380 (setq master-locks | |
381 (cons (cons (match-string 1) (match-string 2)) master-locks))) | |
382 ;; FIXME: is it really necessary to reverse ? | |
383 (nreverse master-locks))) | |
384 | |
385 (defun vc-sccs-add-triple (name file rev) | |
386 (with-current-buffer | |
387 (find-file-noselect | |
388 (expand-file-name vc-sccs-name-assoc-file | |
389 (file-name-directory (vc-name file)))) | |
390 (goto-char (point-max)) | |
391 (insert name "\t:\t" file "\t" rev "\n") | |
392 (basic-save-buffer) | |
393 (kill-buffer (current-buffer)))) | |
394 | |
395 (defun vc-sccs-lookup-triple (file name) | |
396 "Return the numeric version corresponding to a named snapshot of FILE. | |
397 If NAME is nil or a version number string it's just passed through." | |
398 (if (or (null name) | |
399 (let ((firstchar (aref name 0))) | |
400 (and (>= firstchar ?0) (<= firstchar ?9)))) | |
401 name | |
402 (with-temp-buffer | |
403 (vc-insert-file | |
404 (expand-file-name vc-sccs-name-assoc-file | |
405 (file-name-directory (vc-name file)))) | |
406 (vc-parse-buffer (concat name "\t:\t" file "\t\\(.+\\)") 1)))) | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
407 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
408 (provide 'vc-sccs) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
409 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
410 ;;; vc-sccs.el ends here |