]> code.delx.au - gnu-emacs/blob - man/vc2-xtra.texi
Add arch tagline
[gnu-emacs] / man / vc2-xtra.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions.
4 @c
5 @c This file is included either in vc-xtra.texi (when producing the
6 @c printed version) or in the main Emacs manual (for the on-line version).
7 @node Remote Repositories
8 @subsection Remote Repositories
9 @cindex remote repositories (CVS)
10
11 A common way of using CVS is to set up a central CVS repository on
12 some Internet host, then have each developer check out a personal
13 working copy of the files on his local machine. Committing changes to
14 the repository, and picking up changes from other users into one's own
15 working area, then works by direct interactions with the CVS server.
16
17 One difficulty is that access to the CVS server is often slow, and
18 that developers might need to work off-line as well. VC is designed
19 to reduce the amount of network interaction necessary.
20
21 @menu
22 * Version Backups:: Keeping local copies of repository versions.
23 * Local Version Control:: Using another version system for local editing.
24 @end menu
25
26 @node Version Backups
27 @subsubsection Version Backups
28 @cindex version backups
29
30 @cindex automatic version backups
31 When VC sees that the CVS repository for a file is on a remote
32 machine, it automatically makes local backups of unmodified versions
33 of the file---@dfn{automatic version backups}. This means that you
34 can compare the file to the repository version (@kbd{C-x v =}), or
35 revert to that version (@kbd{C-x v u}), without any network
36 interactions.
37
38 The local copy of the unmodified file is called a @dfn{version
39 backup} to indicate that it corresponds exactly to a version that is
40 stored in the repository. Note that version backups are not the same
41 as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
42 Manual}). But they follow a similar naming convention.
43
44 For a file that comes from a remote CVS repository, VC makes a
45 version backup whenever you save the first changes to the file, and
46 removes it after you have committed your modified version to the
47 repository. You can disable the making of automatic version backups by
48 setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
49
50 @cindex manual version backups
51 The name of the automatic version backup for version @var{version}
52 of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
53 almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
54 Versions,,,emacs, the Emacs Manual}), the only difference being
55 the additional dot (@samp{.}) after the version number. This
56 similarity is intentional, because both kinds of files store the same
57 kind of information. The file made by @kbd{C-x v ~} acts as a
58 @dfn{manual version backup}.
59
60 All the VC commands that operate on old versions of a file can use
61 both kinds of version backups. For instance, @kbd{C-x v ~} uses
62 either an automatic or a manual version backup, if possible, to get
63 the contents of the version you request. Likewise, @kbd{C-x v =} and
64 @kbd{C-x v u} use either an automatic or a manual version backup, if
65 one of them exists, to get the contents of a version to compare or
66 revert to. If you changed a file outside of Emacs, so that no
67 automatic version backup was created for the previous text, you can
68 create a manual backup of that version using @kbd{C-x v ~}, and thus
69 obtain the benefit of the local copy for Emacs commands.
70
71 The only difference in Emacs's handling of manual and automatic
72 version backups, once they exist, is that Emacs deletes automatic
73 version backups when you commit to the repository. By contrast,
74 manual version backups remain until you delete them.
75
76 @node Local Version Control
77 @subsubsection Local Version Control
78 @cindex local version control
79 @cindex local back end (version control)
80
81 When you make many changes to a file that comes from a remote
82 repository, it can be convenient to have version control on your local
83 machine as well. You can then record intermediate versions, revert to
84 a previous state, etc., before you actually commit your changes to the
85 remote server.
86
87 VC lets you do this by putting a file under a second, local version
88 control system, so that the file is effectively registered in two
89 systems at the same time. For the description here, we will assume
90 that the remote system is CVS, and you use RCS locally, although the
91 mechanism works with any combination of version control systems
92 (@dfn{back ends}).
93
94 To make it work with other back ends, you must make sure that the
95 ``more local'' back end comes before the ``more remote'' back end in
96 the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
97 default, this variable is set up so that you can use remote CVS and
98 local RCS as described here.
99
100 To start using local RCS for a file that comes from a remote CVS
101 server, you must @emph{register the file in RCS}, by typing @kbd{C-u
102 C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
103 prefix argument, and specify RCS as the back end.)
104
105 You can do this at any time; it does not matter whether you have
106 already modified the file with respect to the version in the CVS
107 repository. If possible, VC tries to make the RCS master start with
108 the unmodified repository version, then checks in any local changes
109 as a new version. This works if you have not made any changes yet, or
110 if the unmodified repository version exists locally as a version
111 backup (@pxref{Version Backups}). If the unmodified version is not
112 available locally, the RCS master starts with the modified version;
113 the only drawback to this is that you cannot compare your changes
114 locally to what is stored in the repository.
115
116 The version number of the RCS master is derived from the current CVS
117 version, starting a branch from it. For example, if the current CVS
118 version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
119 the RCS master will be identical to version 1.23 under CVS; your first
120 changes are checked in as 1.23.1.1. (If the unmodified file is not
121 available locally, VC will check in the modified file twice, both as
122 1.23 and 1.23.1.1, to make the revision numbers consistent.)
123
124 If you do not use locking under CVS (the default), locking is also
125 disabled for RCS, so that editing under RCS works exactly as under
126 CVS.
127
128 When you are done with local editing, you can commit the final version
129 back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
130 This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
131 Emacs Manual}) to contain all the log entries you have recorded in the
132 RCS master; you can edit them as you wish, and then commit in CVS by
133 typing @kbd{C-c C-c}. If the commit is successful, VC removes the RCS
134 master, so that the file is once again registered under CVS only.
135 (The RCS master is not actually deleted, just renamed by appending
136 @samp{~} to the name, so that you can refer to it later if you wish.)
137
138 While using local RCS, you can pick up recent changes from the CVS
139 repository into your local file, or commit some of your changes back
140 to CVS, without terminating local RCS version control. To do this,
141 switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
142
143 @table @kbd
144 @item C-x v b
145 Switch to another back end that the current file is registered
146 under (@code{vc-switch-backend}).
147
148 @item C-u C-x v b @var{backend} @key{RET}
149 Switch to @var{backend} for the current file.
150 @end table
151
152 @kindex C-x v b
153 @findex vc-switch-backend
154 @kbd{C-x v b} does not change the buffer contents, or any files; it
155 only changes VC's perspective on how to handle the file. Any
156 subsequent VC commands for that file will operate on the back end that
157 is currently selected.
158
159 If the current file is registered in more than one back end, typing
160 @kbd{C-x v b} ``cycles'' through all of these back ends. With a
161 prefix argument, it asks for the back end to use in the minibuffer.
162
163 Thus, if you are using local RCS, and you want to pick up some recent
164 changes in the file from remote CVS, first visit the file, then type
165 @kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
166 @key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
167 Manual}). You can then switch back to RCS by typing @kbd{C-x v b}
168 again, and continue to edit locally.
169
170 But if you do this, the revision numbers in the RCS master no longer
171 correspond to those of CVS. Technically, this is not a problem, but
172 it can become difficult to keep track of what is in the CVS repository
173 and what is not. So we suggest that you return from time to time to
174 CVS-only operation, by committing your local changes back to the
175 repository using @kbd{C-u C-x v v cvs @key{RET}}.
176
177 @node Snapshots
178 @subsection Snapshots
179 @cindex snapshots and version control
180
181 A @dfn{snapshot} is a named set of file versions (one for each
182 registered file) that you can treat as a unit. One important kind of
183 snapshot is a @dfn{release}, a (theoretically) stable version of the
184 system that is ready for distribution to users.
185
186 @menu
187 * Making Snapshots:: The snapshot facilities.
188 * Snapshot Caveats:: Things to be careful of when using snapshots.
189 @end menu
190
191 @node Making Snapshots
192 @subsubsection Making and Using Snapshots
193
194 There are two basic commands for snapshots; one makes a
195 snapshot with a given name, the other retrieves a named snapshot.
196
197 @table @code
198 @kindex C-x v s
199 @findex vc-create-snapshot
200 @item C-x v s @var{name} @key{RET}
201 Define the last saved versions of every registered file in or under the
202 current directory as a snapshot named @var{name}
203 (@code{vc-create-snapshot}).
204
205 @kindex C-x v r
206 @findex vc-retrieve-snapshot
207 @item C-x v r @var{name} @key{RET}
208 For all registered files at or below the current directory level, select
209 whatever versions correspond to the snapshot @var{name}
210 (@code{vc-retrieve-snapshot}).
211
212 This command reports an error if any files are locked at or below the
213 current directory, without changing anything; this is to avoid
214 overwriting work in progress.
215 @end table
216
217 A snapshot uses a very small amount of resources---just enough to record
218 the list of file names and which version belongs to the snapshot. Thus,
219 you need not hesitate to create snapshots whenever they are useful.
220
221 You can give a snapshot name as an argument to @kbd{C-x v =} or
222 @kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
223 Thus, you can use it to compare a snapshot against the current files,
224 or two snapshots against each other, or a snapshot against a named
225 version.
226
227 @node Snapshot Caveats
228 @subsubsection Snapshot Caveats
229
230 @cindex named configurations (RCS)
231 VC's snapshot facilities are modeled on RCS's named-configuration
232 support. They use RCS's native facilities for this, so
233 snapshots made using RCS through VC are visible even when you bypass VC.
234
235 With CVS, Meta-CVS, and Subversion, VC also uses the native
236 mechanism provided by that back end to make snapshots and retrieve them
237 (@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
238
239 @c worded verbosely to avoid overfull hbox.
240 For SCCS, VC implements snapshots itself. The files it uses contain
241 name/file/version-number triples. These snapshots are visible only
242 through VC.
243
244 There is no support for VC snapshots using GNU Arch yet.
245
246 A snapshot is a set of checked-in versions. So make sure that all the
247 files are checked in and not locked when you make a snapshot.
248
249 File renaming and deletion can create some difficulties with snapshots.
250 This is not a VC-specific problem, but a general design issue in version
251 control systems that no one has solved very well yet.
252
253 If you rename a registered file, you need to rename its master along
254 with it (the command @code{vc-rename-file} does this automatically). If
255 you are using SCCS, you must also update the records of the snapshot, to
256 mention the file by its new name (@code{vc-rename-file} does this,
257 too). An old snapshot that refers to a master file that no longer
258 exists under the recorded name is invalid; VC can no longer retrieve
259 it. It would be beyond the scope of this manual to explain enough about
260 RCS and SCCS to explain how to update the snapshots by hand.
261
262 Using @code{vc-rename-file} makes the snapshot remain valid for
263 retrieval, but it does not solve all problems. For example, some of the
264 files in your program probably refer to others by name. At the very
265 least, the makefile probably mentions the file that you renamed. If you
266 retrieve an old snapshot, the renamed file is retrieved under its new
267 name, which is not the name that the makefile expects. So the program
268 won't really work as retrieved.
269
270 @node Miscellaneous VC
271 @subsection Miscellaneous Commands and Features of VC
272
273 This section explains the less-frequently-used features of VC.
274
275 @menu
276 * Change Logs and VC:: Generating a change log file from log entries.
277 * Renaming and VC:: A command to rename both the source and master
278 file correctly.
279 * Version Headers:: Inserting version control headers into working files.
280 @end menu
281
282 @node Change Logs and VC
283 @subsubsection Change Logs and VC
284
285 If you use RCS or CVS for a program and also maintain a change log
286 file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
287 can generate change log entries automatically from the version control
288 log entries:
289
290 @table @kbd
291 @item C-x v a
292 @kindex C-x v a
293 @findex vc-update-change-log
294 Visit the current directory's change log file and, for registered files
295 in that directory, create new entries for versions checked in since the
296 most recent entry in the change log file.
297 (@code{vc-update-change-log}).
298
299 This command works with RCS or CVS only, not with any of the other
300 back ends.
301
302 @item C-u C-x v a
303 As above, but only find entries for the current buffer's file.
304
305 @item M-1 C-x v a
306 As above, but find entries for all the currently visited files that are
307 maintained with version control. This works only with RCS, and it puts
308 all entries in the log for the default directory, which may not be
309 appropriate.
310 @end table
311
312 For example, suppose the first line of @file{ChangeLog} is dated
313 1999-04-10, and that the only check-in since then was by Nathaniel
314 Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
315 messages that start with `#'.}. Then @kbd{C-x v a} visits
316 @file{ChangeLog} and inserts text like this:
317
318 @iftex
319 @medbreak
320 @end iftex
321 @smallexample
322 @group
323 1999-05-22 Nathaniel Bowditch <nat@@apn.org>
324
325 * rcs2log: Ignore log messages that start with `#'.
326 @end group
327 @end smallexample
328 @iftex
329 @medbreak
330 @end iftex
331
332 @noindent
333 You can then edit the new change log entry further as you wish.
334
335 Some of the new change log entries may duplicate what's already in
336 ChangeLog. You will have to remove these duplicates by hand.
337
338 Normally, the log entry for file @file{foo} is displayed as @samp{*
339 foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
340 if the text of the log entry starts with @w{@samp{(@var{functionname}):
341 }}. For example, if the log entry for @file{vc.el} is
342 @samp{(vc-do-command): Check call-process status.}, then the text in
343 @file{ChangeLog} looks like this:
344
345 @iftex
346 @medbreak
347 @end iftex
348 @smallexample
349 @group
350 1999-05-06 Nathaniel Bowditch <nat@@apn.org>
351
352 * vc.el (vc-do-command): Check call-process status.
353 @end group
354 @end smallexample
355 @iftex
356 @medbreak
357 @end iftex
358
359 When @kbd{C-x v a} adds several change log entries at once, it groups
360 related log entries together if they all are checked in by the same
361 author at nearly the same time. If the log entries for several such
362 files all have the same text, it coalesces them into a single entry.
363 For example, suppose the most recent check-ins have the following log
364 entries:
365
366 @flushleft
367 @bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
368 @bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
369 @bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
370 @end flushleft
371
372 @noindent
373 They appear like this in @file{ChangeLog}:
374
375 @iftex
376 @medbreak
377 @end iftex
378 @smallexample
379 @group
380 1999-04-01 Nathaniel Bowditch <nat@@apn.org>
381
382 * vc.texinfo: Fix expansion typos.
383
384 * vc.el, vc-hooks.el: Don't call expand-file-name.
385 @end group
386 @end smallexample
387 @iftex
388 @medbreak
389 @end iftex
390
391 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
392 can mark several related log entries to be clumped together (without an
393 intervening blank line) by starting the text of each related log entry
394 with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
395 itself is not copied to @file{ChangeLog}. For example, suppose the log
396 entries are:
397
398 @flushleft
399 @bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
400 @bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
401 @bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
402 @end flushleft
403
404 @noindent
405 Then the text in @file{ChangeLog} looks like this:
406
407 @iftex
408 @medbreak
409 @end iftex
410 @smallexample
411 @group
412 1999-04-01 Nathaniel Bowditch <nat@@apn.org>
413
414 * vc.texinfo: Fix expansion typos.
415 * vc.el, vc-hooks.el: Don't call expand-file-name.
416 @end group
417 @end smallexample
418 @iftex
419 @medbreak
420 @end iftex
421
422 A log entry whose text begins with @samp{#} is not copied to
423 @file{ChangeLog}. For example, if you merely fix some misspellings in
424 comments, you can log the change with an entry beginning with @samp{#}
425 to avoid putting such trivia into @file{ChangeLog}.
426
427 @node Renaming and VC
428 @subsubsection Renaming VC Work Files and Master Files
429
430 @findex vc-rename-file
431 When you rename a registered file, you must also rename its master
432 file correspondingly to get proper results. Use @code{vc-rename-file}
433 to rename the source file as you specify, and rename its master file
434 accordingly. It also updates any snapshots (@pxref{Snapshots}) that
435 mention the file, so that they use the new name; despite this, the
436 snapshot thus modified may not completely work (@pxref{Snapshot
437 Caveats}).
438
439 Some back ends do not provide an explicit rename operation to their
440 repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
441 on the original and renamed buffers and provide the necessary edit
442 log.
443
444 You cannot use @code{vc-rename-file} on a file that is locked by
445 someone else.
446
447 @node Version Headers
448 @subsubsection Inserting Version Control Headers
449
450 Sometimes it is convenient to put version identification strings
451 directly into working files. Certain special strings called
452 @dfn{version headers} are replaced in each successive version by the
453 number of that version, the name of the user who created it, and other
454 relevant information. All of the back ends that VC supports have such
455 a mechanism, except GNU Arch.
456
457 VC does not normally use the information contained in these headers.
458 The exception is RCS---with RCS, version headers are sometimes more
459 reliable than the master file to determine which version of the file
460 you are editing. Note that in a multi-branch environment, version
461 headers are necessary to make VC behave correctly (@pxref{Multi-User
462 Branching,,,emacs, the Emacs Manual}).
463
464 Searching for RCS version headers is controlled by the variable
465 @code{vc-consult-headers}. If it is non-@code{nil} (the default),
466 Emacs searches for headers to determine the version number you are
467 editing. Setting it to @code{nil} disables this feature.
468
469 Note that although CVS uses the same kind of version headers as RCS
470 does, VC never searches for these headers if you are using CVS,
471 regardless of the above setting.
472
473 @kindex C-x v h
474 @findex vc-insert-headers
475 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
476 insert a suitable header string.
477
478 @table @kbd
479 @item C-x v h
480 Insert headers in a file for use with your version-control system.
481 @end table
482
483 @vindex vc-@var{backend}-header
484 The default header string is @samp{@w{$}Id$} for RCS and
485 @samp{@w{%}W%} for SCCS. You can specify other headers to insert by
486 setting the variables @code{vc-@var{backend}-header} where
487 @var{backend} is @code{rcs} or @code{sccs}.
488
489 Instead of a single string, you can specify a list of strings; then
490 each string in the list is inserted as a separate header on a line of
491 its own.
492
493 It may be necessary to use apparently-superfluous backslashes when
494 writing the strings that you put in this variable. For instance, you
495 might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
496 backslash prevents the string constant from being interpreted as a
497 header, if the Emacs Lisp file containing it is maintained with
498 version control.
499
500 @vindex vc-comment-alist
501 Each header is inserted surrounded by tabs, inside comment delimiters,
502 on a new line at point. Normally the ordinary comment
503 start and comment end strings of the current mode are used, but for
504 certain modes, there are special comment delimiters for this purpose;
505 the variable @code{vc-comment-alist} specifies them. Each element of
506 this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
507
508 @vindex vc-static-header-alist
509 The variable @code{vc-static-header-alist} specifies further strings
510 to add based on the name of the buffer. Its value should be a list of
511 elements of the form @code{(@var{regexp} . @var{format})}. Whenever
512 @var{regexp} matches the buffer name, @var{format} is inserted as part
513 of the header. A header line is inserted for each element that matches
514 the buffer name, and for each string specified by
515 @code{vc-@var{backend}-header}. The header line is made by processing the
516 string from @code{vc-@var{backend}-header} with the format taken from the
517 element. The default value for @code{vc-static-header-alist} is as follows:
518
519 @example
520 @group
521 (("\\.c$" .
522 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
523 #endif /* lint */\n"))
524 @end group
525 @end example
526
527 @noindent
528 It specifies insertion of text of this form:
529
530 @example
531 @group
532
533 #ifndef lint
534 static char vcid[] = "@var{string}";
535 #endif /* lint */
536 @end group
537 @end example
538
539 @noindent
540 Note that the text above starts with a blank line.
541
542 If you use more than one version header in a file, put them close
543 together in the file. The mechanism in @code{revert-buffer} that
544 preserves markers may not handle markers positioned between two version
545 headers.
546
547 @node Customizing VC
548 @subsection Customizing VC
549
550 @vindex vc-handled-backends
551 The variable @code{vc-handled-backends} determines which version
552 control systems VC should handle. The default value is @code{(RCS CVS
553 SVN SCCS Arch MCVS)}, so it contains all six version systems that are
554 currently supported. If you want VC to ignore one or more of these
555 systems, exclude its name from the list. To disable VC entirely, set
556 this variable to @code{nil}.
557
558 The order of systems in the list is significant: when you visit a file
559 registered in more than one system (@pxref{Local Version Control}), VC
560 uses the system that comes first in @code{vc-handled-backends} by
561 default. The order is also significant when you register a file for
562 the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
563 details.
564
565 @menu
566 * General VC Options:: Options that apply to multiple back ends.
567 * RCS and SCCS:: Options for RCS and SCCS.
568 * CVS Options:: Options for CVS.
569 @end menu
570
571 @node General VC Options
572 @subsubsection General Options
573
574 @vindex vc-make-backup-files
575 Emacs normally does not save backup files for source files that are
576 maintained with version control. If you want to make backup files even
577 for files that use version control, set the variable
578 @code{vc-make-backup-files} to a non-@code{nil} value.
579
580 @vindex vc-keep-workfiles
581 Normally the work file exists all the time, whether it is locked or
582 not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
583 in a new version with @kbd{C-x v v} deletes the work file; but any
584 attempt to visit the file with Emacs creates it again. (With CVS, work
585 files are always kept.)
586
587 @vindex vc-follow-symlinks
588 Editing a version-controlled file through a symbolic link can be
589 dangerous. It bypasses the version control system---you can edit the
590 file without locking it, and fail to check your changes in. Also,
591 your changes might overwrite those of another user. To protect against
592 this, VC checks each symbolic link that you visit, to see if it points
593 to a file under version control.
594
595 The variable @code{vc-follow-symlinks} controls what to do when a
596 symbolic link points to a version-controlled file. If it is @code{nil},
597 VC only displays a warning message. If it is @code{t}, VC automatically
598 follows the link, and visits the real file instead, telling you about
599 this in the echo area. If the value is @code{ask} (the default), VC
600 asks you each time whether to follow the link.
601
602 @vindex vc-suppress-confirm
603 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
604 and @kbd{C-x v i} can save the current buffer without asking, and
605 @kbd{C-x v u} also operates without asking for confirmation. (This
606 variable does not affect @kbd{C-x v c}; that operation is so drastic
607 that it should always ask for confirmation.)
608
609 @vindex vc-command-messages
610 VC mode does much of its work by running the shell commands for RCS,
611 CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
612 displays messages to indicate which shell commands it runs, and
613 additional messages when the commands finish.
614
615 @vindex vc-path
616 You can specify additional directories to search for version control
617 programs by setting the variable @code{vc-path}. These directories
618 are searched before the usual search path. It is rarely necessary to
619 set this variable, because VC normally finds the proper files
620 automatically.
621
622 @node RCS and SCCS
623 @subsubsection Options for RCS and SCCS
624
625 @cindex non-strict locking (RCS)
626 @cindex locking, non-strict (RCS)
627 By default, RCS uses locking to coordinate the activities of several
628 users, but there is a mode called @dfn{non-strict locking} in which
629 you can check-in changes without locking the file first. Use
630 @samp{rcs -U} to switch to non-strict locking for a particular file,
631 see the @code{rcs} manual page for details.
632
633 When deducing the version control state of an RCS file, VC first
634 looks for an RCS version header string in the file (@pxref{Version
635 Headers}). If there is no header string, VC normally looks at the
636 file permissions of the work file; this is fast. But there might be
637 situations when the file permissions cannot be trusted. In this case
638 the master file has to be consulted, which is rather expensive. Also
639 the master file can only tell you @emph{if} there's any lock on the
640 file, but not whether your work file really contains that locked
641 version.
642
643 @vindex vc-consult-headers
644 You can tell VC not to use version headers to determine the file
645 status by setting @code{vc-consult-headers} to @code{nil}. VC then
646 always uses the file permissions (if it is supposed to trust them), or
647 else checks the master file.
648
649 @vindex vc-mistrust-permissions
650 You can specify the criterion for whether to trust the file
651 permissions by setting the variable @code{vc-mistrust-permissions}.
652 Its value can be @code{t} (always mistrust the file permissions and
653 check the master file), @code{nil} (always trust the file
654 permissions), or a function of one argument which makes the decision.
655 The argument is the directory name of the @file{RCS} subdirectory. A
656 non-@code{nil} value from the function says to mistrust the file
657 permissions. If you find that the file permissions of work files are
658 changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
659 Then VC always checks the master file to determine the file's status.
660
661 VC determines the version control state of files under SCCS much as
662 with RCS. It does not consider SCCS version headers, though. Thus,
663 the variable @code{vc-mistrust-permissions} affects SCCS use, but
664 @code{vc-consult-headers} does not.
665
666 @node CVS Options
667 @subsubsection Options specific for CVS
668
669 @cindex locking (CVS)
670 By default, CVS does not use locking to coordinate the activities of
671 several users; anyone can change a work file at any time. However,
672 there are ways to restrict this, resulting in behavior that resembles
673 locking.
674
675 @cindex CVSREAD environment variable (CVS)
676 For one thing, you can set the @env{CVSREAD} environment variable
677 (the value you use makes no difference). If this variable is defined,
678 CVS makes your work files read-only by default. In Emacs, you must
679 type @kbd{C-x v v} to make the file writable, so that editing works
680 in fact similar as if locking was used. Note however, that no actual
681 locking is performed, so several users can make their files writable
682 at the same time. When setting @env{CVSREAD} for the first time, make
683 sure to check out all your modules anew, so that the file protections
684 are set correctly.
685
686 @cindex cvs watch feature
687 @cindex watching files (CVS)
688 Another way to achieve something similar to locking is to use the
689 @dfn{watch} feature of CVS. If a file is being watched, CVS makes it
690 read-only by default, and you must also use @kbd{C-x v v} in Emacs to
691 make it writable. VC calls @code{cvs edit} to make the file writable,
692 and CVS takes care to notify other developers of the fact that you
693 intend to change the file. See the CVS documentation for details on
694 using the watch feature.
695
696 @vindex vc-stay-local
697 @vindex vc-cvs-stay-local
698 @cindex remote repositories (CVS)
699 When a file's repository is on a remote machine, VC tries to keep
700 network interactions to a minimum. This is controlled by the variable
701 @code{vc-cvs-stay-local}. There is another variable,
702 @code{vc-stay-local}, which enables the feature also for other back
703 ends that support it, including CVS. In the following, we will talk
704 only about @code{vc-cvs-stay-local}, but everything applies to
705 @code{vc-stay-local} as well.
706
707 If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
708 only the entry in the local CVS subdirectory to determine the file's
709 state (and possibly information returned by previous CVS commands).
710 One consequence of this is that when you have modified a file, and
711 somebody else has already checked in other changes to the file, you
712 are not notified of it until you actually try to commit. (But you can
713 try to pick up any recent changes from the repository first, using
714 @kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
715
716 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
717 version backups, so that simple diff and revert operations are
718 completely local (@pxref{Version Backups}).
719
720 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
721 then VC queries the remote repository @emph{before} it decides what to
722 do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
723 repositories. It also does not make any version backups.
724
725 You can also set @code{vc-cvs-stay-local} to a regular expression
726 that is matched against the repository host name; VC then stays local
727 only for repositories from hosts that match the pattern.
728
729 @vindex vc-cvs-global-switches
730 You can specify additional command line options to pass to all CVS
731 operations in the variable @code{vc-cvs-global-switches}. These
732 switches are inserted immediately after the @code{cvs} command, before
733 the name of the operation to invoke.
734
735 @ignore
736 arch-tag: 140b8629-4339-4b5e-9e50-72453e51615e
737 @end ignore