aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-21 16:39:32 +0800
committerChong Yidong2011-12-21 16:39:32 +0800
commitd3098e1ec618fc043568be481b487f3bf7689bad (patch)
treef0d880130465a5702c99019158a54daf921ab830
parent204ee57fa0bb286ba4c6f540cefb44ed011a921f (diff)
downloademacs-d3098e1ec618fc043568be481b487f3bf7689bad.tar.gz
emacs-d3098e1ec618fc043568be481b487f3bf7689bad.zip
More updates for VC documentation.
* files.texi (Misc File Ops): Mention vc-rename-file. * maintaining.texi (Advanced C-x v v): Use fileset terminology. (VC With A Merging VCS, VC Change Log): Add xref to VC Pull node. (VC Pull): Mention vc-log-incoming. (Log Buffer): Add CVS/RCS only disclaimer. * vc1-xtra.texi (Remote Repositories): Update introduction. (Local Version Control): Node deleted (obsolete with DVCSes). (Remote Repositories, Version Backups): Node deleted. Move documentation of vc-cvs-stay-local to CVS Options. (CVS Options): Reduce verbosity of description of obscure CVS locking feature. (Making Revision Tags, Revision Tag Caveats): Merge into Revision Tags node. (Revision Tags): Move under Miscellaneous VC subsection. (Change Logs and VC): Note that this is wrong for DVCSs. De-document log entry manipulating features. (Renaming and VC): Describe how it works on modern VCSes. * programs.texi (Custom C Indent): Add index entries.
-rw-r--r--doc/emacs/ChangeLog24
-rw-r--r--doc/emacs/emacs.texi12
-rw-r--r--doc/emacs/files.texi8
-rw-r--r--doc/emacs/maintaining.texi76
-rw-r--r--doc/emacs/programs.texi11
-rw-r--r--doc/emacs/vc1-xtra.texi627
6 files changed, 250 insertions, 508 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 22f9a4ae7cc..8e2b278f84b 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,27 @@
12011-12-21 Chong Yidong <cyd@gnu.org>
2
3 * maintaining.texi (Advanced C-x v v): Use fileset terminology.
4 (VC With A Merging VCS, VC Change Log): Add xref to VC Pull node.
5 (VC Pull): Mention vc-log-incoming.
6 (Log Buffer): Add CVS/RCS only disclaimer.
7
8 * vc1-xtra.texi (Remote Repositories): Update introduction.
9 (Local Version Control): Node deleted (obsolete with DVCSes).
10 (Remote Repositories, Version Backups): Node deleted. Move
11 documentation of vc-cvs-stay-local to CVS Options.
12 (CVS Options): Reduce verbosity of description of obscure CVS
13 locking feature.
14 (Making Revision Tags, Revision Tag Caveats): Merge into Revision
15 Tags node.
16 (Revision Tags): Move under Miscellaneous VC subsection.
17 (Change Logs and VC): Note that this is wrong for DVCSs.
18 De-document log entry manipulating features.
19 (Renaming and VC): Describe how it works on modern VCSes.
20
21 * files.texi (Misc File Ops): Mention vc-rename-file.
22
23 * programs.texi (Custom C Indent): Add index entries.
24
12011-12-20 Alan Mackenzie <acm@muc.de> 252011-12-20 Alan Mackenzie <acm@muc.de>
2 26
3 * programs.texi (Motion in C): Update the description of C-M-a and 27 * programs.texi (Motion in C): Update the description of C-M-a and
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index d3caf4e63df..b12cdf6ddd1 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -747,7 +747,6 @@ Version Control
747* VC Undo:: Canceling changes before or after committing. 747* VC Undo:: Canceling changes before or after committing.
748* VC Directory Mode:: Listing files managed by version control. 748* VC Directory Mode:: Listing files managed by version control.
749* Branches:: Multiple lines of development. 749* Branches:: Multiple lines of development.
750* Remote Repositories:: Efficient access to remote CVS servers.
751* Revision Tags:: Symbolic names for revisions. 750* Revision Tags:: Symbolic names for revisions.
752* Miscellaneous VC:: Various other commands and features of VC. 751* Miscellaneous VC:: Various other commands and features of VC.
753* Customizing VC:: Variables that change VC's behavior. 752* Customizing VC:: Variables that change VC's behavior.
@@ -780,21 +779,12 @@ Multiple Branches of a File
780* Merging:: Transferring changes between branches. 779* Merging:: Transferring changes between branches.
781* Creating Branches:: How to start a new branch. 780* Creating Branches:: How to start a new branch.
782 781
783Remote Repositories
784
785* Version Backups:: Keeping local copies of repository versions.
786* Local Version Control:: Using another version system for local editing.
787
788Revision Tags
789
790* Making Revision Tags:: The tag facilities.
791* Revision Tag Caveats:: Things to be careful of when using tags.
792
793Miscellaneous Commands and Features of VC 782Miscellaneous Commands and Features of VC
794 783
795* Change Logs and VC:: Generating a change log file from log entries. 784* Change Logs and VC:: Generating a change log file from log entries.
796* Renaming and VC:: A command to rename both the source and master 785* Renaming and VC:: A command to rename both the source and master
797 file correctly. 786 file correctly.
787* Revision Tags:: Symbolic names for revisions.
798* Version Headers:: Inserting version control headers into working files. 788* Version Headers:: Inserting version control headers into working files.
799 789
800Customizing VC 790Customizing VC
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index e3da0ca44e6..96c38f4190e 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1498,6 +1498,7 @@ it creates a copy of the @var{old} directory and puts it in @var{new}.
1498If @var{new} is not an existing directory, it copies all the contents 1498If @var{new} is not an existing directory, it copies all the contents
1499of @var{old} into a new directory named @var{new}. 1499of @var{old} into a new directory named @var{new}.
1500 1500
1501@cindex renaming files
1501@findex rename-file 1502@findex rename-file
1502 @kbd{M-x rename-file} reads two file names @var{old} and @var{new} 1503 @kbd{M-x rename-file} reads two file names @var{old} and @var{new}
1503using the minibuffer, then renames file @var{old} as @var{new}. If 1504using the minibuffer, then renames file @var{old} as @var{new}. If
@@ -1512,6 +1513,13 @@ RET /tmp RET} renames @file{~/foo} to @file{/tmp/foo}. The same rule
1512applies to all the remaining commands in this section. All of them 1513applies to all the remaining commands in this section. All of them
1513ask for confirmation when the new file name already exists, too. 1514ask for confirmation when the new file name already exists, too.
1514 1515
1516@ifnottex
1517 Note that if a file is under version control (@pxref{Version
1518Control}), you normally ought to rename it via the version control
1519system instead, using @kbd{M-x vc-rename-file}. @xref{Renaming and
1520VC}.
1521@end ifnottex
1522
1515@findex add-name-to-file 1523@findex add-name-to-file
1516@cindex hard links (creation) 1524@cindex hard links (creation)
1517 @kbd{M-x add-name-to-file} adds an additional name to an existing 1525 @kbd{M-x add-name-to-file} adds an additional name to an existing
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 8bf7d74f9b6..488bdf87320 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -56,8 +56,6 @@ variable @code{vc-handled-backends} to @code{nil}
56* VC Directory Mode:: Listing files managed by version control. 56* VC Directory Mode:: Listing files managed by version control.
57* Branches:: Multiple lines of development. 57* Branches:: Multiple lines of development.
58@ifnottex 58@ifnottex
59* Remote Repositories:: Efficient access to remote CVS servers.
60* Revision Tags:: Symbolic names for revisions.
61* Miscellaneous VC:: Various other commands and features of VC. 59* Miscellaneous VC:: Various other commands and features of VC.
62* Customizing VC:: Variables that change VC's behavior. 60* Customizing VC:: Variables that change VC's behavior.
63@end ifnottex 61@end ifnottex
@@ -482,10 +480,11 @@ commit. @xref{Log Buffer}.
482 480
483If committing to a shared repository, the commit may fail if the 481If committing to a shared repository, the commit may fail if the
484repository that has been changed since your last update. In that 482repository that has been changed since your last update. In that
485case, you must perform an update before trying again. If using a 483case, you must perform an update before trying again. On a
486decentralized version control system, use @kbd{C-x v +} or @kbd{C-x v 484decentralized version control system, use @kbd{C-x v +} (@pxref{VC
487m} (@pxref{Merging}). If using a centralized version control system, 485Pull}) or @kbd{C-x v m} (@pxref{Merging}). On a centralized version
488type @kbd{C-x v v} again to merge in the repository changes. 486control system, type @kbd{C-x v v} again to merge in the repository
487changes.
489 488
490@item 489@item
491Finally, if you are using a centralized version control system, check 490Finally, if you are using a centralized version control system, check
@@ -557,31 +556,27 @@ to do the operation.
557 556
558@itemize @bullet 557@itemize @bullet
559@item 558@item
560If the file is modified (or locked), you can specify the revision ID 559@cindex specific version control system
561to use for the new version that you commit. This is one way to create 560You can specify the name of a version control system. This is useful
562a new branch (@pxref{Branches}). 561if the fileset can be managed by more than one version control system,
562and Emacs fails to detect the correct one.
563 563
564@item 564@item
565If the file is not modified (and unlocked), you can specify the 565Otherwise, if using CVS or RCS, you can specify a revision ID.
566revision to select; this lets you start working from an older
567revision, or on another branch. If you do not enter any revision,
568that takes you to the highest (``head'') revision on the current
569branch; therefore @kbd{C-u C-x v v @key{RET}} is a convenient way to
570get the latest version of a file from the repository.
571 566
572@item 567If the fileset is modified (or locked), this makes Emacs commit with
573@cindex specific version control system 568that revision ID. You can create a new branch by supplying an
574Instead of the revision ID, you can also specify the name of a 569appropriate revision ID (@pxref{Branches}).
575version control system. This is useful when one file is being managed
576with two version control systems at the same time
577@iftex
578(@pxref{Local Version Control,,,emacs-xtra, Specialized Emacs
579Features}).
580@end iftex
581@ifnottex
582(@pxref{Local Version Control}).
583@end ifnottex
584 570
571If the fileset is unmodified (and unlocked), this checks the specified
572revision into the working tree. You can also specify a revision on
573another branch by giving its revision or branch ID (@pxref{Switching
574Branches}). An empty argument (i.e.@: @kbd{C-u C-x v v @key{RET}})
575checks out the latest (``head'') revision on the current branch.
576
577This signals an error on a decentralized version control system.
578Those systems do not let you specify your own revision IDs, nor do
579they use the concept of ``checking out'' individual files.
585@end itemize 580@end itemize
586 581
587@node Log Buffer 582@node Log Buffer
@@ -646,8 +641,9 @@ the @samp{*vc-log*} buffer. If the topmost item in each
646this command searches that item for entries matching the file(s) to be 641this command searches that item for entries matching the file(s) to be
647committed, and inserts them. 642committed, and inserts them.
648@ifnottex 643@ifnottex
649@xref{Change Logs and VC}, for the opposite way of 644If you are using CVS or RCS, see @ref{Change Logs and VC}, for the
650working---generating ChangeLog entries from the Log Edit buffer. 645opposite way of working---generating ChangeLog entries from the Log
646Edit buffer.
651@end ifnottex 647@end ifnottex
652 648
653 To abort a commit, just @strong{don't} type @kbd{C-c C-c} in that 649 To abort a commit, just @strong{don't} type @kbd{C-c C-c} in that
@@ -935,13 +931,13 @@ revision at point. A second @key{RET} hides it again.
935(@code{vc-log-incoming}) command displays a log buffer showing the 931(@code{vc-log-incoming}) command displays a log buffer showing the
936changes that will be applied, the next time you run the version 932changes that will be applied, the next time you run the version
937control system's ``pull'' command to get new revisions from another 933control system's ``pull'' command to get new revisions from another
938repository. This other repository is the default one from which 934repository (@pxref{VC Pull}). This other repository is the default
939changes are pulled, as defined by the version control system; with a 935one from which changes are pulled, as defined by the version control
940prefix argument, @code{vc-log-incoming} prompts for a specific 936system; with a prefix argument, @code{vc-log-incoming} prompts for a
941repository. Similarly, @kbd{C-x v O} (@code{vc-log-outgoing}) shows 937specific repository. Similarly, @kbd{C-x v O}
942the changes that will be sent to another repository, the next time you 938(@code{vc-log-outgoing}) shows the changes that will be sent to
943run the ``push'' command; with a prefix argument, it prompts for a 939another repository, the next time you run the ``push'' command; with a
944specific destination repository. 940prefix argument, it prompts for a specific destination repository.
945 941
946 In the @samp{*vc-change-log*} buffer, you can use the following keys 942 In the @samp{*vc-change-log*} buffer, you can use the following keys
947to move between the logs of revisions and of files, and to examine and 943to move between the logs of revisions and of files, and to examine and
@@ -1339,8 +1335,8 @@ command to use, which lets you specify where to pull changes from.
1339Otherwise, it pulls from a default location determined by the version 1335Otherwise, it pulls from a default location determined by the version
1340control system. 1336control system.
1341 1337
1342 Amongst decentralized version control systems, @kbd{C-x v +} 1338 Amongst decentralized version control systems, @kbd{C-x v +} is
1343currently supports only Bazaar, Git, and Mercurial. On Bazaar, it 1339currently supported only by Bazaar, Git, and Mercurial. On Bazaar, it
1344calls @command{bzr pull} for ordinary branches (to pull from a master 1340calls @command{bzr pull} for ordinary branches (to pull from a master
1345branch into a mirroring branch), and @command{bzr update} for a bound 1341branch into a mirroring branch), and @command{bzr update} for a bound
1346branch (to pull from a central repository). On Git, it calls 1342branch (to pull from a central repository). On Git, it calls
@@ -1349,6 +1345,10 @@ it into the current branch. On Mercurial, it calls @command{hg pull
1349-u} to fetch changesets from the default remote repository and update 1345-u} to fetch changesets from the default remote repository and update
1350the working directory. 1346the working directory.
1351 1347
1348 Prior to pulling, you can use @kbd{C-x v I} (@code{vc-log-incoming})
1349to view a log buffer of the changes to be applied. @xref{VC Change
1350Log}.
1351
1352 On a centralized version control system like CVS, @kbd{C-x v +} 1352 On a centralized version control system like CVS, @kbd{C-x v +}
1353updates the current VC fileset from the repository. 1353updates the current VC fileset from the repository.
1354 1354
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 892c574734b..e2051a93c60 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -606,12 +606,13 @@ information on customizing indentation for C and related modes,
606including how to override parts of an existing style and how to define 606including how to override parts of an existing style and how to define
607your own styles. 607your own styles.
608 608
609 As an alternative to specifying a style, you can get Emacs to 609@findex c-guess
610@dfn{guess} the style by scanning a code buffer which is already 610@findex c-guess-install
611formatted. To do this, call @kbd{M-x c-guess} in your sample buffer. 611 As an alternative to specifying a style, you can tell Emacs to guess
612You can then apply this guessed style to other buffers with @kbd{M-x 612a style by typing @kbd{M-x c-guess} in a sample code buffer. You can
613then apply the guessed style to other buffers with @kbd{M-x
613c-guess-install}. @xref{Guessing the Style,,, ccmode, the CC Mode 614c-guess-install}. @xref{Guessing the Style,,, ccmode, the CC Mode
614Manual}, for more details about this mechanism. 615Manual}, for details.
615 616
616@node Parentheses 617@node Parentheses
617@section Commands for Editing with Parentheses 618@section Commands for Editing with Parentheses
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index c4a4b351cac..700003db58a 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -5,301 +5,6 @@
5@c This file is included either in vc-xtra.texi (when producing the 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). 6@c printed version) or in the main Emacs manual (for the on-line version).
7 7
8@node Remote Repositories
9@subsection Remote Repositories
10@cindex remote repositories
11
12 A common way of using CVS and other more advanced VCSes is to set up
13a central repository on some Internet host, then have each
14developer check out a personal working copy of the files on his local
15machine. Committing changes to the repository, and picking up changes
16from other users into one's own working area, then works by direct
17interactions with the repository server.
18
19 One difficulty is that access to a repository server is often slow,
20and that developers might need to work off-line as well. While only
21third-generation decentralized VCses such as GNU Arch or Mercurial
22really solve this problem, VC is designed to reduce the amount of
23network interaction necessary.
24
25 If you are using a truly decentralized VCS you can skip the rest of
26this section. It describes backup and local-repository techniques
27that are only useful for Subversion and earlier VCSes.
28
29@menu
30* Version Backups:: Keeping local copies of repository versions.
31* Local Version Control:: Using another version system for local editing.
32@end menu
33
34@node Version Backups
35@subsubsection Version Backups
36@cindex version backups
37
38@cindex automatic version backups
39 When VC sees that the repository for a file is on a remote
40machine, it automatically makes local backups of unmodified versions
41of the file---@dfn{automatic version backups}. This means that you
42can compare the file to the repository version (@kbd{C-x v =}), or
43revert to that version (@kbd{C-x v u}), without any network
44interactions.
45
46 The local copy of the unmodified file is called a @dfn{version
47backup} to indicate that it corresponds exactly to a version that is
48stored in the repository. Note that version backups are not the same
49as ordinary Emacs backup files
50@iftex
51(@pxref{Backup,,,emacs, the Emacs Manual}).
52@end iftex
53@ifnottex
54(@pxref{Backup}).
55@end ifnottex
56But they follow a similar naming convention.
57
58 For a file that comes from a remote repository, VC makes a
59version backup whenever you save the first changes to the file, and
60removes it after you have committed your modified version to the
61repository. You can disable the making of automatic version backups by
62setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
63
64@cindex manual version backups
65 The name of the automatic version backup for version @var{version}
66of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
67almost the same as the name used by @kbd{C-x v ~}
68@iftex
69(@pxref{Old Revisions,,,emacs, the Emacs Manual}),
70@end iftex
71@ifnottex
72(@pxref{Old Revisions}),
73@end ifnottex
74the only difference being the additional dot (@samp{.}) after the
75version number. This similarity is intentional, because both kinds of
76files store the same kind of information. The file made by @kbd{C-x v
77~} acts as a @dfn{manual version backup}.
78
79 All the VC commands that operate on old versions of a file can use
80both kinds of version backups. For instance, @kbd{C-x v ~} uses
81either an automatic or a manual version backup, if possible, to get
82the contents of the version you request. Likewise, @kbd{C-x v =} and
83@kbd{C-x v u} use either an automatic or a manual version backup, if
84one of them exists, to get the contents of a version to compare or
85revert to. If you changed a file outside of Emacs, so that no
86automatic version backup was created for the previous text, you can
87create a manual backup of that version using @kbd{C-x v ~}, and thus
88obtain the benefit of the local copy for Emacs commands.
89
90 The only difference in Emacs's handling of manual and automatic
91version backups, once they exist, is that Emacs deletes automatic
92version backups when you commit to the repository. By contrast,
93manual version backups remain until you delete them.
94
95@node Local Version Control
96@subsubsection Local Version Control
97@cindex local version control
98@cindex local back end (version control)
99
100When you make many changes to a file that comes from a remote
101repository, it can be convenient to have version control on your local
102machine as well. You can then record intermediate versions, revert to
103a previous state, etc., before you actually commit your changes to the
104remote server.
105
106VC lets you do this by putting a file under a second, local version
107control system, so that the file is effectively registered in two
108systems at the same time. For the description here, we will assume
109that the remote system is CVS, and you use RCS locally, although the
110mechanism works with any combination of version control systems
111(@dfn{back ends}).
112
113To make it work with other back ends, you must make sure that the
114``more local'' back end comes before the ``more remote'' back end in
115the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
116default, this variable is set up so that you can use remote CVS and
117local RCS as described here.
118
119To start using local RCS for a file that comes from a remote CVS
120server, you must @emph{register the file in RCS}, by typing @kbd{C-u
121C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
122prefix argument, and specify RCS as the back end.)
123
124You can do this at any time; it does not matter whether you have
125already modified the file with respect to the version in the CVS
126repository. If possible, VC tries to make the RCS master start with
127the unmodified repository version, then checks in any local changes
128as a new version. This works if you have not made any changes yet, or
129if the unmodified repository version exists locally as a version
130backup (@pxref{Version Backups}). If the unmodified version is not
131available locally, the RCS master starts with the modified version;
132the only drawback to this is that you cannot compare your changes
133locally to what is stored in the repository.
134
135The version number of the RCS master is derived from the current CVS
136version, starting a branch from it. For example, if the current CVS
137version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
138the RCS master will be identical to version 1.23 under CVS; your first
139changes are checked in as 1.23.1.1. (If the unmodified file is not
140available locally, VC will check in the modified file twice, both as
1411.23 and 1.23.1.1, to make the revision numbers consistent.)
142
143If you do not use locking under CVS (the default), locking is also
144disabled for RCS, so that editing under RCS works exactly as under
145CVS.
146
147When you are done with local editing, you can commit the final version
148back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
149This initializes the log entry buffer
150@iftex
151(@pxref{Log Buffer,,,emacs, the Emacs Manual})
152@end iftex
153@ifnottex
154(@pxref{Log Buffer})
155@end ifnottex
156to contain all the log entries you have recorded in the RCS master;
157you can edit them as you wish, and then commit in CVS by typing
158@kbd{C-c C-c}. If the commit is successful, VC removes the RCS
159master, so that the file is once again registered under CVS only.
160(The RCS master is not actually deleted, just renamed by appending
161@samp{~} to the name, so that you can refer to it later if you wish.)
162
163While using local RCS, you can pick up recent changes from the CVS
164repository into your local file, or commit some of your changes back
165to CVS, without terminating local RCS version control. To do this,
166switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
167
168@table @kbd
169@item C-x v b
170Switch to another back end that the current file is registered
171under (@code{vc-switch-backend}).
172
173@item C-u C-x v b @var{backend} @key{RET}
174Switch to @var{backend} for the current file.
175@end table
176
177@kindex C-x v b
178@findex vc-switch-backend
179@kbd{C-x v b} does not change the buffer contents, or any files; it
180only changes VC's perspective on how to handle the file. Any
181subsequent VC commands for that file will operate on the back end that
182is currently selected.
183
184If the current file is registered in more than one back end, typing
185@kbd{C-x v b} ``cycles'' through all of these back ends. With a
186prefix argument, it asks for the back end to use in the minibuffer.
187
188Thus, if you are using local RCS, and you want to pick up some recent
189changes in the file from remote CVS, first visit the file, then type
190@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
191@key{RET}} to merge the news
192@iftex
193(@pxref{Merging,,,emacs, the Emacs Manual}).
194@end iftex
195@ifnottex
196(@pxref{Merging}).
197@end ifnottex
198You can then switch back to RCS by typing @kbd{C-x v b} again, and
199continue to edit locally.
200
201But if you do this, the revision numbers in the RCS master no longer
202correspond to those of CVS. Technically, this is not a problem, but
203it can become difficult to keep track of what is in the CVS repository
204and what is not. So we suggest that you return from time to time to
205CVS-only operation, by committing your local changes back to the
206repository using @kbd{C-u C-x v v cvs @key{RET}}.
207
208@node Revision Tags
209@subsection Revision Tags
210@cindex tags and version control
211
212 In a VCS with per-file revision numbers (such as SCCS, RCS, or CVS)
213@dfn{tag} is a named set of file versions (one for each registered
214file) that you can treat as a unit. In a VCS with per-repository
215version numbers (Subversion and most later ones) a tag is simply
216a symbolic name for a revision.
217
218 One important kind of tag is a @dfn{release}, a (theoretically)
219stable version of the system that is ready for distribution to users.
220
221@menu
222* Making Revision Tags:: The tag facilities.
223* Revision Tag Caveats:: Things to be careful of when using tags.
224@end menu
225
226@node Making Revision Tags
227@subsubsection Making and Using Revision Tags
228
229 There are two basic commands for tags; one makes a
230tag with a given name, the other retrieves a named tag.
231
232@table @code
233@kindex C-x v s
234@findex vc-create-tag
235@item C-x v s @var{name} @key{RET}
236Define the working revision of every registered file in or under the
237current directory as a tag named @var{name}
238(@code{vc-create-tag}).
239
240@kindex C-x v r
241@findex vc-retrieve-tag
242@item C-x v r @var{name} @key{RET}
243For all registered files at or below the current directory level,
244retrieve the tagged revision @var{name}. This command will
245switch to a branch if @var{name} is a branch name and your VCS
246distinguishes branches from tags.
247(@code{vc-retrieve-tag}).
248
249This command reports an error if any files are locked at or below the
250current directory, without changing anything; this is to avoid
251overwriting work in progress.
252@end table
253
254Tags are inexpensive, so you need not hesitate to create them whenever
255they are useful. Branches vary in cost depending on your VCS; in
256older ones they may be expensive.
257
258 You can give a tag or branch name as an argument to @kbd{C-x v =} or
259@kbd{C-x v ~}
260@iftex
261(@pxref{Old Revisions,,,emacs, the Emacs Manual}).
262@end iftex
263@ifnottex
264(@pxref{Old Revisions}).
265@end ifnottex
266Thus, you can use it to compare a tagged version against the current files,
267or two tagged versions against each other.
268
269@node Revision Tag Caveats
270@subsubsection Revision Tag Caveats
271
272 For SCCS, VC implements tags itself; these tags are visible only
273through VC. Most later systems (including CVS, Subversion, bzr, git,
274and hg) have a native tag facility, and VC uses it where
275available; those tags will be visible even when you bypass VC.
276
277 There is no support for VC tags using GNU Arch yet.
278
279 Under older VCSes (SCCS, RCS, CVS, early versions of Subversion),
280renaming and deletion could create some difficulties with tags. This is
281not a VC-specific problem, but a general design issue in version
282control systems that was not solved effectively until the earliest
283third-generation systems.
284
285 In a file-oriented VCS, when you rename a registered file you need
286to rename its master along with it; the command @code{vc-rename-file}
287will do this automatically. If you are using SCCS, you must also
288update the records of the tag, to mention the file by its new name
289(@code{vc-rename-file} does this, too). An old tag that refers to a
290master file that no longer exists under the recorded name is invalid;
291VC can no longer retrieve it. It would be beyond the scope of this
292manual to explain enough about RCS and SCCS to explain how to update
293the tags by hand.
294
295 Using @code{vc-rename-file} makes the tag remain valid for
296retrieval, but it does not solve all problems. For example, some of the
297files in your program probably refer to others by name. At the very
298least, the makefile probably mentions the file that you renamed. If you
299retrieve an old tag, the renamed file is retrieved under its new
300name, which is not the name that the makefile expects. So the program
301won't really work as retrieved.
302
303@node Miscellaneous VC 8@node Miscellaneous VC
304@subsection Miscellaneous Commands and Features of VC 9@subsection Miscellaneous Commands and Features of VC
305 10
@@ -309,50 +14,54 @@ won't really work as retrieved.
309* Change Logs and VC:: Generating a change log file from log entries. 14* Change Logs and VC:: Generating a change log file from log entries.
310* Renaming and VC:: A command to rename both the source and master 15* Renaming and VC:: A command to rename both the source and master
311 file correctly. 16 file correctly.
17* Revision Tags:: Symbolic names for revisions.
312* Version Headers:: Inserting version control headers into working files. 18* Version Headers:: Inserting version control headers into working files.
313@end menu 19@end menu
314 20
315@node Change Logs and VC 21@node Change Logs and VC
316@subsubsection Change Logs and VC 22@subsubsection Change Logs and VC
317 23
318 If you use RCS or CVS for a program and also maintain a change log 24 If you use RCS or CVS for a program with a @file{ChangeLog} file
319file for it
320@iftex 25@iftex
321(@pxref{Change Log,,,emacs, the Emacs Manual}), 26(@pxref{Change Log,,,emacs, the Emacs Manual}),
322@end iftex 27@end iftex
323@ifnottex 28@ifnottex
324(@pxref{Change Log}), 29(@pxref{Change Log}),
325@end ifnottex 30@end ifnottex
326you can generate change log entries automatically from the version 31you can generate change log entries from the version control log
327control log entries: 32entries of previous commits.
33
34 Note that this only works with RCS or CVS. This procedure would be
35particularly incorrect on a modern changeset-based version control
36system, where changes to the @file{ChangeLog} file would normally be
37committed as part of a changeset. In that case, you should write the
38change log entries first, then pull them into the @samp{*vc-log*}
39buffer when you commit
40@iftex
41(@pxref{Log Buffer,,,emacs, the Emacs Manual}).
42@end iftex
43@ifnottex
44(@pxref{Log Buffer}).
45@end ifnottex
328 46
329@table @kbd 47@table @kbd
330@item C-x v a 48@item C-x v a
331@kindex C-x v a 49@kindex C-x v a
332@findex vc-update-change-log 50@findex vc-update-change-log
333Visit the current directory's change log file and, for registered files 51Visit the current directory's @file{ChangeLog} file and, for
334in that directory, create new entries for versions checked in since the 52registered files in that directory, create new entries for versions
335most recent entry in the change log file. 53committed since the most recent change log entry
336(@code{vc-update-change-log}). 54(@code{vc-update-change-log}).
337 55
338This command works with RCS or CVS only, not with any of the other
339back ends.
340
341@item C-u C-x v a 56@item C-u C-x v a
342As above, but only find entries for the current buffer's file. 57As above, but only find entries for the current buffer's file.
343
344@item M-1 C-x v a
345As above, but find entries for all the currently visited files that are
346maintained with version control. This works only with RCS, and it puts
347all entries in the log for the default directory, which may not be
348appropriate.
349@end table 58@end table
350 59
351 For example, suppose the first line of @file{ChangeLog} is dated 60 For example, suppose the first line of @file{ChangeLog} is dated
3521999-04-10, and that the only check-in since then was by Nathaniel 611999-04-10, and that the only check-in since then was by Nathaniel
353Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log 62Bowditch to @file{rcs2log} on 1999-05-22 with log entry @samp{Ignore
354messages that start with `#'.}. Then @kbd{C-x v a} visits 63log messages that start with `#'.}. Then @kbd{C-x v a} inserts this
355@file{ChangeLog} and inserts text like this: 64@file{ChangeLog} entry:
356 65
357@iftex 66@iftex
358@medbreak 67@medbreak
@@ -369,17 +78,11 @@ messages that start with `#'.}. Then @kbd{C-x v a} visits
369@end iftex 78@end iftex
370 79
371@noindent 80@noindent
372You can then edit the new change log entry further as you wish. 81If the version control log entry specifies a function name (in
373 82parenthesis at the beginning of a line), that is reflected in the
374 Some of the new change log entries may duplicate what's already in 83@file{ChangeLog} entry. For example, if a log entry for @file{vc.el}
375ChangeLog. You will have to remove these duplicates by hand. 84is @samp{(vc-do-command): Check call-process status.}, the
376 85@file{ChangeLog} entry is:
377 Normally, the log entry for file @file{foo} is displayed as @samp{*
378foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
379if the text of the log entry starts with @w{@samp{(@var{functionname}):
380}}. For example, if the log entry for @file{vc.el} is
381@samp{(vc-do-command): Check call-process status.}, then the text in
382@file{ChangeLog} looks like this:
383 86
384@iftex 87@iftex
385@medbreak 88@medbreak
@@ -395,92 +98,108 @@ if the text of the log entry starts with @w{@samp{(@var{functionname}):
395@medbreak 98@medbreak
396@end iftex 99@end iftex
397 100
398 When @kbd{C-x v a} adds several change log entries at once, it groups 101 When @kbd{C-x v a} adds several change log entries at once, it
399related log entries together if they all are checked in by the same 102groups related log entries together if they all are checked in by the
400author at nearly the same time. If the log entries for several such 103same author at nearly the same time. If the log entries for several
401files all have the same text, it coalesces them into a single entry. 104such files all have the same text, it coalesces them into a single
402For example, suppose the most recent check-ins have the following log 105entry.
403entries:
404 106
405@flushleft 107@node Renaming and VC
406@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.} 108@subsubsection Renaming VC Work Files and Master Files
407@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.} 109@cindex renaming version-controlled files
408@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
409@end flushleft
410 110
411@noindent 111@table @kbd
412They appear like this in @file{ChangeLog}: 112@item M-x vc-rename-file
113Prompt for two file names, @var{VAR} and @var{OLD}, and rename them in
114the version-controlled working tree.
115@end table
413 116
414@iftex 117@findex vc-rename-file
415@medbreak 118 If you wish to rename a registered file in a version-controlled
416@end iftex 119working tree, use the command @kbd{M-x vc-rename-file}. This prompts
417@smallexample 120for two arguments: the file you wish to rename, followed by the new
418@group 121name; then it performs the renaming through the version control
4191999-04-01 Nathaniel Bowditch <nat@@apn.org> 122system.
123
124 On modern version control systems that have built-in support for
125renaming, the renaming operation takes effect immediately in the
126working tree, and takes effect in the repository when you commit the
127renamed file. The renamed file retains the full change history of the
128original file.
129
130 On CVS and older version control systems, the @code{vc-rename-file}
131command actually works by creating a copy of the old file under the
132new name, registering it, and deleting the old file. In this case,
133the change history is not preserved.
420 134
421 * vc.texinfo: Fix expansion typos. 135@node Revision Tags
136@subsubsection Revision Tags
137@cindex revision tag
138@cindex tags for version control
422 139
423 * vc.el, vc-hooks.el: Don't call expand-file-name. 140 Most version control systems allow you to apply a @dfn{revision tag}
424@end group 141to a specific version of a version-controlled tree. On modern
425@end smallexample 142changeset-based version control systems, a revision tag is simply a
426@iftex 143symbolic name for a particular revision. On older file-based systems
427@medbreak 144like CVS, each tag is added to the entire set of version-controlled
428@end iftex 145files, allowing them to be handled as a unit. Revision tags are
146commonly used to identify releases that are distributed to users.
429 147
430 Normally, @kbd{C-x v a} separates log entries by a blank line, but you 148 There are two basic commands for tags; one makes a tag with a given
431can mark several related log entries to be clumped together (without an 149name, the other retrieves a named tag.
432intervening blank line) by starting the text of each related log entry
433with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
434itself is not copied to @file{ChangeLog}. For example, suppose the log
435entries are:
436 150
437@flushleft 151@table @code
438@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.} 152@kindex C-x v s
439@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.} 153@findex vc-create-tag
440@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.} 154@item C-x v s @var{name} @key{RET}
441@end flushleft 155Define the working revision of every registered file in or under the
156current directory as a tag named @var{name}
157(@code{vc-create-tag}).
442 158
443@noindent 159@kindex C-x v r
444Then the text in @file{ChangeLog} looks like this: 160@findex vc-retrieve-tag
161@item C-x v r @var{name} @key{RET}
162For all registered files at or below the current directory level,
163retrieve the tagged revision @var{name}. This command will switch to a
164branch if @var{name} is a branch name and your VCS distinguishes
165branches from tags. (@code{vc-retrieve-tag}).
445 166
446@iftex 167This command reports an error if any files are locked at or below the
447@medbreak 168current directory, without changing anything; this is to avoid
448@end iftex 169overwriting work in progress.
449@smallexample 170@end table
450@group
4511999-04-01 Nathaniel Bowditch <nat@@apn.org>
452 171
453 * vc.texinfo: Fix expansion typos. 172 You can give a tag or branch name as an argument to @kbd{C-x v =} or
454 * vc.el, vc-hooks.el: Don't call expand-file-name. 173@kbd{C-x v ~}
455@end group
456@end smallexample
457@iftex 174@iftex
458@medbreak 175(@pxref{Old Revisions,,,emacs, the Emacs Manual}).
459@end iftex 176@end iftex
177@ifnottex
178(@pxref{Old Revisions}).
179@end ifnottex
180Thus, you can use it to compare a tagged version against the current files,
181or two tagged versions against each other.
460 182
461 A log entry whose text begins with @samp{#} is not copied to 183 On SCCS, VC implements tags itself; these tags are visible only
462@file{ChangeLog}. For example, if you merely fix some misspellings in 184through VC. Most later systems (including CVS, Subversion, bzr, git,
463comments, you can log the change with an entry beginning with @samp{#} 185and hg) have a native tag facility, and VC uses it where available;
464to avoid putting such trivia into @file{ChangeLog}. 186those tags will be visible even when you bypass VC.
465
466@node Renaming and VC
467@subsubsection Renaming VC Work Files and Master Files
468
469@findex vc-rename-file
470 When you rename a registered file, you must also rename its master
471file correspondingly to get proper results. Use @code{vc-rename-file}
472to rename the source file as you specify, and rename its master file
473accordingly. It also updates any tags (@pxref{Revision Tags}) that
474mention the file, so that they use the new name; despite this, the
475tag thus modified may not completely work (@pxref{Revision Tag Caveats}).
476
477 Some back ends do not provide an explicit rename operation to their
478repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
479on the original and renamed buffers and provide the necessary edit
480log.
481 187
482 You cannot use @code{vc-rename-file} on a file that is locked by 188 In a file-oriented VCS, when you rename a registered file you need
483someone else. 189to rename its master along with it; the command @code{vc-rename-file}
190will do this automatically. If you are using SCCS, you must also
191update the records of the tag, to mention the file by its new name
192(@code{vc-rename-file} does this, too). An old tag that refers to a
193master file that no longer exists under the recorded name is invalid;
194VC can no longer retrieve it. It would be beyond the scope of this
195manual to explain enough about RCS and SCCS to explain how to update
196the tags by hand. Using @code{vc-rename-file} makes the tag remain
197valid for retrieval, but it does not solve all problems. For example,
198some of the files in your program probably refer to others by name.
199At the very least, the makefile probably mentions the file that you
200renamed. If you retrieve an old tag, the renamed file is retrieved
201under its new name, which is not the name that the makefile expects.
202So the program won't really work as retrieved.
484 203
485@node Version Headers 204@node Version Headers
486@subsubsection Inserting Version Control Headers 205@subsubsection Inserting Version Control Headers
@@ -592,10 +311,9 @@ these systems, exclude its name from the list. To disable VC entirely,
592set this variable to @code{nil}. 311set this variable to @code{nil}.
593 312
594The order of systems in the list is significant: when you visit a file 313The order of systems in the list is significant: when you visit a file
595registered in more than one system (@pxref{Local Version Control}), VC 314registered in more than one system, VC uses the system that comes
596uses the system that comes first in @code{vc-handled-backends} by 315first in @code{vc-handled-backends} by default. The order is also
597default. The order is also significant when you register a file for 316significant when you register a file for the first time, see
598the first time, see
599@iftex 317@iftex
600@ref{Registering,,,emacs, the Emacs Manual}, 318@ref{Registering,,,emacs, the Emacs Manual},
601@end iftex 319@end iftex
@@ -708,37 +426,16 @@ the variable @code{vc-mistrust-permissions} affects SCCS use, but
708@node CVS Options 426@node CVS Options
709@subsubsection Options specific for CVS 427@subsubsection Options specific for CVS
710 428
711@cindex locking (CVS) 429@vindex vc-cvs-global-switches
712 By default, CVS does not use locking to coordinate the activities of 430 You can specify additional command line options to pass to all CVS
713several users; anyone can change a work file at any time. However, 431operations in the variable @code{vc-cvs-global-switches}. These
714there are ways to restrict this, resulting in behavior that resembles 432switches are inserted immediately after the @code{cvs} command, before
715locking. 433the name of the operation to invoke.
716
717@cindex CVSREAD environment variable (CVS)
718 For one thing, you can set the @env{CVSREAD} environment variable
719(the value you use makes no difference). If this variable is defined,
720CVS makes your work files read-only by default. In Emacs, you must
721type @kbd{C-x v v} to make the file writable, so that editing works
722in fact similar as if locking was used. Note however, that no actual
723locking is performed, so several users can make their files writable
724at the same time. When setting @env{CVSREAD} for the first time, make
725sure to check out all your modules anew, so that the file protections
726are set correctly.
727
728@cindex cvs watch feature
729@cindex watching files (CVS)
730 Another way to achieve something similar to locking is to use the
731@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
732read-only by default, and you must also use @kbd{C-x v v} in Emacs to
733make it writable. VC calls @code{cvs edit} to make the file writable,
734and CVS takes care to notify other developers of the fact that you
735intend to change the file. See the CVS documentation for details on
736using the watch feature.
737 434
738@vindex vc-stay-local 435@vindex vc-stay-local
739@vindex vc-cvs-stay-local 436@vindex vc-cvs-stay-local
740@cindex remote repositories (CVS) 437@cindex remote repositories (CVS)
741 When a file's repository is on a remote machine, VC tries to keep 438 When using a CVS repository on a remote machine, VC can try keeping
742network interactions to a minimum. This is controlled by the variable 439network interactions to a minimum. This is controlled by the variable
743@code{vc-cvs-stay-local}. There is another variable, 440@code{vc-cvs-stay-local}. There is another variable,
744@code{vc-stay-local}, which enables the feature also for other back 441@code{vc-stay-local}, which enables the feature also for other back
@@ -746,36 +443,58 @@ ends that support it, including CVS. In the following, we will talk
746only about @code{vc-cvs-stay-local}, but everything applies to 443only about @code{vc-cvs-stay-local}, but everything applies to
747@code{vc-stay-local} as well. 444@code{vc-stay-local} as well.
748 445
749If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses 446 If @code{vc-cvs-stay-local} is @code{t} (the default), VC determines
750only the entry in the local CVS subdirectory to determine the file's 447the version control status of each file using only the entry in the
751state (and possibly information returned by previous CVS commands). 448local CVS subdirectory and the information returned by previous CVS
752One consequence of this is that when you have modified a file, and 449commands. As a consequence, if you have modified a file and somebody
753somebody else has already checked in other changes to the file, you 450else has checked in other changes, you will not be notified of the
754are not notified of it until you actually try to commit. (But you can 451conflict until you try to commit.
755try to pick up any recent changes from the repository first, using 452
756@kbd{C-x v m @key{RET}}, 453 If you change @code{vc-cvs-stay-local} to @code{nil}, VC queries the
454remote repository @emph{before} it decides what to do in
455@code{vc-next-action} (@kbd{C-x v v}), just as it does for local
456repositories.
457
458 You can also set @code{vc-cvs-stay-local} to a regular expression
459that is matched against the repository host name; VC then stays local
460only for repositories from hosts that match the pattern.
461
462@cindex automatic version backups
463 When using a remote repository, Emacs normally makes @dfn{automatic
464version backups} of the original versions of each edited file. These
465local backups are made whenever you save the first changes to a file,
466and they are removed after you commit your changes to the repository.
467(Note that these are not the same as ordinary Emacs backup files;
757@iftex 468@iftex
758@pxref{Merging,,,emacs, the Emacs Manual}). 469@pxref{Backup,,,emacs, the Emacs Manual}.)
759@end iftex 470@end iftex
760@ifnottex 471@ifnottex
761@pxref{Merging}). 472@pxref{Backup}.)
762@end ifnottex 473@end ifnottex
474Commands like @kbd{C-x v =} and @kbd{C-x v u} make use of automatic
475version backups, if possible, to avoid having to access the network.
763 476
764 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local 477 Setting @code{vc-cvs-stay-local} to @code{nil} disables the making
765version backups, so that simple diff and revert operations are 478of automatic version backups.
766completely local (@pxref{Version Backups}).
767 479
768 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil}, 480@cindex manual version backups
769then VC queries the remote repository @emph{before} it decides what to 481 Automatic version backups have names of the form
770do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local 482@w{@code{@var{file}.~@var{version}.~}}. This is similar to the name
771repositories. It also does not make any version backups. 483that @kbd{C-x v ~} saves old versions to
772 484@iftex
773 You can also set @code{vc-cvs-stay-local} to a regular expression 485(@pxref{Old Revisions,,,emacs, the Emacs Manual}),
774that is matched against the repository host name; VC then stays local 486@end iftex
775only for repositories from hosts that match the pattern. 487@ifnottex
488(@pxref{Old Revisions}),
489@end ifnottex
490except for the additional dot (@samp{.}) after the version. The
491relevant VC commands can use both kinds of version backups. The main
492difference is that the ``manual'' version backups made by @kbd{C-x v
493~} are not deleted automatically when you commit.
776 494
777@vindex vc-cvs-global-switches 495@cindex locking (CVS)
778 You can specify additional command line options to pass to all CVS 496 CVS does not use locking by default, but there are ways to enable
779operations in the variable @code{vc-cvs-global-switches}. These 497locking-like behavior using its @env{CVSREAD} or @dfn{watch} feature;
780switches are inserted immediately after the @code{cvs} command, before 498see the CVS documentation for details. If that case, you can use
781the name of the operation to invoke. 499@kbd{C-x v v} in Emacs to toggle locking, as you would for a
500locking-based version control system (@pxref{VC With A Locking VCS}).