Mercurial > emacs
annotate lisp/vc-sccs.el @ 69458:69028f972cae
*** empty log message ***
author | David Ponce <david@dponce.com> |
---|---|
date | Mon, 13 Mar 2006 07:48:29 +0000 |
parents | 3bd95f4f2941 |
children | e3694f1cb928 b98066f4aa10 c5406394f567 |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68416
diff
changeset
|
4 ;; 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
5 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
6 ;; 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
|
7 ;; 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
|
8 |
56953 | 9 ;; $Id$ |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 ;; 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
|
12 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
13 ;; 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
|
14 ;; 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
|
15 ;; 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
|
16 ;; any later version. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
17 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
23 ;; 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
|
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
27 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 ;;; Commentary: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
29 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
30 ;;; Code: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
31 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
32 (eval-when-compile |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
33 (require 'vc)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
34 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
35 ;;; |
33560 | 36 ;;; Customization options |
37 ;;; | |
38 | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
39 (defcustom vc-sccs-register-switches nil |
31477 | 40 "*Extra switches for registering a file in SCCS. |
41 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
|
42 \\[vc-sccs-register]." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
43 :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
|
44 (string :tag "Argument String") |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
45 (repeat :tag "Argument List" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 :value ("") |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 string)) |
31477 | 48 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
50 |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
51 (defcustom vc-sccs-diff-switches nil |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
52 "*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
|
53 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
|
54 :type '(choice (const :tag "None" nil) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
55 (string :tag "Argument String") |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
56 (repeat :tag "Argument List" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
57 :value ("") |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
58 string)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
59 :version "21.1" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
60 :group 'vc) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
61 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 (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
|
63 "*Header keywords to be inserted by `vc-insert-headers'." |
35179 | 64 :type '(repeat string) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
65 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 ;;;###autoload |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 (defcustom vc-sccs-master-templates |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
69 '("%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
|
70 "*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
|
71 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
|
72 :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
|
73 ("%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
|
74 (repeat :tag "User-specified" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 (choice string |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 function))) |
31477 | 77 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 |
33560 | 80 |
81 ;;; | |
82 ;;; Internal variables | |
83 ;;; | |
84 | |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31385
diff
changeset
|
85 (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
|
86 |
33560 | 87 |
88 ;;; | |
89 ;;; State-querying functions | |
90 ;;; | |
91 | |
48281
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
92 ;;; 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
|
93 ;;; 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
|
94 ;;; 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
|
95 ;;; so that Help and etags can find it. |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
96 |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
97 ;;;###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
|
98 (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
|
99 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
100 (defun vc-sccs-state (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
101 "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
|
102 (with-temp-buffer |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
103 (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
|
104 (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
|
105 (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
|
106 (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
|
107 (if (not locking-user) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
108 (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
|
109 'up-to-date |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 'unlocked-changes) |
68416
64e8a95ba226
(vc-sccs-state): Pass FILE to vc-user-login-name.
André Spiegel <spiegel@gnu.org>
parents:
68333
diff
changeset
|
111 (if (string= locking-user (vc-user-login-name file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
112 'edited |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 locking-user))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 'up-to-date))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
115 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
116 (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
|
117 "SCCS-specific state heuristic." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
118 (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
|
119 ;; 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
|
120 ;; 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
|
121 ;; 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
|
122 ;; 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
|
123 ;; 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
|
124 ;; group-read and other-read bits, since paranoid users turn them off. |
68333
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
125 (let* ((attributes (file-attributes file 'string)) |
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
126 (owner-name (nth 2 attributes)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 (permissions (nth 8 attributes))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
128 (if (string-match ".r-..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 'up-to-date |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 (if (string-match ".rw..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 (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
|
132 'edited |
68333
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
133 owner-name) |
52179
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
134 ;; Strange permissions. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
135 ;; Fall through to real state computation. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
136 (vc-sccs-state file)))) |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
137 (vc-sccs-state file))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
139 (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
|
140 "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
|
141 (with-temp-buffer |
52179
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
142 ;; The workfile version is always the latest version number. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
143 ;; To find this number, search the entire delta table, |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
144 ;; rather than just the first entry, because the |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
145 ;; first entry might be a deleted ("R") version. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
146 (vc-insert-file (vc-name file) "^\001e\n\001[^s]") |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
147 (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
|
148 |
31477 | 149 (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
|
150 "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
|
151 'locking) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
152 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 (defun vc-sccs-workfile-unchanged-p (file) |
56953 | 154 "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
|
155 (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
|
156 (list "--brief" "-q" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
157 (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
|
158 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 |
33560 | 160 ;;; |
161 ;;; State-changing functions | |
162 ;;; | |
31385
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 (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
|
165 "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
|
166 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
|
167 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
|
168 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 `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
|
170 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
|
171 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 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
|
173 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
174 (let* ((dirname (or (file-name-directory file) "")) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 (basename (file-name-nondirectory file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
176 (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
|
177 (let ((vc-name |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 (or project-file |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
179 (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
|
180 (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
|
181 (and rev (concat "-r" rev)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
182 "-fb" |
37051
92a0a59a48ee
(vc-sccs-register): Use relative file names.
André Spiegel <spiegel@gnu.org>
parents:
36713
diff
changeset
|
183 (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
|
184 (and comment (concat "-y" comment)) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
185 (vc-switches 'SCCS 'register))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 (delete-file file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 (if vc-keep-workfiles |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
188 (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
|
189 |
33560 | 190 (defun vc-sccs-responsible-p (file) |
191 "Return non-nil if SCCS thinks it would be responsible for registering FILE." | |
192 ;; TODO: check for all the patterns in vc-sccs-master-templates | |
193 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) | |
194 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") | |
195 (file-name-nondirectory file))))) | |
196 | |
197 (defun vc-sccs-checkin (file rev comment) | |
198 "SCCS-specific version of `vc-backend-checkin'." | |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
199 (apply 'vc-do-command nil 0 "delta" (vc-name file) |
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
200 (if rev (concat "-r" rev)) |
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
201 (concat "-y" comment) |
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
202 (vc-switches 'SCCS 'checkin)) |
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
203 (if vc-keep-workfiles |
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
204 (vc-do-command nil 0 "get" (vc-name file)))) |
33560 | 205 |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
206 (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
|
207 (apply 'vc-do-command |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
208 buffer 0 "get" (vc-name file) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
209 "-s" ;; suppress diagnostic output |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
210 "-p" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
211 (and rev |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
212 (concat "-r" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
213 (vc-sccs-lookup-triple file rev))) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
214 (vc-switches 'SCCS 'checkout))) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
215 |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
216 (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
|
217 "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
|
218 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
|
219 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
|
220 (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
|
221 switches) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
222 (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
|
223 (save-excursion |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
224 ;; 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
|
225 (if file-buffer (set-buffer file-buffer)) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
226 (setq switches (vc-switches 'SCCS 'checkout)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
227 ;; 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
|
228 ;; 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
|
229 ;; 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
|
230 (let ((default-directory default-directory)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
231 (save-excursion |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
232 ;; 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
|
233 ;; the file in the right place. |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
234 (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
|
235 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
236 (and rev (or (string= rev "") |
48967
9f461f463a94
(vc-sccs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48281
diff
changeset
|
237 (not (stringp rev))) |
9f461f463a94
(vc-sccs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48281
diff
changeset
|
238 (setq rev nil)) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
239 (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
|
240 (if editable "-e") |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
241 (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
|
242 switches)))) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
243 (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
|
244 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
245 (defun vc-sccs-revert (file &optional contents-done) |
33560 | 246 "Revert FILE to the version it was based on." |
247 (vc-do-command nil 0 "unget" (vc-name file)) | |
248 (vc-do-command nil 0 "get" (vc-name file)) | |
249 ;; Checking out explicit versions is not supported under SCCS, yet. | |
250 ;; We always "revert" to the latest version; therefore | |
251 ;; vc-workfile-version is cleared here so that it gets recomputed. | |
252 (vc-file-setprop file 'vc-workfile-version nil)) | |
253 | |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
254 (defun vc-sccs-cancel-version (file editable) |
33560 | 255 "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
|
256 EDITABLE non-nil means previous version should be locked." |
33560 | 257 (vc-do-command nil 0 "rmdel" |
258 (vc-name file) | |
259 (concat "-r" (vc-workfile-version file))) | |
260 (vc-do-command nil 0 "get" | |
261 (vc-name file) | |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
262 (if editable "-e"))) |
33560 | 263 |
264 (defun vc-sccs-steal-lock (file &optional rev) | |
265 "Steal the lock on the current workfile for FILE and revision REV." | |
266 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev))) | |
267 (vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev)))) | |
268 | |
269 | |
270 ;;; | |
271 ;;; History functions | |
272 ;;; | |
273 | |
54467
9df38e21f685
(vc-sccs-print-log, vc-sccs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
274 (defun vc-sccs-print-log (file &optional buffer) |
33560 | 275 "Get change log associated with FILE." |
54467
9df38e21f685
(vc-sccs-print-log, vc-sccs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
276 (vc-do-command buffer 0 "prs" (vc-name file))) |
33560 | 277 |
278 (defun vc-sccs-logentry-check () | |
279 "Check that the log entry in the current buffer is acceptable for SCCS." | |
280 (when (>= (buffer-size) 512) | |
281 (goto-char 512) | |
282 (error "Log must be less than 512 characters; point is now at pos 512"))) | |
283 | |
54467
9df38e21f685
(vc-sccs-print-log, vc-sccs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
284 (defun vc-sccs-diff (file &optional oldvers newvers buffer) |
33560 | 285 "Get a difference report using SCCS between two versions of FILE." |
286 (setq oldvers (vc-sccs-lookup-triple file oldvers)) | |
287 (setq newvers (vc-sccs-lookup-triple file newvers)) | |
54467
9df38e21f685
(vc-sccs-print-log, vc-sccs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
288 (apply 'vc-do-command (or buffer "*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
|
289 (append (list "-q" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
290 (and oldvers (concat "-r" oldvers)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
291 (and newvers (concat "-r" newvers))) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
292 (vc-switches 'SCCS 'diff)))) |
33560 | 293 |
294 | |
295 ;;; | |
296 ;;; Snapshot system | |
297 ;;; | |
298 | |
299 (defun vc-sccs-assign-name (file name) | |
300 "Assign to FILE's latest version a given NAME." | |
301 (vc-sccs-add-triple name file (vc-workfile-version file))) | |
302 | |
303 | |
304 ;;; | |
305 ;;; Miscellaneous | |
306 ;;; | |
307 | |
308 (defun vc-sccs-check-headers () | |
309 "Check if the current file has any headers in it." | |
310 (save-excursion | |
311 (goto-char (point-min)) | |
312 (re-search-forward "%[A-Z]%" nil t))) | |
313 | |
314 (defun vc-sccs-rename-file (old new) | |
315 ;; Move the master file (using vc-rcs-master-templates). | |
316 (vc-rename-master (vc-name old) new vc-sccs-master-templates) | |
317 ;; Update the snapshot file. | |
318 (with-current-buffer | |
319 (find-file-noselect | |
320 (expand-file-name vc-sccs-name-assoc-file | |
321 (file-name-directory (vc-name old)))) | |
322 (goto-char (point-min)) | |
323 ;; (replace-regexp (concat ":" (regexp-quote old) "$") (concat ":" new)) | |
324 (while (re-search-forward (concat ":" (regexp-quote old) "$") nil t) | |
325 (replace-match (concat ":" new) nil nil)) | |
326 (basic-save-buffer) | |
327 (kill-buffer (current-buffer)))) | |
328 | |
329 | |
330 ;;; | |
331 ;;; Internal functions | |
332 ;;; | |
333 | |
334 ;; This function is wrapped with `progn' so that the autoload cookie | |
335 ;; copies the whole function itself into loaddefs.el rather than just placing | |
336 ;; a (autoload 'vc-sccs-search-project-dir "vc-sccs") which would not | |
337 ;; help us avoid loading vc-sccs. | |
338 ;;;###autoload | |
339 (progn (defun vc-sccs-search-project-dir (dirname basename) | |
340 "Return the name of a master file in the SCCS project directory. | |
341 Does not check whether the file exists but returns nil if it does not | |
342 find any project directory." | |
343 (let ((project-dir (getenv "PROJECTDIR")) dirs dir) | |
344 (when project-dir | |
345 (if (file-name-absolute-p project-dir) | |
346 (setq dirs '("SCCS" "")) | |
347 (setq dirs '("src/SCCS" "src" "source/SCCS" "source")) | |
348 (setq project-dir (expand-file-name (concat "~" project-dir)))) | |
349 (while (and (not dir) dirs) | |
350 (setq dir (expand-file-name (car dirs) project-dir)) | |
351 (unless (file-directory-p dir) | |
352 (setq dir nil) | |
353 (setq dirs (cdr dirs)))) | |
354 (and dir (expand-file-name (concat "s." basename) dir)))))) | |
355 | |
356 (defun vc-sccs-lock-file (file) | |
357 "Generate lock file name corresponding to FILE." | |
358 (let ((master (vc-name file))) | |
359 (and | |
360 master | |
361 (string-match "\\(.*/\\)\\(s\\.\\)\\(.*\\)" master) | |
362 (replace-match "p." t t master 2)))) | |
363 | |
364 (defun vc-sccs-parse-locks () | |
365 "Parse SCCS locks in current buffer. | |
366 The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)." | |
367 (let (master-locks) | |
368 (goto-char (point-min)) | |
369 (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?" | |
370 nil t) | |
371 (setq master-locks | |
372 (cons (cons (match-string 1) (match-string 2)) master-locks))) | |
373 ;; FIXME: is it really necessary to reverse ? | |
374 (nreverse master-locks))) | |
375 | |
376 (defun vc-sccs-add-triple (name file rev) | |
377 (with-current-buffer | |
378 (find-file-noselect | |
379 (expand-file-name vc-sccs-name-assoc-file | |
380 (file-name-directory (vc-name file)))) | |
381 (goto-char (point-max)) | |
382 (insert name "\t:\t" file "\t" rev "\n") | |
383 (basic-save-buffer) | |
384 (kill-buffer (current-buffer)))) | |
385 | |
386 (defun vc-sccs-lookup-triple (file name) | |
387 "Return the numeric version corresponding to a named snapshot of FILE. | |
388 If NAME is nil or a version number string it's just passed through." | |
389 (if (or (null name) | |
390 (let ((firstchar (aref name 0))) | |
391 (and (>= firstchar ?0) (<= firstchar ?9)))) | |
392 name | |
393 (with-temp-buffer | |
394 (vc-insert-file | |
395 (expand-file-name vc-sccs-name-assoc-file | |
396 (file-name-directory (vc-name file)))) | |
397 (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
|
398 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
399 (provide 'vc-sccs) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
400 |
56953 | 401 ;; arch-tag: d751dee3-d7b3-47e1-95e3-7ae98c052041 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
402 ;;; vc-sccs.el ends here |