Add build, install, uninstall rules for all dvi, html, pdf, ps manuals
[bpt/emacs.git] / doc / emacs / vc1-xtra.texi
CommitLineData
8cf51b2c 1@c This is part of the Emacs manual.
ab422c4d 2@c Copyright (C) 2004-2013 Free Software Foundation, Inc.
8cf51b2c
GM
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).
8cf51b2c 7
1ab2e8ba
CY
8@node Miscellaneous VC
9@subsection Miscellaneous Commands and Features of VC
10
11 This section explains the less-frequently-used features of VC.
12
13@menu
14* Change Logs and VC:: Generating a change log file from log entries.
3d992aa0 15* VC Delete/Rename:: Deleting and renaming version-controlled files.
d3098e1e 16* Revision Tags:: Symbolic names for revisions.
1ab2e8ba
CY
17* Version Headers:: Inserting version control headers into working files.
18@end menu
19
20@node Change Logs and VC
21@subsubsection Change Logs and VC
22
d3098e1e 23 If you use RCS or CVS for a program with a @file{ChangeLog} file
1ab2e8ba
CY
24@iftex
25(@pxref{Change Log,,,emacs, the Emacs Manual}),
26@end iftex
27@ifnottex
28(@pxref{Change Log}),
29@end ifnottex
d3098e1e
CY
30you can generate change log entries from the version control log
31entries of previous commits.
32
1df7defd 33 Note that this only works with RCS or CVS@. This procedure would be
d3098e1e
CY
34particularly incorrect on a modern changeset-based version control
35system, where changes to the @file{ChangeLog} file would normally be
36committed as part of a changeset. In that case, you should write the
37change log entries first, then pull them into the @samp{*vc-log*}
38buffer when you commit
39@iftex
40(@pxref{Log Buffer,,,emacs, the Emacs Manual}).
41@end iftex
42@ifnottex
43(@pxref{Log Buffer}).
44@end ifnottex
1ab2e8ba
CY
45
46@table @kbd
47@item C-x v a
48@kindex C-x v a
49@findex vc-update-change-log
d3098e1e
CY
50Visit the current directory's @file{ChangeLog} file and, for
51registered files in that directory, create new entries for versions
52committed since the most recent change log entry
1ab2e8ba
CY
53(@code{vc-update-change-log}).
54
1ab2e8ba
CY
55@item C-u C-x v a
56As above, but only find entries for the current buffer's file.
1ab2e8ba
CY
57@end table
58
59 For example, suppose the first line of @file{ChangeLog} is dated
601999-04-10, and that the only check-in since then was by Nathaniel
d3098e1e
CY
61Bowditch to @file{rcs2log} on 1999-05-22 with log entry @samp{Ignore
62log messages that start with `#'.}. Then @kbd{C-x v a} inserts this
63@file{ChangeLog} entry:
1ab2e8ba
CY
64
65@iftex
66@medbreak
67@end iftex
8cf51b2c
GM
68@smallexample
69@group
1ab2e8ba
CY
701999-05-22 Nathaniel Bowditch <nat@@apn.org>
71
72 * rcs2log: Ignore log messages that start with `#'.
8cf51b2c
GM
73@end group
74@end smallexample
1ab2e8ba
CY
75@iftex
76@medbreak
77@end iftex
78
79@noindent
d3098e1e
CY
80If the version control log entry specifies a function name (in
81parenthesis at the beginning of a line), that is reflected in the
82@file{ChangeLog} entry. For example, if a log entry for @file{vc.el}
83is @samp{(vc-do-command): Check call-process status.}, the
84@file{ChangeLog} entry is:
1ab2e8ba
CY
85
86@iftex
87@medbreak
88@end iftex
89@smallexample
90@group
911999-05-06 Nathaniel Bowditch <nat@@apn.org>
92
93 * vc.el (vc-do-command): Check call-process status.
94@end group
95@end smallexample
96@iftex
97@medbreak
98@end iftex
99
d3098e1e
CY
100 When @kbd{C-x v a} adds several change log entries at once, it
101groups related log entries together if they all are checked in by the
102same author at nearly the same time. If the log entries for several
103such files all have the same text, it coalesces them into a single
104entry.
1ab2e8ba 105
3d992aa0
CY
106@node VC Delete/Rename
107@subsubsection Deleting and Renaming Version-Controlled Files
d3098e1e 108@cindex renaming version-controlled files
1ab2e8ba 109
d3098e1e 110@table @kbd
3d992aa0
CY
111@item M-x vc-delete-file
112Prompt for a file name, delete the file from the working tree, and
113schedule the deletion for committing.
114
d3098e1e 115@item M-x vc-rename-file
3d992aa0
CY
116Prompt for two file names, @var{VAR} and @var{OLD}, rename them in the
117working tree, and schedule the renaming for committing.
d3098e1e 118@end table
1ab2e8ba 119
3d992aa0
CY
120@findex vc-delete-file
121 If you wish to delete a version-controlled file, use the command
122@kbd{M-x vc-delete-file}. This prompts for the file name, and deletes
123it via the version control system. The file is removed from the
124working tree, and in the VC Directory buffer
125@iftex
5f9756ec 126(@pxref{VC Directory Mode,,, emacs, the Emacs Manual}),
3d992aa0
CY
127@end iftex
128@ifnottex
129(@pxref{VC Directory Mode}),
130@end ifnottex
131it is displayed with the @samp{removed} status. When you commit it,
132the deletion takes effect in the repository.
d3098e1e 133
3d992aa0
CY
134@findex vc-rename-file
135 To rename a version-controlled file, type @kbd{M-x vc-rename-file}.
136This prompts for two arguments: the name of the file you wish to
137rename, and the new name; then it performs the renaming via the
138version control system. The renaming takes effect immediately in the
d3098e1e 139working tree, and takes effect in the repository when you commit the
3d992aa0 140renamed file.
d3098e1e 141
3d992aa0
CY
142 On modern version control systems that have built-in support for
143renaming, the renamed file retains the full change history of the
144original file. On CVS and older version control systems, the
145@code{vc-rename-file} command actually works by creating a copy of the
146old file under the new name, registering it, and deleting the old
147file. In this case, the change history is not preserved.
1ab2e8ba 148
d3098e1e
CY
149@node Revision Tags
150@subsubsection Revision Tags
151@cindex revision tag
152@cindex tags for version control
1ab2e8ba 153
d3098e1e
CY
154 Most version control systems allow you to apply a @dfn{revision tag}
155to a specific version of a version-controlled tree. On modern
156changeset-based version control systems, a revision tag is simply a
157symbolic name for a particular revision. On older file-based systems
158like CVS, each tag is added to the entire set of version-controlled
159files, allowing them to be handled as a unit. Revision tags are
160commonly used to identify releases that are distributed to users.
1ab2e8ba 161
d3098e1e
CY
162 There are two basic commands for tags; one makes a tag with a given
163name, the other retrieves a named tag.
1ab2e8ba 164
d3098e1e
CY
165@table @code
166@kindex C-x v s
167@findex vc-create-tag
168@item C-x v s @var{name} @key{RET}
169Define the working revision of every registered file in or under the
170current directory as a tag named @var{name}
171(@code{vc-create-tag}).
1ab2e8ba 172
d3098e1e
CY
173@kindex C-x v r
174@findex vc-retrieve-tag
175@item C-x v r @var{name} @key{RET}
176For all registered files at or below the current directory level,
177retrieve the tagged revision @var{name}. This command will switch to a
178branch if @var{name} is a branch name and your VCS distinguishes
179branches from tags. (@code{vc-retrieve-tag}).
1ab2e8ba 180
d3098e1e
CY
181This command reports an error if any files are locked at or below the
182current directory, without changing anything; this is to avoid
183overwriting work in progress.
184@end table
1ab2e8ba 185
d3098e1e
CY
186 You can give a tag or branch name as an argument to @kbd{C-x v =} or
187@kbd{C-x v ~}
1ab2e8ba 188@iftex
d3098e1e 189(@pxref{Old Revisions,,,emacs, the Emacs Manual}).
1ab2e8ba 190@end iftex
d3098e1e
CY
191@ifnottex
192(@pxref{Old Revisions}).
193@end ifnottex
194Thus, you can use it to compare a tagged version against the current files,
195or two tagged versions against each other.
1ab2e8ba 196
d3098e1e 197 On SCCS, VC implements tags itself; these tags are visible only
1df7defd 198through VC@. Most later systems (including CVS, Subversion, bzr, git,
d3098e1e
CY
199and hg) have a native tag facility, and VC uses it where available;
200those tags will be visible even when you bypass VC.
1ab2e8ba 201
2bc4a725
XF
202 In file-based version control systems, when you rename a registered
203file you need to rename its master along with it; the command
204@code{vc-rename-file} will do this automatically
205@iftex
206(@pxref{VC Delete/Rename,,,emacs, the Emacs Manual}).
207@end iftex
208@ifnottex
209(@pxref{VC Delete/Rename}).
210@end ifnottex
211If you are using SCCS, you must also update the records of the tag, to
212mention the file by its new name (@code{vc-rename-file} does this,
213too). An old tag that refers to a master file that no longer exists
214under the recorded name is invalid; VC can no longer retrieve it. It
215would be beyond the scope of this manual to explain enough about RCS
216and SCCS to explain how to update the tags by hand. Using
217@code{vc-rename-file} makes the tag remain valid for retrieval, but it
218does not solve all problems. For example, some of the files in your
219program probably refer to others by name. At the very least, the
220makefile probably mentions the file that you renamed. If you retrieve
221an old tag, the renamed file is retrieved under its new name, which is
222not the name that the makefile expects. So the program won't really
223work as retrieved.
1ab2e8ba
CY
224
225@node Version Headers
226@subsubsection Inserting Version Control Headers
227
2785d024
CY
228 On Subversion, CVS, RCS, and SCCS, you can put certain special
229strings called @dfn{version headers} into a work file. When the file
230is committed, the version control system automatically puts the
231revision number, the name of the user who made the commit, and other
232relevant information into the version header.
233
234@vindex vc-consult-headers
235 VC does not normally use the information in the version headers. As
236an exception, when using RCS, Emacs uses the version header, if there
237is one, to determine the file version, since it is often more reliable
238than the RCS master file. To inhibit using the version header this
239way, change the variable @code{vc-consult-headers} to @code{nil}.
1ab2e8ba
CY
240
241@kindex C-x v h
242@findex vc-insert-headers
1ab2e8ba 243@vindex vc-@var{backend}-header
2785d024
CY
244 To insert a suitable header string into the current buffer, type
245@kbd{C-x v h} (@code{vc-insert-headers}). This command works only on
1df7defd 246Subversion, CVS, RCS, and SCCS@. The variable
2785d024
CY
247@code{vc-@var{backend}-header} contains the list of keywords to insert
248into the version header; for instance, CVS uses @code{vc-cvs-header},
249whose default value is @code{'("\$Id\$")}. (The extra backslashes
250prevent the string constant from being interpreted as a header, if the
251Emacs Lisp file defining it is maintained with version control.) The
252@kbd{C-x v h} command inserts each keyword in the list on a new line
253at point, surrounded by tabs, and inside comment delimiters if
254necessary.
1ab2e8ba
CY
255
256@vindex vc-static-header-alist
257 The variable @code{vc-static-header-alist} specifies further strings
258to add based on the name of the buffer. Its value should be a list of
259elements of the form @code{(@var{regexp} . @var{format})}. Whenever
2785d024
CY
260@var{regexp} matches the buffer name, @var{format} is also inserted as
261part of the version header. A @samp{%s} in @var{format} is replaced
262with the file's version control type.
1ab2e8ba
CY
263
264@node Customizing VC
265@subsection Customizing VC
266
267@vindex vc-handled-backends
2785d024 268 The variable @code{vc-handled-backends} determines which version
1ab2e8ba 269control systems VC should handle. The default value is @code{(RCS CVS
17a6e278 270SVN SCCS Bzr Git Hg Mtn Arch)}, so it contains all the version systems
1ab2e8ba 271that are currently supported. If you want VC to ignore one or more of
2785d024
CY
272these systems, exclude its name from the list. To disable VC
273entirely, set this variable to @code{nil}.
1ab2e8ba 274
2785d024
CY
275 The order of systems in the list is significant: when you visit a
276file registered in more than one system, VC uses the system that comes
d3098e1e 277first in @code{vc-handled-backends} by default. The order is also
2785d024 278significant when you register a file for the first time
1ab2e8ba 279@iftex
2785d024 280(@pxref{Registering,,,emacs, the Emacs Manual}).
1ab2e8ba
CY
281@end iftex
282@ifnottex
2785d024 283(@pxref{Registering}).
1ab2e8ba 284@end ifnottex
1ab2e8ba
CY
285
286@menu
287* General VC Options:: Options that apply to multiple back ends.
288* RCS and SCCS:: Options for RCS and SCCS.
289* CVS Options:: Options for CVS.
290@end menu
291
292@node General VC Options
293@subsubsection General Options
294
295@vindex vc-make-backup-files
296 Emacs normally does not save backup files for source files that are
297maintained with version control. If you want to make backup files even
298for files that use version control, set the variable
299@code{vc-make-backup-files} to a non-@code{nil} value.
300
1ab2e8ba 301@vindex vc-follow-symlinks
2785d024
CY
302@cindex symbolic links (and version control)
303 Editing a version-controlled file through a symbolic link may cause
304unexpected results, if you are unaware that the underlying file is
305version-controlled. The variable @code{vc-follow-symlinks} controls
306what Emacs does if you try to visit a symbolic link pointing to a
307version-controlled file. If the value is @code{ask} (the default),
308Emacs asks for confirmation. If it is @code{nil}, Emacs just displays
309a warning message. If it is @code{t}, Emacs automatically follows the
310link and visits the real file instead.
1ab2e8ba
CY
311
312@vindex vc-suppress-confirm
313 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
314and @kbd{C-x v i} can save the current buffer without asking, and
2785d024 315@kbd{C-x v u} also operates without asking for confirmation.
1ab2e8ba
CY
316
317@vindex vc-command-messages
17a6e278 318 VC mode does much of its work by running the shell commands for the
2785d024
CY
319appropriate version control system. If @code{vc-command-messages} is
320non-@code{nil}, VC displays messages to indicate which shell commands
321it runs, and additional messages when the commands finish.
1ab2e8ba 322
1ab2e8ba
CY
323@node RCS and SCCS
324@subsubsection Options for RCS and SCCS
325
326@cindex non-strict locking (RCS)
327@cindex locking, non-strict (RCS)
328 By default, RCS uses locking to coordinate the activities of several
329users, but there is a mode called @dfn{non-strict locking} in which
330you can check-in changes without locking the file first. Use
331@samp{rcs -U} to switch to non-strict locking for a particular file,
332see the @code{rcs} manual page for details.
333
334 When deducing the version control state of an RCS file, VC first
335looks for an RCS version header string in the file (@pxref{Version
336Headers}). If there is no header string, VC normally looks at the
337file permissions of the work file; this is fast. But there might be
338situations when the file permissions cannot be trusted. In this case
339the master file has to be consulted, which is rather expensive. Also
340the master file can only tell you @emph{if} there's any lock on the
341file, but not whether your work file really contains that locked
342version.
343
344@vindex vc-consult-headers
345 You can tell VC not to use version headers to determine the file
346status by setting @code{vc-consult-headers} to @code{nil}. VC then
347always uses the file permissions (if it is supposed to trust them), or
348else checks the master file.
349
350@vindex vc-mistrust-permissions
351 You can specify the criterion for whether to trust the file
352permissions by setting the variable @code{vc-mistrust-permissions}.
353Its value can be @code{t} (always mistrust the file permissions and
354check the master file), @code{nil} (always trust the file
355permissions), or a function of one argument which makes the decision.
356The argument is the directory name of the @file{RCS} subdirectory. A
357non-@code{nil} value from the function says to mistrust the file
358permissions. If you find that the file permissions of work files are
359changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
360Then VC always checks the master file to determine the file's status.
361
362 VC determines the version control state of files under SCCS much as
1df7defd 363with RCS@. It does not consider SCCS version headers, though. Thus,
1ab2e8ba
CY
364the variable @code{vc-mistrust-permissions} affects SCCS use, but
365@code{vc-consult-headers} does not.
366
367@node CVS Options
368@subsubsection Options specific for CVS
369
d3098e1e
CY
370@vindex vc-cvs-global-switches
371 You can specify additional command line options to pass to all CVS
372operations in the variable @code{vc-cvs-global-switches}. These
373switches are inserted immediately after the @code{cvs} command, before
374the name of the operation to invoke.
8cf51b2c
GM
375
376@vindex vc-stay-local
377@vindex vc-cvs-stay-local
1ab2e8ba 378@cindex remote repositories (CVS)
d3098e1e 379 When using a CVS repository on a remote machine, VC can try keeping
1ab2e8ba
CY
380network interactions to a minimum. This is controlled by the variable
381@code{vc-cvs-stay-local}. There is another variable,
382@code{vc-stay-local}, which enables the feature also for other back
1df7defd 383ends that support it, including CVS@. In the following, we will talk
1ab2e8ba
CY
384only about @code{vc-cvs-stay-local}, but everything applies to
385@code{vc-stay-local} as well.
386
8d0b26f6
XF
387 If @code{vc-cvs-stay-local} is @code{only-file} (the default), VC
388determines the version control status of each file using only the
389entry in the local CVS subdirectory and the information returned by
390previous CVS commands. As a consequence, if you have modified a file
391and somebody else has checked in other changes, you will not be
392notified of the conflict until you try to commit.
d3098e1e
CY
393
394 If you change @code{vc-cvs-stay-local} to @code{nil}, VC queries the
395remote repository @emph{before} it decides what to do in
396@code{vc-next-action} (@kbd{C-x v v}), just as it does for local
397repositories.
398
399 You can also set @code{vc-cvs-stay-local} to a regular expression
400that is matched against the repository host name; VC then stays local
401only for repositories from hosts that match the pattern.
402
403@cindex automatic version backups
404 When using a remote repository, Emacs normally makes @dfn{automatic
405version backups} of the original versions of each edited file. These
406local backups are made whenever you save the first changes to a file,
407and they are removed after you commit your changes to the repository.
408(Note that these are not the same as ordinary Emacs backup files;
1ab2e8ba 409@iftex
d3098e1e 410@pxref{Backup,,,emacs, the Emacs Manual}.)
1ab2e8ba
CY
411@end iftex
412@ifnottex
d3098e1e 413@pxref{Backup}.)
1ab2e8ba 414@end ifnottex
d3098e1e
CY
415Commands like @kbd{C-x v =} and @kbd{C-x v u} make use of automatic
416version backups, if possible, to avoid having to access the network.
1ab2e8ba 417
d3098e1e
CY
418 Setting @code{vc-cvs-stay-local} to @code{nil} disables the making
419of automatic version backups.
1ab2e8ba 420
d3098e1e
CY
421@cindex manual version backups
422 Automatic version backups have names of the form
423@w{@code{@var{file}.~@var{version}.~}}. This is similar to the name
424that @kbd{C-x v ~} saves old versions to
425@iftex
426(@pxref{Old Revisions,,,emacs, the Emacs Manual}),
427@end iftex
428@ifnottex
429(@pxref{Old Revisions}),
430@end ifnottex
431except for the additional dot (@samp{.}) after the version. The
432relevant VC commands can use both kinds of version backups. The main
433difference is that the ``manual'' version backups made by @kbd{C-x v
434~} are not deleted automatically when you commit.
1ab2e8ba 435
d3098e1e
CY
436@cindex locking (CVS)
437 CVS does not use locking by default, but there are ways to enable
438locking-like behavior using its @env{CVSREAD} or @dfn{watch} feature;
439see the CVS documentation for details. If that case, you can use
440@kbd{C-x v v} in Emacs to toggle locking, as you would for a
5f9756ec
GM
441locking-based version control system
442@iftex
443(@pxref{VC With A Locking VCS,,,emacs, the Emacs Manual}).
444@end iftex
445@ifnottex
446(@pxref{VC With A Locking VCS}).
447@end ifnottex