aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-20 11:00:10 +0800
committerChong Yidong2011-12-20 11:00:10 +0800
commit2edef1a0a6809d182d0003fe0413dfcb86ae47b6 (patch)
tree43f58c04fdb272b6669890b8b7f7c94192214d3a
parent1154d12e5b3597869808d576dafaf0734840bc0f (diff)
downloademacs-2edef1a0a6809d182d0003fe0413dfcb86ae47b6.tar.gz
emacs-2edef1a0a6809d182d0003fe0413dfcb86ae47b6.zip
More updates for VC documentation.
* doc/emacs/maintaining.texi (VCS Concepts): Add "working tree" terminology. (Old Revisions): Use it. (VCS Repositories): Add "distributed" terminology. (Log Buffer): Remove duplicate description about changesets. Fix "current VC fileset" ambiguity. (Multi-User Branching): Node deleted. (Branches, Switching Branches): Discuss decentralized version control systems. (VC Pull): New node. (Merging): Document merging on decentralized systems. (Creating Branches): Note that this is specific to CVS and related systems.
-rw-r--r--doc/emacs/ChangeLog15
-rw-r--r--doc/emacs/emacs.texi5
-rw-r--r--doc/emacs/maintaining.texi462
-rw-r--r--doc/emacs/vc1-xtra.texi9
-rw-r--r--etc/NEWS14
5 files changed, 230 insertions, 275 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 90bc9dc8c91..3475dda704a 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,18 @@
12011-12-20 Chong Yidong <cyd@gnu.org>
2
3 * maintaining.texi (VCS Concepts): Add "working tree" terminology.
4 (Old Revisions): Use it.
5 (VCS Repositories): Add "distributed" terminology.
6 (Log Buffer): Remove duplicate description
7 about changesets. Fix "current VC fileset" ambiguity.
8 (Multi-User Branching): Node deleted.
9 (Branches, Switching Branches): Discuss decentralized version
10 control systems.
11 (VC Pull): New node.
12 (Merging): Document merging on decentralized systems.
13 (Creating Branches): Note that this is specific to CVS and related
14 systems.
15
12011-12-19 Chong Yidong <cyd@gnu.org> 162011-12-19 Chong Yidong <cyd@gnu.org>
2 17
3 * maintaining.texi (VCS Merging, VCS Changesets): Index entries. 18 * maintaining.texi (VCS Merging, VCS Changesets): Index entries.
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 3a93889f6c7..d3caf4e63df 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -776,10 +776,9 @@ VC Directory Mode
776Multiple Branches of a File 776Multiple Branches of a File
777 777
778* Switching Branches:: How to get to another existing branch. 778* Switching Branches:: How to get to another existing branch.
779* Creating Branches:: How to start a new branch. 779* VC Pull:: Updating a branch from another branch.
780* Merging:: Transferring changes between branches. 780* Merging:: Transferring changes between branches.
781* Multi-User Branching:: Multiple users working at multiple branches 781* Creating Branches:: How to start a new branch.
782 in parallel.
783 782
784Remote Repositories 783Remote Repositories
785 784
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 96d520e143c..8bf7d74f9b6 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -164,14 +164,14 @@ meta-data, renames, copies, and deletes).
164@cindex GNU Arch 164@cindex GNU Arch
165@cindex Arch 165@cindex Arch
166@item 166@item
167GNU Arch is one of the earliest @dfn{distributed} version control 167GNU Arch is one of the earliest @dfn{decentralized} version control
168systems (the other being Monotone). @xref{VCS Concepts}, for a 168systems (the other being Monotone). @xref{VCS Concepts}, for a
169description of distributed version control systems. It is no longer 169description of decentralized version control systems. It is no longer
170under active development, and has been deprecated in favor of Bazaar. 170under active development, and has been deprecated in favor of Bazaar.
171 171
172@cindex git 172@cindex git
173@item 173@item
174Git is a distributed version control system originally invented by 174Git is a decentralized version control system originally invented by
175Linus Torvalds to support development of Linux (his kernel). VC 175Linus Torvalds to support development of Linux (his kernel). VC
176supports many common Git operations, but others, such as repository 176supports many common Git operations, but others, such as repository
177syncing, must be done from the command line. 177syncing, must be done from the command line.
@@ -179,15 +179,15 @@ syncing, must be done from the command line.
179@cindex hg 179@cindex hg
180@cindex Mercurial 180@cindex Mercurial
181@item 181@item
182Mercurial (hg) is a distributed version control system broadly 182Mercurial (hg) is a decentralized version control system broadly
183resembling Git. VC supports most Mercurial commands, with the 183resembling Git. VC supports most Mercurial commands, with the
184exception of repository sync operations. 184exception of repository sync operations.
185 185
186@cindex bzr 186@cindex bzr
187@cindex Bazaar 187@cindex Bazaar
188@item 188@item
189Bazaar (bzr) is a distributed version control system that supports 189Bazaar (bzr) is a decentralized version control system that supports
190both repository-based and distributed versioning. VC supports most 190both repository-based and decentralized versioning. VC supports most
191basic editing operations under Bazaar. 191basic editing operations under Bazaar.
192@end itemize 192@end itemize
193 193
@@ -211,6 +211,9 @@ would an ordinary file. After you are done with a set of changes, you
211may @dfn{commit} (or @dfn{check in}) the changes; this records the 211may @dfn{commit} (or @dfn{check in}) the changes; this records the
212changes in the repository, along with a descriptive log entry. 212changes in the repository, along with a descriptive log entry.
213 213
214@cindex working tree
215 A directory tree of work files is called a @dfn{working tree}.
216
214@cindex revision 217@cindex revision
215@cindex revision ID 218@cindex revision ID
216 Each commit creates a new @dfn{revision} in the repository. The 219 Each commit creates a new @dfn{revision} in the repository. The
@@ -263,7 +266,7 @@ number and severity of conflicts that actually occur.
263 SCCS always uses locking. RCS is lock-based by default but can be 266 SCCS always uses locking. RCS is lock-based by default but can be
264told to operate in a merging style. CVS and Subversion are 267told to operate in a merging style. CVS and Subversion are
265merge-based by default but can be told to operate in a locking mode. 268merge-based by default but can be told to operate in a locking mode.
266Distributed version control systems, such as GNU Arch, Git, and 269Decentralized version control systems, such as GNU Arch, Git, and
267Mercurial, are exclusively merging-based. 270Mercurial, are exclusively merging-based.
268 271
269 VC mode supports both locking and merging version control. The 272 VC mode supports both locking and merging version control. The
@@ -295,18 +298,20 @@ all of it.
295 298
296@cindex centralized version control 299@cindex centralized version control
297@cindex decentralized version control 300@cindex decentralized version control
301@cindex distributed version control
298 Early version control systems were designed around a 302 Early version control systems were designed around a
299@dfn{centralized} model in which each project has only one repository 303@dfn{centralized} model in which each project has only one repository
300used by all developers. SCCS, RCS, CVS, and Subversion share this 304used by all developers. SCCS, RCS, CVS, and Subversion share this
301kind of model. One of its drawbacks is that the repository is a choke 305kind of model. One of its drawbacks is that the repository is a choke
302point for reliability and efficiency. 306point for reliability and efficiency.
303 307
304 GNU Arch pioneered the concept of @dfn{decentralized} version 308 GNU Arch pioneered the concept of @dfn{distributed} or
305control, later implemented in Git, Mercurial, and Bazaar. A project 309@dfn{decentralized} version control, later implemented in Git,
306may have several different repositories, and these systems support a 310Mercurial, and Bazaar. A project may have several different
307sort of super-merge between repositories that tries to reconcile their 311repositories, and these systems support a sort of super-merge between
308change histories. In effect, there is one repository for each 312repositories that tries to reconcile their change histories. In
309developer, and repository merges take the place of commit operations. 313effect, there is one repository for each developer, and repository
314merges take the place of commit operations.
310 315
311 VC helps you manage the traffic between your personal workfiles and 316 VC helps you manage the traffic between your personal workfiles and
312a repository. Whether the repository is a single master, or one of a 317a repository. Whether the repository is a single master, or one of a
@@ -411,14 +416,13 @@ VC fileset is simply that one file. When you type them in a VC
411Directory buffer, and some files in it are marked, the VC fileset 416Directory buffer, and some files in it are marked, the VC fileset
412consists of the marked files (@pxref{VC Directory Mode}). 417consists of the marked files (@pxref{VC Directory Mode}).
413 418
414 On Subversion and on decentralized version control systems, 419 On modern changeset-based version control systems (@pxref{VCS
415multi-file VC filesets are handled as a single group by the relevant 420Changesets}), VC commands handle multi-file VC filesets as a group.
416version control commands. For example, committing a multi-file VC 421For example, committing a multi-file VC fileset generates a single
417fileset generates a single revision, consisting of all the changes to 422revision, containing the changes to all those files. On older
418those files. But on older version control systems which lack support 423file-based version control systems like CVS, each file in a multi-file
419for group operations, such as CVS, the files in a multi-file VC 424VC fileset is handled individually; for example, a commit generates
420fileset are passed individually to version control commands (e.g.@: a 425one revision for each changed file.
421commit generates one revision for each changed file).
422 426
423@table @kbd 427@table @kbd
424@itemx C-x v v 428@itemx C-x v v
@@ -428,7 +432,7 @@ VC fileset.
428 432
429@findex vc-next-action 433@findex vc-next-action
430@kindex C-x v v 434@kindex C-x v v
431 The principal VC command is an all-purpose command, @kbd{C-x v v} 435 The principal VC command is a multi-purpose command, @kbd{C-x v v}
432(@code{vc-next-action}), which performs the ``most appropriate'' 436(@code{vc-next-action}), which performs the ``most appropriate''
433action on the current VC fileset: either registering it with a version 437action on the current VC fileset: either registering it with a version
434control system, or committing it, or unlocking it, or merging changes 438control system, or committing it, or unlocking it, or merging changes
@@ -599,13 +603,13 @@ variant of Text mode (@pxref{Text Mode}). On entering Log Edit mode,
599Emacs runs the hooks @code{text-mode-hook} and @code{vc-log-mode-hook} 603Emacs runs the hooks @code{text-mode-hook} and @code{vc-log-mode-hook}
600(@pxref{Hooks}). 604(@pxref{Hooks}).
601 605
602 While in the @samp{*vc-log*} buffer, you can write one or more 606 In the @samp{*vc-log*} buffer, you can write one or more @dfn{header
603@dfn{header lines}, specifying additional information to be supplied 607lines}, specifying additional information to be supplied to the
604to the version control system. Each header line must occupy a single 608version control system. Each header line must occupy a single line at
605line at the top of the buffer; the first line that is not a header 609the top of the buffer; the first line that is not a header line is
606line is treated as the start of the log entry. For example, the 610treated as the start of the log entry. For example, the following
607following header line states that the present change was not written 611header line states that the present change was not written by you, but
608by you, but by another developer: 612by another developer:
609 613
610@smallexample 614@smallexample
611Author: J. R. Hacker <jrh@@example.com> 615Author: J. R. Hacker <jrh@@example.com>
@@ -617,32 +621,25 @@ Apart from the @samp{Author} header, Emacs recognizes the headers
617reference to a bug fixed by the change). Not all version control 621reference to a bug fixed by the change). Not all version control
618systems recognize all headers: Bazaar recognizes all three headers, 622systems recognize all headers: Bazaar recognizes all three headers,
619while Git, Mercurial, and Monotone recognize only @samp{Author} and 623while Git, Mercurial, and Monotone recognize only @samp{Author} and
620@samp{Date}. If you specify a header for a version control that does 624@samp{Date}. If you specify a header for a system that does not
621not support it, the header is treated as part of the log entry. 625support it, the header is treated as part of the log entry.
622 626
623@kindex C-c C-f @r{(Log Edit mode)} 627@kindex C-c C-f @r{(Log Edit mode)}
624@findex log-edit-show-files 628@findex log-edit-show-files
625 Type @kbd{C-c C-f} (@code{log-edit-show-files}) in the
626@samp{*vc-log*} buffer to view a list of files for the VC fileset that
627is to be committed. If you called @kbd{C-x v v} directly from a work
628file, the fileset consists of that single file. If you called
629@kbd{C-x v v} from a VC directory buffer (@pxref{VC Directory Mode}),
630the fileset may consist of multiple files; in that case, @kbd{C-c C-c}
631will commit those files together, as a single revision, if that is
632supported by the version control system (on older version control
633systems, such as CVS, each file in a multi-file VC fileset is
634committed as an individual revision).
635
636@kindex C-c C-d @r{(Log Edit mode)} 629@kindex C-c C-d @r{(Log Edit mode)}
637@findex log-edit-show-diff 630@findex log-edit-show-diff
638 Type @kbd{C-c C-d} (@code{log-edit-show-diff}) to show a @dfn{diff} 631 While in the @samp{*vc-log*} buffer, the ``current VC fileset'' is
639of the changes between the current VC fileset and the repository 632considered to be the fileset that will be committed if you type
640revision from which you started editing. @xref{Old Revisions}. 633@w{@kbd{C-c C-c}}. To view a list of the files in the VC fileset,
634type @w{@kbd{C-c C-f}} (@code{log-edit-show-files}). To view a diff
635of changes between the VC fileset and the version from which you
636started editing (@pxref{Old Revisions}), type @kbd{C-c C-d}
637(@code{log-edit-show-diff}).
641 638
642@kindex C-c C-a @r{(Log Edit mode)} 639@kindex C-c C-a @r{(Log Edit mode)}
643@findex log-edit-insert-changelog 640@findex log-edit-insert-changelog
644 If the VC fileset that is to be committed includes one or more 641 If the VC fileset includes one or more @file{ChangeLog} files
645@file{ChangeLog} files (@pxref{Change Log}), type @kbd{C-c C-a} 642(@pxref{Change Log}), type @kbd{C-c C-a}
646(@code{log-edit-insert-changelog}) to pull the relevant entries into 643(@code{log-edit-insert-changelog}) to pull the relevant entries into
647the @samp{*vc-log*} buffer. If the topmost item in each 644the @samp{*vc-log*} buffer. If the topmost item in each
648@file{ChangeLog} was made under your user name on the current date, 645@file{ChangeLog} was made under your user name on the current date,
@@ -650,7 +647,7 @@ this command searches that item for entries matching the file(s) to be
650committed, and inserts them. 647committed, and inserts them.
651@ifnottex 648@ifnottex
652@xref{Change Logs and VC}, for the opposite way of 649@xref{Change Logs and VC}, for the opposite way of
653working---generating ChangeLog entries from the revision control log. 650working---generating ChangeLog entries from the Log Edit buffer.
654@end ifnottex 651@end ifnottex
655 652
656 To abort a commit, just @strong{don't} type @kbd{C-c C-c} in that 653 To abort a commit, just @strong{don't} type @kbd{C-c C-c} in that
@@ -710,9 +707,8 @@ i} or @kbd{C-x v v} adds it to the ``working tree'' but not to the
710repository. Such files are labeled as @samp{added} in the VC 707repository. Such files are labeled as @samp{added} in the VC
711Directory buffer, and show a revision ID of @samp{@@@@} in the mode 708Directory buffer, and show a revision ID of @samp{@@@@} in the mode
712line. To make the registration take effect in the repository, you 709line. To make the registration take effect in the repository, you
713must perform a commit (@pxref{Basic VC Editing}). Note that on 710must perform a commit (@pxref{Basic VC Editing}). Note that a single
714changeset-based version control systems, commits can consist of both 711commit can include both file additions and edits to existing files.
715file additions and modifications.
716 712
717 On a locking-based version control system (@pxref{VCS Merging}), 713 On a locking-based version control system (@pxref{VCS Merging}),
718registering a file leaves it unlocked and read-only. Type @kbd{C-x v 714registering a file leaves it unlocked and read-only. Type @kbd{C-x v
@@ -730,14 +726,14 @@ call this command from a Dired buffer (@pxref{Dired}).
730 726
731@ifnottex 727@ifnottex
732@item M-x vc-ediff 728@item M-x vc-ediff
733Like @kbd{C-x v =}, but using an Ediff session. @xref{Top, Ediff, 729Like @kbd{C-x v =}, but using Ediff. @xref{Top, Ediff, ediff, The
734ediff, The Ediff Manual}. 730Ediff Manual}.
735@end ifnottex 731@end ifnottex
736 732
737@item C-x v D 733@item C-x v D
738Compare all work files in the current version controlled directory 734Compare the entire working tree to the revision you started from
739tree to the tree you started from (@code{vc-root-diff}). With a 735(@code{vc-root-diff}). With a prefix argument, prompt for two
740prefix argument, prompt for two revisions and compare their trees. 736revisions and compare their trees.
741 737
742@item C-x v ~ 738@item C-x v ~
743Prompt for a revision of the current file, and visit it in a separate 739Prompt for a revision of the current file, and visit it in a separate
@@ -788,12 +784,10 @@ Ediff session. @xref{Top, Ediff, ediff, The Ediff Manual}.
788@findex vc-root-diff 784@findex vc-root-diff
789@kindex C-x v D 785@kindex C-x v D
790 @kbd{C-x v D} (@code{vc-root-diff}) is similar to @kbd{C-x v =}, but 786 @kbd{C-x v D} (@code{vc-root-diff}) is similar to @kbd{C-x v =}, but
791it displays a comparison between the entire current version controlled 787it displays the changes in the entire current working tree (i.e.@: the
792tree (i.e.@: the tree controlled by the version control system 788working tree containing the current VC fileset). If you invoke this
793associated with the current VC fileset, which may include files that 789command from a Dired buffer, it applies to the working tree containing
794are not part of that fileset) and the tree you started with. If you 790the directory.
795invoke this command from a Dired buffer, it applies to the entire
796version controlled tree containing the directory.
797 791
798@vindex vc-diff-switches 792@vindex vc-diff-switches
799 You can customize the @command{diff} options that @kbd{C-x v =} and 793 You can customize the @command{diff} options that @kbd{C-x v =} and
@@ -801,14 +795,14 @@ version controlled tree containing the directory.
801from the first non-@code{nil} value amongst the variables 795from the first non-@code{nil} value amongst the variables
802@code{vc-@var{backend}-diff-switches}, @code{vc-diff-switches}, and 796@code{vc-@var{backend}-diff-switches}, @code{vc-diff-switches}, and
803@code{diff-switches} (@pxref{Comparing Files}), in that order. Here, 797@code{diff-switches} (@pxref{Comparing Files}), in that order. Here,
804@var{backend} stands for the current version control system, 798@var{backend} stands for the relevant version control system,
805e.g.@: @code{bzr} for Bazaar. Since @code{nil} means to check the 799e.g.@: @code{bzr} for Bazaar. Since @code{nil} means to check the
806next variable in the sequence, either of the first two may use the 800next variable in the sequence, either of the first two may use the
807value @code{t} to mean no switches at all. Most of the 801value @code{t} to mean no switches at all. Most of the
808@code{vc-@var{backend}-diff-switches} variables default to @code{nil}, 802@code{vc-@var{backend}-diff-switches} variables default to @code{nil},
809but some default to @code{t}; these are for version control systems, 803but some default to @code{t}; these are for version control systems
810such as Subversion, whose @code{diff} implementations do not accept 804whose @code{diff} implementations do not accept common diff options,
811common diff options. 805such as Subversion.
812 806
813@findex vc-revision-other-window 807@findex vc-revision-other-window
814@kindex C-x v ~ 808@kindex C-x v ~
@@ -937,7 +931,7 @@ showing only the first line of each log entry. However, you can type
937@samp{*vc-change-log*} buffer to reveal the entire log entry for the 931@samp{*vc-change-log*} buffer to reveal the entire log entry for the
938revision at point. A second @key{RET} hides it again. 932revision at point. A second @key{RET} hides it again.
939 933
940 On a distributed version control system, the @kbd{C-x v I} 934 On a decentralized version control system, the @kbd{C-x v I}
941(@code{vc-log-incoming}) command displays a log buffer showing the 935(@code{vc-log-incoming}) command displays a log buffer showing the
942changes that will be applied, the next time you run the version 936changes that will be applied, the next time you run the version
943control system's ``pull'' command to get new revisions from another 937control system's ``pull'' command to get new revisions from another
@@ -1144,9 +1138,8 @@ are working offline or the network is slow.
1144 1138
1145@vindex vc-directory-exclusion-list 1139@vindex vc-directory-exclusion-list
1146 The VC Directory buffer omits subdirectories listed in the variable 1140 The VC Directory buffer omits subdirectories listed in the variable
1147@code{vc-directory-exclusion-list}. The default value of this 1141@code{vc-directory-exclusion-list}. Its default value contains
1148variable contains directories that are used internally by version 1142directories that are used internally by version control systems.
1149control systems.
1150 1143
1151@node VC Directory Commands 1144@node VC Directory Commands
1152@subsubsection VC Directory Commands 1145@subsubsection VC Directory Commands
@@ -1268,221 +1261,174 @@ Git and Bazaar allow you to manipulate @dfn{stashes} and @dfn{shelves}
1268bring them back at a later time). 1261bring them back at a later time).
1269 1262
1270@node Branches 1263@node Branches
1271@subsection Multiple Branches of a File 1264@subsection Version Control Branches
1272@cindex branch (version control) 1265@cindex branch (version control)
1273@cindex trunk (version control) 1266
1274 1267 One use of version control is to support multiple independent lines
1275 One use of version control is to maintain multiple ``current'' 1268of development, which are called @dfn{branches}. Branches are used
1276revisions of a file. For example, you might have different revisions of a 1269for maintaining separate ``stable'' and ``development'' versions of a
1277program in which you are gradually adding various unfinished new 1270program, and for developing unrelated features in isolation from one
1278features. Each such independent line of development is called a 1271another.
1279@dfn{branch}. VC allows you to create branches, switch between 1272
1280different branches, and merge changes from one branch to another. 1273 VC's support for branch operations is currently fairly limited. For
1281Please note, however, that branches are not supported for SCCS. 1274decentralized version control systems, it provides commands for
1282 1275@dfn{updating} one branch with the contents of another, and for
1283 A file's main line of development is usually called the @dfn{trunk}. 1276@dfn{merging} the changes made to two different branches
1284You can create multiple branches from the trunk. How the difference 1277(@pxref{Merging}). For centralized version control systems, it
1285between trunk and branch is made visible is dependent on whether the 1278supports checking out different branches and committing into new or
1286VCS uses dot-pair or monotonic version IDs. 1279different branches.
1287
1288 In VCSes with dot-pair revision IDs, the revisions on the trunk are
1289normally IDed 1.1, 1.2, 1.3, etc. At any such revision, you can
1290start an independent branch. A branch starting at revision 1.2 would
1291have revision ID 1.2.1.1, and consecutive revisions on this branch
1292would have IDs 1.2.1.2, 1.2.1.3, 1.2.1.4, and so on. If there is
1293a second branch also starting at revision 1.2, it would consist of
1294revisions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc.
1295
1296 In VCSes with monotonic revision IDs, trunk revisions are IDed as
12971, 2, 3, etc. A branch from (say) revision 2 might start with 2.1 and
1298continue through 2.2, 2.3, etc. But naming conventions for branches
1299and subbranches vary widely on these systems, and some (like
1300Mercurial) never depart from the monotonic integer sequence at all.
1301Consult the documentation of the VCS you are using.
1302
1303@cindex head revision
1304 If you omit the final component of a dot-pair revision ID, that is called a
1305@dfn{branch ID}. It refers to the highest existing revision on that
1306branch---the @dfn{head revision} of that branch. The branches in the
1307dot-pair example above have branch IDs 1.2.1 and 1.2.2.
1308 1280
1309@menu 1281@menu
1310* Switching Branches:: How to get to another existing branch. 1282* Switching Branches:: How to get to another existing branch.
1311* Creating Branches:: How to start a new branch. 1283* VC Pull:: Updating the contents of a branch.
1312* Merging:: Transferring changes between branches. 1284* Merging:: Transferring changes between branches.
1313* Multi-User Branching:: Multiple users working at multiple branches 1285* Creating Branches:: How to start a new branch.
1314 in parallel.
1315@end menu 1286@end menu
1316 1287
1317@node Switching Branches 1288@node Switching Branches
1318@subsubsection Switching between Branches 1289@subsubsection Switching between Branches
1319 1290
1320 To switch between branches, type @kbd{C-u C-x v v} and specify the 1291 The various version control systems differ in how branches are
1321revision ID you want to select. On a locking-based system, this 1292implemented, and these differences cannot be entirely concealed by VC.
1322version is then visited @emph{unlocked} (write-protected), so you can 1293
1323examine it before locking it. Switching branches in this way is allowed 1294 On some decentralized version control systems, including Bazaar and
1324only when the file is not locked. 1295Mercurial in its normal mode of operation, each branch has its own
1296working directory tree, so switching between branches just involves
1297switching directories. On Git, switching between branches is done
1298using the @command{git branch} command, which changes the contents of
1299the working tree itself.
1300
1301 On centralized version control systems, you can switch between
1302branches by typing @kbd{C-u C-x v v} in an up-to-date work file
1303(@pxref{Advanced C-x v v}), and entering the revision ID for a
1304revision on another branch. On CVS, for instance, revisions on the
1305@dfn{trunk} (the main line of development) normally have IDs of the
1306form 1.1, 1.2, 1.3, @dots{}, while the first branch created from (say)
1307revision 1.2 has revision IDs 1.2.1.1, 1.2.1.2, @dots{}, the second
1308branch created from revision 1.2 has revision IDs 1.2.2.1, 1.2.2.2,
1309@dots{}, and so forth. You can also specify the @dfn{branch ID},
1310which is a branch revision ID omitting its final component
1311(e.g.@: 1.2.1), to switch to the latest revision on that branch.
1312
1313 On a locking-based system, switching to a different branch also
1314unlocks (write-protects) the working tree.
1315
1316 Once you have switched to a branch, VC commands will apply to that
1317branch until you switch away; for instance, any VC filesets that you
1318commit will be committed to that specific branch.
1319
1320@node VC Pull
1321@subsubsection Pulling Changes into a Branch
1325 1322
1326 On a VCS with dot-pair IDs, you can omit the minor part, thus giving 1323@table @kbd
1327only the branch ID; this takes you to the head version on the 1324@itemx C-x v +
1328chosen branch. If you only type @key{RET}, Emacs goes to the highest 1325On a decentralized version control system, update the current branch
1329version on the trunk. 1326by ``pulling in'' changes from another location.
1330
1331 After you have switched to any branch (including the main branch), you
1332stay on it for subsequent VC commands, until you explicitly select some
1333other branch.
1334
1335@node Creating Branches
1336@subsubsection Creating New Branches
1337 1327
1338 To create a new branch from a head revision (one that is the latest 1328On a centralized version control system, update the current VC
1339in the branch that contains it), first select that revision if 1329fileset.
1340necessary, lock it with @kbd{C-x v v}, and make whatever changes you 1330@end table
1341want. Then, when you commit the changes, use @kbd{C-u C-x v v}. This
1342lets you specify the revision ID for the new revision. You should
1343specify a suitable branch ID for a branch starting at the current
1344revision. For example, if the current revision is 2.5, the branch ID
1345should be 2.5.1, 2.5.2, and so on, depending on the number of existing
1346branches at that point.
1347
1348 To create a new branch at an older revision (one that is no longer the
1349head of a branch), first select that revision (@pxref{Switching
1350Branches}). Your procedure will then differ depending on whether you
1351are using a locking or merging-based VCS.
1352 1331
1353 On a locking VCS, you will need to lock the old revision branch with 1332@kindex C-x v +
1354@kbd{C-x v v}. You'll be asked to confirm, when you lock the old 1333@findex vc-pull
1355revision, that you really mean to create a new branch---if you say no, 1334 On a decentralized version control system, the command @kbd{C-x v +}
1356you'll be offered a chance to lock the latest revision instead. On 1335(@code{vc-pull}) updates the current branch and working tree. It is
1357a merging-based VCS you will skip this step. 1336typically used to update a copy of a remote branch. If you supply a
1337prefix argument, the command prompts for the exact version control
1338command to use, which lets you specify where to pull changes from.
1339Otherwise, it pulls from a default location determined by the version
1340control system.
1358 1341
1359 Then make your changes and type @kbd{C-x v v} again to commit a new 1342 Amongst decentralized version control systems, @kbd{C-x v +}
1360revision. This automatically creates a new branch starting from the 1343currently supports only Bazaar, Git, and Mercurial. On Bazaar, it
1361selected revision. You need not specially request a new branch, 1344calls @command{bzr pull} for ordinary branches (to pull from a master
1362because that's the only way to add a new revision at a point that is 1345branch into a mirroring branch), and @command{bzr update} for a bound
1363not the head of a branch. 1346branch (to pull from a central repository). On Git, it calls
1347@command{git pull} to fetch changes from a remote repository and merge
1348it into the current branch. On Mercurial, it calls @command{hg pull
1349-u} to fetch changesets from the default remote repository and update
1350the working directory.
1364 1351
1365 After the branch is created, you ``stay'' on it. That means that 1352 On a centralized version control system like CVS, @kbd{C-x v +}
1366subsequent commits create new revisions on that branch. To leave the 1353updates the current VC fileset from the repository.
1367branch, you must explicitly select a different revision with @kbd{C-u C-x
1368v v}. To transfer changes from one branch to another, use the merge
1369command, described in the next section.
1370 1354
1371@node Merging 1355@node Merging
1372@subsubsection Merging Branches 1356@subsubsection Merging Branches
1373
1374@cindex merging changes 1357@cindex merging changes
1375 When you have finished the changes on a certain branch, you will
1376often want to incorporate them into the file's main line of development
1377(the trunk). This is not a trivial operation, because development might
1378also have proceeded on the trunk, so that you must @dfn{merge} the
1379changes into a file that has already been changed otherwise. VC allows
1380you to do this (and other things) with the @code{vc-merge} command.
1381 1358
1382@table @kbd 1359@table @kbd
1383@item C-x v m (vc-merge) 1360@itemx C-x v m
1384Merge changes into the work file. 1361On a decentralized version control system, merge changes from another
1362branch into the current one.
1363
1364On a centralized version control system, merge changes from another
1365branch into the current VC fileset.
1385@end table 1366@end table
1386 1367
1387@kindex C-x v m 1368 While developing a branch, you may sometimes need to @dfn{merge} in
1388@findex vc-merge 1369changes that have already been made in another branch. This is not a
1389 @kbd{C-x v m} (@code{vc-merge}) takes a set of changes and merges it 1370trivial operation, as overlapping changes may have been made to the
1390into the current version of the work file. It firsts asks you in the 1371two branches.
1391minibuffer where the changes should come from. If you just type 1372
1392@key{RET}, Emacs merges any changes that were made on the same branch 1373 On a decentralized version control system, merging is done with the
1393since you checked the file out (we call this @dfn{merging the news}). 1374command @kbd{C-x v m} (@code{vc-merge}). On Bazaar, this prompts for
1394This is the common way to pick up recent changes from the repository, 1375the exact arguments to pass to @command{bzr merge}, offering a
1395regardless of whether you have already changed the file yourself. 1376sensible default if possible. On Git, this prompts for the name of a
1396 1377branch to merge from, with completion (based on the branch names known
1397 You can also enter a branch ID or a pair of revision IDs in 1378to the current repository). The output from running the merge command
1398the minibuffer. Then @kbd{C-x v m} finds the changes from that 1379is shown in a separate buffer.
1399branch, or the differences between the two revisions you specified, and 1380
1400merges them into the current revision of the current file. 1381 On a centralized version control system like CVS, @kbd{C-x v m}
1401 1382prompts for a branch ID, or a pair of revision IDs (@pxref{Switching
1402 As an example, suppose that you have finished a certain feature on 1383Branches}); then it finds the changes from that branch, or the changes
1403branch 1.3.1. In the meantime, development on the trunk has proceeded 1384between the two revisions you specified, and merges those changes into
1404to revision 1.5. To merge the changes from the branch to the trunk, 1385the current VC fileset. If you just type @key{RET}, Emacs simply
1405first go to the head revision of the trunk, by typing @kbd{C-u C-x v v 1386merges any changes that were made on the same branch since you checked
1406@key{RET}}. Revision 1.5 is now current. If locking is used for the file, 1387the file out.
1407type @kbd{C-x v v} to lock revision 1.5 so that you can change it. Next,
1408type @kbd{C-x v m 1.3.1 @key{RET}}. This takes the entire set of changes on
1409branch 1.3.1 (relative to revision 1.3, where the branch started, up to
1410the last revision on the branch) and merges it into the current revision
1411of the work file. You can now commit the changed file, thus creating
1412revision 1.6 containing the changes from the branch.
1413
1414 It is possible to do further editing after merging the branch, before
1415the next commit. But it is usually wiser to commit the merged
1416revision, then lock it and make the further changes. This will keep
1417a better record of the history of changes.
1418 1388
1419@cindex conflicts 1389@cindex conflicts
1420@cindex resolving conflicts 1390@cindex resolving conflicts
1421 When you merge changes into a file that has itself been modified, the 1391 Immediately after performing a merge, only the working tree is
1422changes might overlap. We call this situation a @dfn{conflict}, and 1392modified, and you can review the changes produced by the merge with
1423reconciling the conflicting changes is called @dfn{resolving a 1393@kbd{C-x v D} and related commands (@pxref{Old Revisions}). If the
1424conflict}. 1394two branches contained overlapping changes, merging produces a
1425 1395@dfn{conflict}; a warning appears in the output of the merge command,
1426 Whenever conflicts occur during merging, VC detects them, tells you 1396and @dfn{conflict markers} are inserted into each affected work file,
1427about them in the echo area, and asks whether you want help in merging. 1397surrounding the two sets of conflicting changes. You must then
1428If you say yes, it starts an Ediff session (@pxref{Top, 1398resolve the conflict by editing the conflicted files. Once you are
1429Ediff, Ediff, ediff, The Ediff Manual}). 1399done, the modified files must be committed in the usual way for the
1430 1400merge to take effect (@pxref{Basic VC Editing}).
1431 If you say no, the conflicting changes are both inserted into the
1432file, surrounded by @dfn{conflict markers}. The example below shows how
1433a conflict region looks; the file is called @samp{name} and the current
1434master file revision with user B's changes in it is 1.11.
1435
1436@c @w here is so CVS won't think this is a conflict.
1437@smallexample
1438@group
1439@w{<}<<<<<< name
1440 @var{User A's version}
1441=======
1442 @var{User B's version}
1443@w{>}>>>>>> 1.11
1444@end group
1445@end smallexample
1446 1401
1447@findex vc-resolve-conflicts 1402@node Creating Branches
1448 Then you can resolve the conflicts by editing the file manually. Or 1403@subsubsection Creating New Branches
1449you can type @code{M-x vc-resolve-conflicts} after visiting the file. 1404
1450This starts an Ediff session, as described above. Don't forget to 1405 On centralized version control systems like CVS, Emacs supports
1451commit the merged version afterwards. 1406creating new branches as part of a commit operation. When committing
1452 1407a modified VC fileset, type @kbd{C-u C-x v v} (@code{vc-next-action}
1453@findex vc-find-conflicted-file 1408with a prefix argument; @pxref{Advanced C-x v v}). Then Emacs prompts
1454 If there is more than one conflicted file in a merge, type @kbd{M-x 1409for a revision ID for the new revision. You should specify a suitable
1455vc-find-conflicted-file} after resolving the conflicts in each file. 1410branch ID for a branch starting at the current revision. For example,
1456This command visits the next conflicted file, and moves point to the 1411if the current revision is 2.5, the branch ID should be 2.5.1, 2.5.2,
1457first conflict marker in that file. 1412and so on, depending on the number of existing branches at that point.
1458 1413
1459@node Multi-User Branching 1414 To create a new branch at an older revision (one that is no longer
1460@subsubsection Multi-User Branching 1415the head of a branch), first select that revision (@pxref{Switching
1461 1416Branches}). Your procedure will then differ depending on whether you
1462 It is often useful for multiple developers to work simultaneously on 1417are using a locking or merging-based VCS.
1463different branches of a file. CVS and later systems allow this by 1418
1464default; for RCS, it is possible if you create multiple source 1419 On a locking VCS, you will need to lock the old revision branch with
1465directories. Each source directory should have a link named 1420@kbd{C-x v v}. You'll be asked to confirm, when you lock the old
1466@file{RCS} which points to a common directory of RCS master files. 1421revision, that you really mean to create a new branch---if you say no,
1467Then each source directory can have its own choice of selected 1422you'll be offered a chance to lock the latest revision instead. On a
1468revisions, but all share the same common RCS records. 1423merging-based VCS you will skip this step.
1469 1424
1470 This technique works reliably and automatically, provided that the 1425 Then make your changes and type @kbd{C-x v v} again to commit a new
1471source files contain RCS version headers 1426revision. This creates a new branch starting from the selected
1472@iftex 1427revision.
1473(@pxref{Version Headers,,,emacs-xtra, Specialized Emacs Features}). 1428
1474@end iftex 1429 After the branch is created, subsequent commits create new revisions
1475@ifnottex 1430on that branch. To leave the branch, you must explicitly select a
1476(@pxref{Version Headers}). 1431different revision with @kbd{C-u C-x v v}.
1477@end ifnottex
1478The headers enable Emacs to be sure, at all times, which revision
1479ID is present in the work file.
1480
1481 If the files do not have version headers, you must instead tell Emacs
1482explicitly in each session which branch you are working on. To do this,
1483first find the file, then type @kbd{C-u C-x v v} and specify the correct
1484branch ID. This ensures that Emacs knows which branch it is using
1485during this particular editing session.
1486 1432
1487@ifnottex 1433@ifnottex
1488@include vc1-xtra.texi 1434@include vc1-xtra.texi
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 05e89e69f0e..c4a4b351cac 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -495,14 +495,7 @@ a mechanism, except GNU Arch.
495 VC does not normally use the information contained in these headers. 495 VC does not normally use the information contained in these headers.
496The exception is RCS---with RCS, version headers are sometimes more 496The exception is RCS---with RCS, version headers are sometimes more
497reliable than the master file to determine which version of the file 497reliable than the master file to determine which version of the file
498you are editing. Note that in a multi-branch environment, version 498you are editing.
499headers 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
506 499
507 Searching for RCS version headers is controlled by the variable 500 Searching for RCS version headers is controlled by the variable
508@code{vc-consult-headers}. If it is non-@code{nil} (the default), 501@code{vc-consult-headers}. If it is non-@code{nil} (the default),
diff --git a/etc/NEWS b/etc/NEWS
index 65a3b41f5bf..95d47de5bba 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -833,19 +833,21 @@ controlling the degree of parallelism.
833 833
834** VC and related modes 834** VC and related modes
835 835
836+++
836*** Support for pulling on distributed version control systems. 837*** Support for pulling on distributed version control systems.
837The vc-pull command runs a "pull" operation, if it is supported. 838`C-x v +' (`vc-pull') runs a "pull" operation, if it is supported, to
838This updates the current branch from upstream. A prefix argument 839update the current branch and working tree. A prefix argument means
839means to prompt the user for specifics, e.g. a pull location. 840to prompt the user for specifics, e.g. a pull location.
840 841
841**** `vc-update' is now an alias for `vc-pull'. 842**** `vc-update' is now an alias for `vc-pull'.
842 843
843**** Currently supported by Bzr, Git, and Mercurial. 844**** Currently supported by Bzr, Git, and Mercurial.
844 845
846+++
845*** Support for merging on distributed version control systems. 847*** Support for merging on distributed version control systems.
846The vc-merge command now runs a "merge" operation, if it is supported. 848The vc-merge command now runs a "merge" operation, if it is supported,
847This merges another branch into the current one. This command prompts 849to merge changes from another branch into the current one. It prompts
848the user for specifics, e.g. a merge source. 850for specifics, e.g. a merge source.
849 851
850**** Currently supported for Bzr, Git, and Mercurial. 852**** Currently supported for Bzr, Git, and Mercurial.
851 853