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