aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-10-21 20:50:54 +0000
committerChong Yidong2008-10-21 20:50:54 +0000
commit3e6be0e86e98806cc5118d5b12f07cfc1aeb07e7 (patch)
tree9a8c7e669263dc4452ad12341a103a1279a2475f
parent24216908af1570926bf14016d37c13e65642dc0a (diff)
downloademacs-3e6be0e86e98806cc5118d5b12f07cfc1aeb07e7.tar.gz
emacs-3e6be0e86e98806cc5118d5b12f07cfc1aeb07e7.zip
(Visiting): Document find-file-confirm-nonexistent-file.
(Version Control): Add VC Directory Mode and VC Directory Commands to the submenu. (Why Version Control?): Use table format. (Version Control Systems): Note that Meta-CVS support is gone. (VCS Concepts): Note precisely when VC started supporting filesets. Remove bogus xref to CVS Options node. (Types of Log File): Copyedits. (VC Mode Line): Document tooltips and mouse-1 on VC indicator. (Basic VC Editing): Content moved from Selecting A Fileset and Doing The Right Thing. (Selecting A Fileset, Doing The Right Thing): Nodes deleted. (Log Buffer): Reorganize node, putting C-c C-c description first. (Old Revisions): Use CVS for example, not RCS. (Secondary VC Commands): Remove VC Directory Mode and VC Directory Commands from the submenu, putting them under Version Control. (VC Directory Mode): Move node contents here from vc1-xtra.texi; we need to include it in the manual unconditionally, since it is now crucial to using distributed version control systems.
-rw-r--r--doc/emacs/files.texi913
1 files changed, 523 insertions, 390 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 17132ac2050..45d3d4a6e28 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -241,10 +241,14 @@ moves or copies the file into the displayed directory. For details,
241see @ref{Drag and Drop}, and @ref{Misc Dired Features}. 241see @ref{Drag and Drop}, and @ref{Misc Dired Features}.
242 242
243@cindex creating files 243@cindex creating files
244@vindex find-file-confirm-nonexistent-file
244 What if you want to create a new file? Just visit it. Emacs 245 What if you want to create a new file? Just visit it. Emacs
245displays @samp{(New file)} in the echo area, but in other respects 246displays @samp{(New file)} in the echo area, but in other respects
246behaves as if you had visited an existing empty file. If you make 247behaves as if you had visited an existing empty file. If you make
247changes and save them, the file is created. 248changes and save them, the file is created. If you change the
249variable @code{find-file-confirm-nonexistent-file} to @code{t}, then
250Emacs prompts you for confirmation before visiting a non-existent
251file.
248 252
249@kindex C-x C-v 253@kindex C-x C-v
250@findex find-alternate-file 254@findex find-alternate-file
@@ -1169,8 +1173,8 @@ time of each version, who created it, and a description of what was
1169changed in that version. 1173changed in that version.
1170 1174
1171 The Emacs version control interface is called VC. Its commands work 1175 The Emacs version control interface is called VC. Its commands work
1172with different version control systems; currently, it supports GNU 1176with several different version control systems; currently, it supports
1173Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS, SCCS, and 1177GNU Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS, SCCS/CSSC, and
1174Subversion. Of these, the GNU project distributes CVS, GNU Arch, RCS, 1178Subversion. Of these, the GNU project distributes CVS, GNU Arch, RCS,
1175and Bazaar. 1179and Bazaar.
1176 1180
@@ -1191,6 +1195,7 @@ customizable variable @code{vc-handled-backends} to @code{nil}
1191* Basic VC Editing:: How to edit a file under version control. 1195* Basic VC Editing:: How to edit a file under version control.
1192* Old Revisions:: Examining and comparing old versions. 1196* Old Revisions:: Examining and comparing old versions.
1193* Secondary VC Commands:: The commands used a little less frequently. 1197* Secondary VC Commands:: The commands used a little less frequently.
1198* VC Directory Mode:: Listing files managed by version control.
1194* Branches:: Multiple lines of development. 1199* Branches:: Multiple lines of development.
1195@ifnottex 1200@ifnottex
1196* Remote Repositories:: Efficient access to remote CVS servers. 1201* Remote Repositories:: Efficient access to remote CVS servers.
@@ -1205,10 +1210,10 @@ customizable variable @code{vc-handled-backends} to @code{nil}
1205 1210
1206 VC allows you to use a version control system from within Emacs, 1211 VC allows you to use a version control system from within Emacs,
1207integrating the version control operations smoothly with editing. 1212integrating the version control operations smoothly with editing.
1208Though VC cannot completely bridge the gaps between version-control 1213Though VC cannot completely bridge the gaps between version control
1209systems with widely differing capabilities, it does provide 1214systems with widely differing capabilities, it does provide a uniform
1210a uniform interface to many version control operations. Regardless of 1215interface to many version control operations. Regardless of which
1211which version control system is in use, you will be able to do basic 1216version control system is in use, you will be able to do basic
1212operations in much the same way. 1217operations in much the same way.
1213 1218
1214 This section provides a general overview of version control, and 1219 This section provides a general overview of version control, and
@@ -1226,22 +1231,26 @@ you want to use.
1226@node Why Version Control? 1231@node Why Version Control?
1227@subsubsection Understanding the problems it addresses 1232@subsubsection Understanding the problems it addresses
1228 1233
1229 Version control systems provide you with three important capabilities: 1234 Version control systems provide you with three important
1230@dfn{reversibility}, @dfn{concurrency}, and @dfn{history}. 1235capabilities:
1231 1236
1232 The most basic capability you get from a version-control system is 1237@itemize @bullet
1233reversibility, the ability to back up to a saved, known-good state when 1238@item
1234you discover that some modification you did was a mistake or a bad idea. 1239@dfn{Reversibility}: the ability to back up to a previous state if you
1240discover that some modification you did was a mistake or a bad idea.
1235 1241
1236 Version control systems also support concurrency: the ability to 1242@item
1237have many people modifying the same collection of code or documents 1243@dfn{Concurrency}: the ability to have many people modifying the same
1238knowing that conflicting modifications can be detected and resolved. 1244collection of files knowing that conflicting modifications can be
1245detected and resolved.
1239 1246
1240 Version control systems give you the capability to attach a history 1247@item
1241to your data, such as explanatory comments about the intention behind 1248@dfn{History}: the ability to attach historical data to your data,
1242each change to it. Even for a programmer working solo, change 1249such as explanatory comments about the intention behind each change to
1243histories are an important aid to memory; for a multi-person project, 1250it. Even for a programmer working solo, change histories are an
1244they are a vitally important form of communication among developers. 1251important aid to memory; for a multi-person project, they are a
1252vitally important form of communication among developers.
1253@end itemize
1245 1254
1246@node Version Control Systems 1255@node Version Control Systems
1247@subsubsection Supported Version Control Systems 1256@subsubsection Supported Version Control Systems
@@ -1249,26 +1258,22 @@ they are a vitally important form of communication among developers.
1249@cindex back end (version control) 1258@cindex back end (version control)
1250 VC currently works with many different version control systems or 1259 VC currently works with many different version control systems or
1251@dfn{back ends}: 1260@dfn{back ends}:
1252@comment Omitting bzr because support is very scratchy and incomplete.
1253
1254 1261
1255@itemize @bullet 1262@itemize @bullet
1256 1263
1257@cindex SCCS 1264@cindex SCCS
1258@item 1265@item
1259SCCS was the first version control system ever built, and was long ago 1266SCCS was the first version control system ever built, and was long ago
1260superseded by later and more advanced ones; Emacs supports it only for 1267superseded by more advanced ones. VC compensates for certain features
1261backward compatibility and historical reasons. VC compensates for 1268missing in SCCS (e.g., tag names for releases) by implementing them
1262certain features missing in SCCS (e.g., tag names for releases) by 1269itself. Other VC features, such as multiple branches, are simply
1263implementing them itself. Other VC features, such as multiple 1270unavailable. Since SCCS is non-free, we recommend avoiding it.
1264branches, are simply unavailable. Since SCCS is non-free, we
1265recommend avoiding it.
1266 1271
1267@cindex CSSC 1272@cindex CSSC
1268@item 1273@item
1269CSSC is a free replacement for SCCS. You should use CSSC only if, for 1274CSSC is a free replacement for SCCS. You should use CSSC only if, for
1270some reason, you cannot use a more recent and better-designed 1275some reason, you cannot use a more recent and better-designed version
1271version-control system. 1276control system.
1272 1277
1273@cindex RCS 1278@cindex RCS
1274@item 1279@item
@@ -1280,8 +1285,8 @@ level of individual files rather than projects.
1280@cindex CVS 1285@cindex CVS
1281@item 1286@item
1282CVS is the free version control system that was, until recently (circa 1287CVS is the free version control system that was, until recently (circa
12832008), used for the majority of free software projects. Nowadays, it 12882008), used by the majority of free software projects. Nowadays, it
1284is slowly being superseded by other systems. CVS allows concurrent 1289is slowly being superseded by newer systems. CVS allows concurrent
1285multi-user development either locally or over the network. It lacks 1290multi-user development either locally or over the network. It lacks
1286support for atomic commits or file moving/renaming. VC supports all 1291support for atomic commits or file moving/renaming. VC supports all
1287basic editing operations under CVS. For some less common tasks, you 1292basic editing operations under CVS. For some less common tasks, you
@@ -1337,6 +1342,10 @@ commits and file moving/renaming. VC supports most basic editing
1337operations under Bazaar. 1342operations under Bazaar.
1338@end itemize 1343@end itemize
1339 1344
1345 Previous versions of VC supported a version control system known as
1346Meta-CVS. This support has been dropped because of limited interest
1347from users and developers.
1348
1340@node VCS Concepts 1349@node VCS Concepts
1341@subsubsection Concepts of Version Control 1350@subsubsection Concepts of Version Control
1342 1351
@@ -1366,93 +1375,91 @@ on the version control system; in the simplest case, it is just an
1366integer. 1375integer.
1367 1376
1368 To go beyond these basic concepts, you will need to understand three 1377 To go beyond these basic concepts, you will need to understand three
1369ways in which version-control systems can differ from each other. They 1378ways in which version control systems can differ from each other.
1370can be locking or merging; they can be file-based or changeset-based; 1379They can be locking-based or merging-based; they can be file-based or
1371and they can be centralized or decentralized. VC handles all these 1380changeset-based; and they can be centralized or decentralized. VC
1372choices, but they lead to differing behaviors which you will need 1381handles all these choices, but they lead to differing behaviors which
1373to understand as you use it. 1382you will need to understand as you use it.
1374 1383
1375@cindex locking versus merging 1384@cindex locking versus merging
1376 A version control system typically has some mechanism to coordinate 1385 A version control system typically has some mechanism to coordinate
1377between users who want to change the same file. There are two ways to 1386between users who want to change the same file. There are two ways to
1378do this: locking and merging. 1387do this: merging and locking.
1379
1380 In a version control system that uses locking, work files are
1381normally read-only. To edit a file, you ask the version control
1382system to make it writable for you by @dfn{locking} it; only one user
1383can lock a given file at any given time. This procedure is analogous
1384to, but different from, the locking that Emacs uses to detect
1385simultaneous editing of ordinary files (@pxref{Interlocking}). When
1386you check in your changes, that unlocks the file, and the work file
1387becomes read-only again. Other users may then lock the file for
1388making their own changes.
1389 1388
1390 In a version control system that uses merging, each user may check 1389 In a version control system that uses merging, each user may check
1391out and modify a work file at any time. The system allows you to 1390out and modify a work file at any time. The system lets you
1392@dfn{merge} your work file, which may contain changes that have not 1391@dfn{merge} your work file, which may contain changes that have not
1393been checked in, with the latest changes that others have checked into 1392been checked in, with the latest changes that others have checked into
1394the repository. 1393the repository.
1395 1394
1396 Both locking and merging systems can have problems when multiple users 1395 Older version control systems use a @dfn{locking} scheme instead.
1397try to modify the same file at the same time. Locking systems have 1396Here, work files are normally read-only. To edit a file, you ask the
1398@dfn{lock conflicts}; a user may try to check a file out and be unable 1397version control system to make it writable for you by @dfn{locking}
1399to because it is locked. In merging systems, @dfn{merge conflicts} 1398it; only one user can lock a given file at any given time. This
1400happen when you check in a change to a file that conflicts with a change 1399procedure is analogous to, but different from, the locking that Emacs
1401checked in by someone else after your checkout. Both kinds of conflict 1400uses to detect simultaneous editing of ordinary files
1402have to be resolved by human judgment and communication. 1401(@pxref{Interlocking}). When you check in your changes, that unlocks
1402the file, and the work file becomes read-only again. Other users may
1403then lock the file to make their own changes.
1404
1405 Both locking and merging systems can have problems when multiple
1406users try to modify the same file at the same time. Locking systems
1407have @dfn{lock conflicts}; a user may try to check a file out and be
1408unable to because it is locked. In merging systems, @dfn{merge
1409conflicts} happen when you check in a change to a file that conflicts
1410with a change checked in by someone else after your checkout. Both
1411kinds of conflict have to be resolved by human judgment and
1412communication.
1403 1413
1404 SCCS always uses locking. RCS is lock-based by default but can be 1414 SCCS always uses locking. RCS is lock-based by default but can be
1405told to operate in a merging style. CVS and Subversion are 1415told to operate in a merging style. CVS and Subversion are
1406merge-based by default but can be told to operate in a locking mode. 1416merge-based by default but can be told to operate in a locking mode.
1407Most distributed version-control systems, such as GNU Arch, git, and 1417Distributed version control systems, such as GNU Arch, git, and
1408Mercurial, are based exclusively on merging rather than locking. This 1418Mercurial, are exclusively merging-based. Experience has shown that
1409is because experience has shown that merging is generally superior to 1419merging is superior to locking, both in convenience to developers and
1410locking, both in convenience to developers and in minimizing the 1420in minimizing the number and severity of conflicts that actually
1411number and severity of conflicts that actually occur. Sometimes, 1421occur. Sometimes, however, newer version control systems may have
1412newer version control systems may have locks retrofitted onto them for 1422locks retrofitted onto them for reasons having nothing to do with
1413reasons having nothing to do with technology@footnote{Usually the 1423technology@footnote{Usually the control-freak instincts of managers.}.
1414control-freak instincts of managers.}.
1415 1424
1416 VC mode supports both locking and merging version control and tries 1425 VC mode supports both locking and merging version control and tries
1417to hide the differences between them as much as possible. 1426to hide the differences between them as much as possible.
1418 1427
1419@cindex files versus changesets. 1428@cindex files versus changesets.
1420 On SCCS, RCS, CVS, and other early version-control systems, checkins 1429 On SCCS, RCS, CVS, and other early version control systems, version
1421and other operations are @dfn{file-based}; each file has its own 1430control operations are @dfn{file-based}: each file has its own comment
1422@dfn{master file} with its own comment and revision history separate 1431and revision history separate from that of all other files in the
1423from that of all other files in the system. Later systems, beginning 1432system. Later systems, beginning with Subversion, are
1424with Subversion, are @dfn{changeset-based}: a checkin may include 1433@dfn{changeset-based}: a checkin may include changes to several files,
1425changes to several files, and the entire set of changes is treated as 1434and the entire set of changes is treated as a unit by the system. Any
1426a unit by the system. Any comment associated with the change does not 1435comment associated with the change does not belong to a single file,
1427belong to a single file, but to the changeset itself. 1436but to the changeset itself.
1428 1437
1429 Changeset-based version control is generally more flexible and 1438 Changeset-based version control is more flexible and powerful than
1430powerful than file-based version control; usually, when a change to 1439file-based version control; usually, when a change to multiple files
1431multiple files has to be backed out, it's good to be able to easily 1440has to be reversed, it's good to be able to easily identify and remove
1432identify and remove all of it. But it took some years for designers 1441all of it. But it took some years for designers to figure that out,
1433to figure that out, and while file-based systems are passing out of 1442and while file-based systems are passing out of use, there are lots of
1434use, there are lots of legacy repositories still to be dealt with as 1443legacy repositories still to be dealt with as of this writing (2008).
1435of this writing (2008). 1444
1436 1445 Prior to Emacs 23, VC supported only file-based systems, leading to
1437 Older versions of VC supported only file-based systems, leading to 1446unhappy results when it was used to drive changeset-based
1438some unhappy results when it was used to drive changeset-based 1447systems---the Subversion support, for example, used to break up
1439ones---the Subversion support, for example, used to break up
1440changesets into multiple per-file commits. This has been fixed, but 1448changesets into multiple per-file commits. This has been fixed, but
1441it has left a legacy in VC's terminology. The terms ``checkin'' and 1449it has left a mark in VC's terminology. The terms ``checkin'' and
1442``checkout'' are associated with file-based and locking-based systems 1450``checkout'' are associated with file-based and locking-based systems
1443and a bit archaic; nowadays those operations are usually called 1451and a bit archaic; nowadays those operations are usually called
1444``commit'' and ``update''. 1452``commit'' and ``update''.
1445 1453
1446@cindex centralized vs. decentralized 1454@cindex centralized vs. decentralized version control
1447 Early version-control systems were designed around a @dfn{centralized} 1455 Early version control systems were designed around a
1448model in which each project has only one repository used by all 1456@dfn{centralized} model in which each project has only one repository
1449developers. SCCS, RCS, CVS, and Subversion share this kind of model. 1457used by all developers. SCCS, RCS, CVS, and Subversion share this
1450It has two important problems. One is that a single repository is a 1458kind of model. One problem with this approach is that a single
1451single point of failure---if the repository server is down all work 1459repository is a single point of failure---if the repository server is
1452stops. The other is that you need to be connected live to the server to 1460down, all work stops.
1453do checkins and checkouts; if you're offline, you can't work.
1454 1461
1455 Newer version-control systems like GNU Arch, git, Mercurial, and 1462 Newer version control systems like GNU Arch, git, Mercurial, and
1456Bazaar are @dfn{decentralized}. A project may have several different 1463Bazaar are @dfn{decentralized}. A project may have several different
1457repositories, and these systems support a sort of super-merge between 1464repositories, and these systems support a sort of super-merge between
1458repositories that tries to reconcile their change histories. At the 1465repositories that tries to reconcile their change histories. At the
@@ -1460,18 +1467,10 @@ limit, each developer has his/her own repository, and repository
1460merges replace checkin/commit operations. 1467merges replace checkin/commit operations.
1461 1468
1462 VC's job is to help you manage the traffic between your personal 1469 VC's job is to help you manage the traffic between your personal
1463workfiles and a repository. Whether that repository is a single master 1470workfiles and a repository. Whether that repository is a single
1464or one of a network of peer repositories is not something VC has to care 1471master or one of a network of peer repositories is not something VC
1465about. Thus, the difference between a centralized and a decentralized 1472has to care about. Thus, the difference between a centralized and a
1466version-control system is invisible to VC mode. 1473decentralized version control system is invisible to VC mode.
1467
1468@iftex
1469(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1470@end iftex
1471@ifnottex
1472(@pxref{CVS Options}).
1473@end ifnottex
1474
1475 1474
1476@node Types of Log File 1475@node Types of Log File
1477@subsubsection Types of Log File 1476@subsubsection Types of Log File
@@ -1479,43 +1478,44 @@ version-control system is invisible to VC mode.
1479@cindex log File, types of 1478@cindex log File, types of
1480@cindex version control log 1479@cindex version control log
1481 1480
1482 Projects that use a revision control system can have @emph{two} 1481 Projects that use a version control system can have two types of log
1483types of log for changes. One is the log maintained by the 1482for changes. One is the log maintained by the version control system:
1484revision control system: each time you check in a change, you must 1483each time you check in a change, you fill out a @dfn{log entry} for
1485fill out a @dfn{log entry} for the change (@pxref{Log Buffer}). This 1484the change (@pxref{Log Buffer}). This is called the @dfn{version
1486kind of log is called the @dfn{version control log}, also the 1485control log}.
1487@dfn{revision control log}, @dfn{RCS log}, or @dfn{CVS log}.
1488 1486
1489 The other kind of log is the file @file{ChangeLog} (@pxref{Change 1487 The other kind of log is the file @file{ChangeLog} (@pxref{Change
1490Log}). It provides a chronological record of all changes to a large 1488Log}). It provides a chronological record of all changes to a large
1491portion of a program---typically one directory and its subdirectories. 1489portion of a program---typically one directory and its subdirectories.
1492A small program would use one @file{ChangeLog} file; a large program 1490A small program would use one @file{ChangeLog} file; a large program
1493may well merit a @file{ChangeLog} file in each major directory. 1491may have a @file{ChangeLog} file in each major directory.
1494@xref{Change Log}. 1492@xref{Change Log}.
1495 1493
1496 Actually, the fact that both kinds of log exist is partly a legacy from 1494 Actually, the fact that both kinds of log exist is partly a legacy
1497file-based version control. Changelogs are a GNU convention, later 1495from file-based version control. Changelogs are a GNU convention,
1498more widely adopted, that help developers to get a changeset-based 1496later more widely adopted, that help developers to get a
1499view of a project even when its version-control system has that 1497changeset-based view of a project even when its version control system
1500information split up in multiple file-based logs. 1498has that information split up in multiple file-based logs.
1501 1499
1502 Changeset-based version systems, on the other hand, often maintain 1500 Changeset-based version systems, on the other hand, often maintain a
1503a changeset-based modification log for the entire system that makes 1501changeset-based modification log for the entire system that makes
1504ChangeLogs mostly redundant. The only advantage ChangeLogs retain is that 1502ChangeLogs somewhat redundant. One advantage that ChangeLogs retain
1505it may be useful to be able to view the transaction history of a 1503is that it is sometimes useful to be able to view the transaction
1506single directory separately from those of other directories. 1504history of a single directory separately from those of other
1505directories.
1507 1506
1508 A project maintained with version control can use just the 1507 A project maintained with version control can use just the version
1509version-control log, or it can use both kinds of logs. It can 1508control log, or it can use both kinds of logs. It can handle some
1510handle some files one way and some files the other way. Each project 1509files one way and some files the other way. Each project has its
1511has its policy, which you should follow. 1510policy, which you should follow.
1512 1511
1513 When the policy is to use both, you typically want to write an entry 1512 When the policy is to use both, you typically want to write an entry
1514for each change just once, then put it into both logs. You can write 1513for each change just once, then put it into both logs. You can write
1515the entry in @file{ChangeLog}, then copy it to the log buffer when you 1514the entry in @file{ChangeLog}, then copy it to the log buffer with
1516check in the change. Or you can write the entry in the log buffer 1515@kbd{C-c C-a} when checking in the change (@pxref{Log Buffer}). Or
1517while checking in the change, and later use the @kbd{C-x v a} command 1516you can write the entry in the log buffer while checking in the
1518to copy it to @file{ChangeLog} 1517change, and later use the @kbd{C-x v a} command to copy it to
1518@file{ChangeLog}
1519@iftex 1519@iftex
1520(@pxref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features}). 1520(@pxref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features}).
1521@end iftex 1521@end iftex
@@ -1537,6 +1537,13 @@ locking is not in use). @samp{:} indicates that the file is locked, or
1537that it is modified. If the file is locked by some other user (for 1537that it is modified. If the file is locked by some other user (for
1538instance, @samp{jim}), that is displayed as @samp{RCS:jim:1.3}. 1538instance, @samp{jim}), that is displayed as @samp{RCS:jim:1.3}.
1539 1539
1540 On a graphical display, you can move the mouse over this mode line
1541indicator to pop up a ``tool-tip'', which displays a more verbose
1542description of the version control status. Pressing @key{Mouse-1}
1543over the indicator pops up a menu of VC commands. This menu is
1544identical to the @samp{Version Control} menu item, which can be found
1545in the @samp{Tools} menu on the menu bar.
1546
1540@vindex auto-revert-check-vc-info 1547@vindex auto-revert-check-vc-info
1541 When Auto Revert mode (@pxref{Reverting}) reverts a buffer that is 1548 When Auto Revert mode (@pxref{Reverting}) reverts a buffer that is
1542under version control, it updates the version control information in 1549under version control, it updates the version control information in
@@ -1552,155 +1559,143 @@ system, but is usually not excessive.
1552@node Basic VC Editing 1559@node Basic VC Editing
1553@subsection Basic Editing under Version Control 1560@subsection Basic Editing under Version Control
1554 1561
1555@menu
1556* Selecting A Fileset:: Choosing a set of files to operate on
1557* Doing The Right Thing:: Stepping forward in the development cycle
1558* VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS.
1559* VC With A Merging VCS:: Without locking: default mode for CVS.
1560* Advanced C-x v v:: Advanced features available with a prefix argument.
1561* Log Buffer:: Features available in log entry buffers.
1562@end menu
1563
1564@node Selecting A Fileset
1565@subsubsection Choosing the scope of your command
1566
1567@cindex filesets 1562@cindex filesets
1568 Most VC commands operate on @dfn{filesets}. A fileset is a 1563 Most VC commands operate on @dfn{VC filesets}. A VC fileset is a
1569group of files that you have chosen to treat as a unit at the 1564group of one or more files that are treated as a unit, for the
1570time you perform the command. Filesets are the way that VC 1565purposes of version control.
1571mode bridges the gap between file-based and changeset-based
1572version-control systems.
1573
1574 If you are visiting a version-controlled file in the current buffer,
1575the default fileset for any command is simply that one file. If you
1576are visiting a VC directory buffer, and some files in it are marked,
1577your fileset is the marked files only.
1578
1579 All files in a fileset must be under the same version-control system.
1580If they are not, VC mode will fail when you attempt to execute
1581a command on the fileset.
1582
1583 VC filesets are, essentially, a way to pass multiple file
1584arguments as a group to underlying version-control commands. For
1585example, on Subversion a checkin with more than one file in its
1586fileset will become a joint commit, as though you had typed
1587@command{svn commit} with those file arguments at the shell command
1588line in the directory of the selected buffer.
1589
1590 If you are accustomed to earlier versions of VC, the change in behavior
1591you will notice is in the directory mode. Other than @kbd{C-x v v}, most
1592VC-mode commands once operated on only one file selected by the line
1593the cursor is on. The change in the behavior of @kbd{C-x v v} outside
1594VC Directory Mode is more subtle. Formerly it operated in parallel on all
1595marked files, but did not pass them to the version-control backends as
1596a group. Now it does, which enables VC to drive changeset-based
1597version-control systems.
1598
1599 Emacs uses the concept of named filesets elsewhere
1600(@pxref{Filesets}) to allow you to view and visit files in functional
1601groups. Unlike those, VC filesets are not named and don't persist
1602across sessions.
1603 1566
1604@node Doing The Right Thing 1567 If you are visiting a version-controlled file in the current
1605@subsubsection Performing the next operation in the development cycle 1568buffer, the VC fileset is simply that one file. If you are visiting a
1569VC directory buffer, and some files in it are marked, the VC fileset
1570consists of the marked files (@pxref{VC Directory Mode}).
1606 1571
1607 The principal VC command is an all-purpose command that performs 1572 The principal VC command is an all-purpose command, @kbd{C-x v v}
1608either locking or check-in on your current fileset, depending on 1573(@code{vc-next-action}), that performs either locking, merging or a
1609the situation. 1574check-in on the current VC fileset, depending on the situation. You
1575can call @kbd{C-x v v} from a version-controlled file, or from the VC
1576Directory buffer.
1610 1577
1611@table @kbd 1578@table @kbd
1612@itemx C-x v v 1579@itemx C-x v v
1613Perform the next logical version control operation on this file. 1580Perform the next logical version control operation on the VC fileset.
1614@end table 1581@end table
1615 1582
1616@findex vc-next-action 1583@findex vc-next-action
1617@kindex C-x v v 1584@kindex C-x v v
1618 The precise action of this command depends on the state of the file, 1585 The precise action of @kbd{C-x v v} depends on the state of the VC
1619and whether the version control system uses locking or merging. SCCS and 1586fileset, and whether the version control system uses locking or
1620RCS normally use locking; CVS and Subversion normally use 1587merging. This is described in detail in the subsequent sections.
1621merging but can be configured to do locking. Later systems such as 1588
1622GNU Arch and Mercurial always use merging. 1589 VC filesets are the way that VC mode bridges the gap between
1590file-based and changeset-based version control systems. They are,
1591essentially, a way to pass multiple file arguments as a group to
1592version control commands. For example, on Subversion, a checkin with
1593a multi-file VC fileset becomes a joint commit, as though you had
1594typed @command{svn commit} with those file arguments at the shell
1595command line. All files in a VC fileset must be under the same
1596version control system; if they are not, Emacs signals an error when
1597you attempt to execute a command on the fileset.
1598
1599 If you are accustomed to previous versions of VC, most of the
1600changes to VC in Emacs 23 are found in VC directory mode (@pxref{VC
1601Directory Mode}). When multiple files are marked in the VC directory
1602buffer, they are treated as a VC fileset; typing @kbd{C-x v v} in the
1603VC directory buffer passes them to the version control backends as a
1604single unit. Other commands in VC directory mode now act on the VC
1605fileset, rather than the file on the current line. These changes
1606allow VC to interoperate correctly with changeset-based version
1607control systems.
1608
1609 VC filesets are distinct from the ``named filesets'' used for
1610viewing and visiting files in functional groups (@pxref{Filesets}).
1611Unlike named filesets, VC filesets are not named and don't persist
1612across sessions.
1623 1613
1624@node VC With A Locking VCS 1614@menu
1625@subsubsection Basic Version Control with Locking 1615* VC With A Merging VCS:: Without locking: default mode for CVS.
1616* VC With A Locking VCS:: RCS in its default mode, SCCS, and optionally CVS.
1617* Advanced C-x v v:: Advanced features available with a prefix argument.
1618* Log Buffer:: Features available in log entry buffers.
1619@end menu
1620
1621@node VC With A Merging VCS
1622@subsubsection Basic Version Control with Merging
1626 1623
1627 If locking is used for the file (as with SCCS, and RCS in its default 1624 When your version control system is merging-based (the default for
1628mode), @kbd{C-x v v} can either lock a file or check it in: 1625CVS and all newer version control systems), work files are always
1626writable; you need not do anything special to begin editing a file.
1627The status indicator on the mode line is @samp{-} if the file is
1628unmodified; it flips to @samp{:} as soon as you save any changes
1629(@pxref{VC Mode Line}).
1629 1630
1630@itemize @bullet 1631 Here is what @kbd{C-x v v} does when using a merging-based system:
1631@item
1632If the file is not locked, @kbd{C-x v v} locks it, and
1633makes it writable so that you can change it.
1634 1632
1633@itemize @bullet
1635@item 1634@item
1636If the file is locked by you, and contains changes, @kbd{C-x v v} checks 1635If the work file is the same as in the repository, it does nothing.
1637in the changes. In order to do this, it first reads the log entry
1638for the new revision. @xref{Log Buffer}.
1639 1636
1640@item 1637@item
1641If the file is locked by you, but you have not changed it since you 1638If you have not changed the work file, but some other user has checked
1642locked it, @kbd{C-x v v} releases the lock and makes the file read-only 1639in changes to the repository, @kbd{C-x v v} merges those changes into
1643again. 1640the work file.
1644 1641
1645@item 1642@item
1646If the file is locked by some other user, @kbd{C-x v v} asks you whether 1643If you have made modifications to the work file, @kbd{C-x v v}
1647you want to ``steal the lock'' from that user. If you say yes, the file 1644attempts to check in your changes. To do this, Emacs first reads the
1648becomes locked by you, but a message is sent to the person who had 1645log entry for the new revision (@pxref{Log Buffer}). If some other
1649formerly locked the file, to inform him of what has happened. 1646user has checked in changes to the repository since you last checked
1647it out, the checkin fails. In that case, type @kbd{C-x v v} again to
1648merge those changes into your own work file; this puts the work file
1649into a ``conflicted'' state. Type @kbd{C-x v v} to clear the
1650``conflicted'' state; VC then regards the file as up-to-date and
1651modified, and you can try to check it in again.
1652
1653To pick up any recent changes from the repository @emph{without}
1654trying to commit your own changes, type @kbd{C-x v m @key{RET}}.
1655@xref{Merging}.
1650@end itemize 1656@end itemize
1651 1657
1652 These rules also apply when you use CVS in locking mode, except 1658 These rules also apply when you use RCS in its ``non-locking'' mode,
1653that there is no such thing as stealing a lock. 1659except that changes will not be automatically merged from the
1660repository. Nothing informs you if another user has checked in
1661changes in the same file since you began editing it; when you check in
1662your revision, his changes are removed (however, they remain in the
1663repository and are thus not irrevocably lost). Therefore, you must
1664verify that the current revision is unchanged before checking in your
1665changes. In addition, locking is possible with RCS even in this mode:
1666@kbd{C-x v v} with an unmodified file locks the file, just as it does
1667with RCS in its normal locking mode (@pxref{VC With A Locking VCS}).
1654 1668
1655@node VC With A Merging VCS 1669@node VC With A Locking VCS
1656@subsubsection Basic Version Control with Merging 1670@subsubsection Basic Version Control with Locking
1657 1671
1658 When your version-control system is merging-based rather than 1672 Under a locking-based version control system (such as SCCS, and RCS
1659locking-based---the default for CVS and Subversion, and the way GNU 1673in its default mode), @kbd{C-x v v} does the following:
1660Arch and more modern systems always work---work files are always
1661writable; you do not need to do anything before you begin to edit a
1662file. The status indicator on the mode line is @samp{-} if the file
1663is unmodified; it flips to @samp{:} as soon as you save any changes in
1664the work file.
1665 1674
1666 Here is what @kbd{C-x v v} does when using a merging-based system 1675 @itemize @bullet
1667(such as CVS or Subversion in their default merging mode): 1676@item
1677If the file is not locked, @kbd{C-x v v} locks it, and makes it
1678writable so that you can change it.
1668 1679
1669@itemize @bullet
1670@item 1680@item
1671If some other user has checked in changes into the repository, Emacs 1681If the file is locked by you, and contains changes, @kbd{C-x v v}
1672asks you whether you want to merge those changes into your own work 1682checks in the changes. In order to do this, it first reads the log
1673file. You must do this before you can check in your own changes. (To 1683entry for the new revision. @xref{Log Buffer}.
1674pick up any recent changes from the repository @emph{without} trying
1675to commit your own changes, type @kbd{C-x v m @key{RET}}.)
1676@xref{Merging}.
1677 1684
1678@item 1685@item
1679If there are no new changes in the repository, but you have made 1686If the file is locked by you, but you have not changed it since you
1680modifications in your work file, @kbd{C-x v v} checks in your changes. 1687locked it, @kbd{C-x v v} releases the lock and makes the file
1681In order to do this, it first reads the log entry for the new revision. 1688read-only again.
1682@xref{Log Buffer}.
1683 1689
1684@item 1690@item
1685If the file is not modified, the @kbd{C-x v v} does nothing. 1691If the file is locked by some other user, @kbd{C-x v v} asks you whether
1692you want to ``steal the lock'' from that user. If you say yes, the file
1693becomes locked by you, but a message is sent to the person who had
1694formerly locked the file, to inform him of what has happened.
1686@end itemize 1695@end itemize
1687 1696
1688 These rules also apply when you use RCS in the mode that does not 1697 These rules also apply when you use CVS in locking mode, except
1689require locking, except that automatic merging of changes from the 1698that there is no such thing as stealing a lock.
1690repository is not implemented. Unfortunately, this means that nothing
1691informs you if another user has checked in changes in the same file
1692since you began editing it, and when this happens, his changes will be
1693effectively removed when you check in your revision (though they will
1694remain in the repository, so they will not be entirely lost). You must
1695therefore verify that the current revision is unchanged, before you
1696check in your changes.
1697
1698 In addition, locking is possible with RCS even in this mode, although
1699it is not required; @kbd{C-x v v} with an unmodified file locks the
1700file, just as it does with RCS in its normal (locking) mode.
1701
1702 Later systems like CVS, Subversion and Arch will notice conflicting
1703changes in the repository automatically and notify you when they occur.
1704 1699
1705@node Advanced C-x v v 1700@node Advanced C-x v v
1706@subsubsection Advanced Control in @kbd{C-x v v} 1701@subsubsection Advanced Control in @kbd{C-x v v}
@@ -1743,22 +1738,35 @@ Features}).
1743@node Log Buffer 1738@node Log Buffer
1744@subsubsection Features of the Log Entry Buffer 1739@subsubsection Features of the Log Entry Buffer
1745 1740
1746 When you check in changes, @kbd{C-x v v} first reads a log entry. It 1741 When you check in changes, Emacs pops up a buffer called
1747pops up a buffer called @samp{*VC-Log*} for you to enter the log entry. 1742@samp{*VC-Log*} for you to enter a log entry.
1743
1744 After you have finished editing the log message, type @kbd{C-c C-c}
1745to exit the buffer and commit the change.
1748 1746
1749 Sometimes the @samp{*VC-Log*} buffer contains default text when you enter it, 1747@findex log-edit-show-files
1750typically the last log message entered. If it does, mark and point 1748@findex log-edit-show-diff
1751are set around the entire contents of the buffer so that it is easy to 1749 In the @samp{*VC-Log*} buffer, typing @kbd{C-c C-f}
1752kill the contents of the buffer with @kbd{C-w}. 1750(@code{log-edit-show-files}) displays a list of files in the VC
1751fileset you are committing. If you called @kbd{C-x v v} directly from
1752a work file, the VC fileset consists of that single file, so this
1753command is not very useful. If you called @kbd{C-x v v} from a VC
1754directory buffer, the VC fileset may consist of multiple files
1755(@pxref{VC Directory Mode}).
1753 1756
1754@findex log-edit-insert-changelog 1757@findex log-edit-insert-changelog
1755 If you work by first writing entries in the @file{ChangeLog} 1758 Type @kbd{C-c C-d} (@code{log-edit-show-diff}) to show a ``diff'' of
1756(@pxref{Change Log}) and afterwards committing the change under revision 1759the changes you have made (i.e., the differences between the work file
1757control, you can generate the Log Edit text from the ChangeLog using 1760and the repository revision from which you started editing the file).
1758@kbd{C-c C-a} (@kbd{log-edit-insert-changelog}). This looks for 1761The diff is displayed in a special buffer in another window.
1759entries for the file(s) concerned in the top entry in the ChangeLog 1762@xref{Comparing Files}.
1760and uses those paragraphs as the log text. This text is only inserted 1763
1761if the top entry was made under your user name on the current date. 1764 If you have written an entry in the @file{ChangeLog} (@pxref{Change
1765Log}), type @kbd{C-c C-a} (@code{log-edit-insert-changelog}) to pull
1766it into the @samp{*VC-Log*} buffer. If the topmost item in the
1767@file{ChangeLog} was made under your user name on the current date,
1768this command searches that item for entries that match the file(s) to
1769be committed; if found, these entries are inserted.
1762@iftex 1770@iftex
1763@xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features}, 1771@xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features},
1764@end iftex 1772@end iftex
@@ -1768,52 +1776,32 @@ if the top entry was made under your user name on the current date.
1768for the opposite way of working---generating ChangeLog entries from 1776for the opposite way of working---generating ChangeLog entries from
1769the revision control log. 1777the revision control log.
1770 1778
1771@findex log-edit-show-files 1779 To abort a check-in, just @strong{don't} type @kbd{C-c C-c} in that
1772@findex log-edit-show-diff
1773 In the @samp{*VC-Log*} buffer, @kbd{C-c C-f}
1774(@code{log-edit-show-files}) shows the list of files to be committed
1775in case you need to check that. (This can be a list of more than one
1776file if you use VC Directory Mode or PCL-CVS.) @kbd{C-c C-d}
1777(@code{log-edit-show-diff}) shows the diffs for the files to be
1778committed.
1779@iftex
1780@xref{VC Directory Mode,,,emacs-xtra, Specialized Emacs Features},
1781@end iftex
1782@ifnottex
1783@xref{VC Directory Mode},
1784@end ifnottex
1785and @ref{Top, , About PCL-CVS, pcl-cvs, PCL-CVS --- The Emacs
1786Front-End to CVS}.)
1787
1788 When you have finished editing the log message, type @kbd{C-c C-c} to
1789exit the buffer and commit the change.
1790
1791 To abort check-in, just @strong{don't} type @kbd{C-c C-c} in that
1792buffer. You can switch buffers and do other editing. As long as you 1780buffer. You can switch buffers and do other editing. As long as you
1793don't try to check in another file, the entry you were editing remains 1781don't try to check in another file, the entry you were editing remains
1794in the @samp{*VC-Log*} buffer, and you can go back to that buffer at any 1782in the @samp{*VC-Log*} buffer, and you can go back to that buffer at
1795time to complete the check-in. 1783any time to complete the check-in.
1796 1784
1797 If you change several source files for the same reason, it is often 1785 If you change several source files for the same reason, it is often
1798convenient to specify the same log entry for many of the files. (This 1786convenient to specify the same log entry for many of the files. (This
1799is the normal way to do things on a changeset-oriented system, where 1787is the normal way to do things on a changeset-oriented system, where
1800comments are attached to changesets rather than the history of 1788comments are attached to changesets rather than the history of
1801individual files.) The most convenient way to do this is to mark all the 1789individual files.) The most convenient way to do this is to mark all
1802files in VC Directory Mode and check in from there; the log buffer will 1790the files in VC Directory Mode and check in from there; the log buffer
1803carry the fileset information with it and do a group commit when you 1791will carry the fileset information with it and do a group commit when
1804confirm it with @kbd{C-c C-c}. 1792you type @kbd{C-c C-c}.
1805 1793
1806 However, you can also browse the history of previous log entries to 1794 You can also browse the history of previous log entries to duplicate
1807duplicate a checkin comment. This can be useful when you want several 1795a checkin comment. This can be useful when you want several files to
1808files to have checkin comments that vary only slightly from each 1796have checkin comments that vary only slightly from each other. The
1809other. The commands @kbd{M-n}, @kbd{M-p}, @kbd{M-s} and @kbd{M-r} for 1797commands @kbd{M-n}, @kbd{M-p}, @kbd{M-s} and @kbd{M-r} for doing this
1810doing this work just like the minibuffer history commands (except that 1798work just like the minibuffer history commands (except that these
1811these versions are used outside the minibuffer). 1799versions are used outside the minibuffer).
1812 1800
1813@vindex vc-log-mode-hook 1801@vindex vc-log-mode-hook
1814 Each time you check in a change, the log entry buffer is put into VC Log 1802 Each time you check in a change, the log entry buffer is put into VC
1815mode, which involves running two hooks: @code{text-mode-hook} and 1803Log Edit mode, which involves running two hooks: @code{text-mode-hook}
1816@code{vc-log-mode-hook}. @xref{Hooks}. 1804and @code{vc-log-mode-hook}. @xref{Hooks}.
1817 1805
1818@node Old Revisions 1806@node Old Revisions
1819@subsection Examining And Comparing Old Revisions 1807@subsection Examining And Comparing Old Revisions
@@ -1834,54 +1822,59 @@ fileset with the working revision(s) from which you started editing.
1834Compare the specified two repository revisions of the current fileset. 1822Compare the specified two repository revisions of the current fileset.
1835 1823
1836@item C-x v g 1824@item C-x v g
1837Display the file with per-line revision information and using colors. 1825Display an annotated version of the file: for each line, show the
1826latest revision in which it was modified.
1838@end table 1827@end table
1839 1828
1840@findex vc-revision-other-window 1829@findex vc-revision-other-window
1841@kindex C-x v ~ 1830@kindex C-x v ~
1842 To examine an old revision in its entirety, visit the file and then type 1831 To examine an old revision, visit the work file and type @kbd{C-x v
1843@kbd{C-x v ~ @var{revision} @key{RET}} (@code{vc-revision-other-window}). 1832~ @var{revision} @key{RET}} (@code{vc-revision-other-window}). Here,
1844This puts the text of revision @var{revision} in a file named 1833@var{revision} is either the desired revision ID (@pxref{VCS
1845@file{@var{filename}.~@var{revision}~}, and visits it in its own buffer 1834Concepts}), or the name of a tag or branch
1846in a separate window. (In RCS, you can also select an old revision 1835@iftex
1847and create a branch from it. @xref{Branches}.) 1836(@pxref{Tags,,,emacs-xtra, Specialized Emacs Features}).
1837@end iftex
1838@ifnottex
1839(@pxref{Tags}).
1840@end ifnottex
1841This command puts the text of the old revision in a file named
1842@file{@var{filename}.~@var{revision}~}, and visits it in its own
1843buffer in a separate window.
1848 1844
1849@findex vc-diff 1845@findex vc-diff
1850@kindex C-x v = 1846@kindex C-x v =
1851@kbd{C-x v =} compares the current buffer contents of each file in the 1847 @kbd{C-x v =} (@code{vc-diff}) compares the current buffer contents
1852current fileset (saving them in the file if necessary) with the 1848of each file in the current VC fileset (saving them if necessary) with
1853repository revision from which you started editing each file (this is not 1849the repository revision from which you started editing. Note that the
1854necessarily the latest revision of the file). The diff will be displayed 1850latter may or may not be the latest revision of the file(s). The diff
1855in a special buffer in another window. 1851is displayed in a special buffer in another window. @xref{Comparing
1852Files}.
1856 1853
1857@findex vc-diff 1854@findex vc-diff
1858@kindex C-u C-x v = 1855@kindex C-u C-x v =
1859 You can compare two repository revisions of the current fileset with 1856 To compare two arbitrary revisions of the current VC fileset, call
1860the command @kbd{C-u C-x v =} (@code{vc-diff}). @kbd{C-u C-x v =} reads 1857@code{vc-diff} with a prefix argument: @kbd{C-u C-x v =}. This
1861two revision ID or tags. The diff will be displayed in a special 1858prompts for two revision IDs, using the minibuffer, and displays the
1862buffer in another window. 1859diff in a special buffer in another window. Instead of providing a
1863 1860revision ID, you can give an empty input, which specifies the current
1864 You can specify a checked-in revision by its ID; an empty input 1861contents of the work file; or a tag or branch name
1865specifies the current contents of the work file (which may be different
1866from all the checked-in revisions). You can also specify a tag or branch name
1867@iftex 1862@iftex
1868(@pxref{Tags,,,emacs-xtra, Specialized Emacs Features}) 1863(@pxref{Tags,,,emacs-xtra, Specialized Emacs Features}).
1869@end iftex 1864@end iftex
1870@ifnottex 1865@ifnottex
1871(@pxref{Tags}) 1866(@pxref{Tags}).
1872@end ifnottex 1867@end ifnottex
1873instead of one or both revision ID. 1868If your version control system is file-based (e.g. CVS) rather than
1874 1869changeset-based (Subversion, GNU Arch, git, Mercurial), supplying a
1875 Note that if your version-control system is file-oriented (SCCS, 1870revision ID for a multi-file fileset (as opposed to a symbolic tag
1876RCS, CVS) rather than fileset-oriented (Subversion, GNU Arch, git, 1871name) is unlikely to return diffs that are connected in any meaningful
1877Mercurial) specifying a revision of a multiple-file fileset by 1872way.
1878revision ID (as opposed to a symbolic tag name) is
1879unlikely to return diffs that are connected in any meaningful way.
1880 1873
1881 If you invoke @kbd{C-u C-x v =} or @kbd{C-u C-x v =} from a buffer 1874 If you invoke @kbd{C-x v =} or @kbd{C-u C-x v =} from a buffer that
1882that is neither visiting a version-controlled file nor a VC directory 1875is neither visiting a version-controlled file nor a VC directory
1883buffer, these commands will generate a diff of all registered files in 1876buffer, these commands generate a diff of all registered files in the
1884the current directory and its subdirectories. 1877current directory and its subdirectories.
1885 1878
1886@vindex vc-diff-switches 1879@vindex vc-diff-switches
1887@vindex vc-rcs-diff-switches 1880@vindex vc-rcs-diff-switches
@@ -1891,8 +1884,8 @@ invoke @code{diff} this way, in addition to the options specified by
1891@code{diff-switches} (@pxref{Comparing Files}), it receives those 1884@code{diff-switches} (@pxref{Comparing Files}), it receives those
1892specified by @code{vc-diff-switches}, plus those specified for the 1885specified by @code{vc-diff-switches}, plus those specified for the
1893specific back end by @code{vc-@var{backend}-diff-switches}. For 1886specific back end by @code{vc-@var{backend}-diff-switches}. For
1894instance, when the version control back end is RCS, @code{diff} uses 1887instance, when the version control back end is CVS, @code{diff} uses
1895the options in @code{vc-rcs-diff-switches}. The 1888the options in @code{vc-cvs-diff-switches}. The
1896@samp{vc@dots{}diff-switches} variables are @code{nil} by default. 1889@samp{vc@dots{}diff-switches} variables are @code{nil} by default.
1897 1890
1898 The buffer produced by @kbd{C-x v =} supports the commands of 1891 The buffer produced by @kbd{C-x v =} supports the commands of
@@ -1904,13 +1897,13 @@ revisions are not, in general, present as files on your disk.)
1904@findex vc-annotate 1897@findex vc-annotate
1905@kindex C-x v g 1898@kindex C-x v g
1906 For some back ends, you can display the file @dfn{annotated} with 1899 For some back ends, you can display the file @dfn{annotated} with
1907per-line revision information and using colors to enhance the visual 1900per-line revision information, by typing @kbd{C-x v g}
1908appearance, with the command @kbd{M-x vc-annotate}. This creates a new 1901(@code{vc-annotate}). This creates a new buffer (the ``annotate
1909buffer (the ``annotate buffer'') displaying the file's text, with each 1902buffer'') displaying the file's text, with each part colored to show
1910part colored to show how old it is. Text colored red is new, blue means 1903how old it is. Text colored red is new, blue means old, and
1911old, and intermediate colors indicate intermediate ages. By default, 1904intermediate colors indicate intermediate ages. By default, the color
1912the color is scaled over the full range of ages, such that the oldest 1905is scaled over the full range of ages, such that the oldest changes
1913changes are blue, and the newest changes are red. 1906are blue, and the newest changes are red.
1914 1907
1915 When you give a prefix argument to this command, Emacs reads two 1908 When you give a prefix argument to this command, Emacs reads two
1916arguments using the minibuffer: the ID of which revision to display and 1909arguments using the minibuffer: the ID of which revision to display and
@@ -1972,17 +1965,12 @@ the file contents without distraction from the annotations.
1972@node Secondary VC Commands 1965@node Secondary VC Commands
1973@subsection The Secondary Commands of VC 1966@subsection The Secondary Commands of VC
1974 1967
1975 This section explains the secondary commands of VC, those that you might 1968 This section explains the secondary commands of VC.
1976use once a day.
1977 1969
1978@menu 1970@menu
1979* Registering:: Putting a file under version control. 1971* Registering:: Putting a file under version control.
1980* VC Status:: Viewing the VC status of files. 1972* VC Status:: Viewing the VC status of files.
1981* VC Undo:: Canceling changes before or after check-in. 1973* VC Undo:: Canceling changes before or after check-in.
1982@ifnottex
1983* VC Directory Mode:: Listing files managed by version control.
1984* VC Directory Commands:: Commands to use in a VC directory buffer.
1985@end ifnottex
1986@end menu 1974@end menu
1987 1975
1988@node Registering 1976@node Registering
@@ -2048,14 +2036,16 @@ Display revision control state and change history.
2048@kindex C-x v l 2036@kindex C-x v l
2049@findex vc-print-log 2037@findex vc-print-log
2050 To view the detailed revision control status and history of a file, 2038 To view the detailed revision control status and history of a file,
2051type @kbd{C-x v l} (@code{vc-print-log}). It displays the history of 2039type @kbd{C-x v l} (@code{vc-print-log}). This pops up a special
2052changes to the current file, including the text of the log entries. The 2040buffer named @samp{*vc-change-log*}, in a new window, that displays
2053output appears in a separate window. The point is centered at the 2041the history of changes to the current file, including the text of the
2054revision of the file that is currently being visited. 2042log entries. The point is centered at the revision of the file that
2043is currently being visited.
2055 2044
2056 In the change log buffer, you can use the following keys to move 2045 In the @samp{*vc-change-log*} buffer, you can use the following keys
2057between the logs of revisions and of files, to view past revisions, to 2046to move between the logs of revisions and of files, to view past
2058modify change comments, to view annotations and to view diffs: 2047revisions, to modify change comments, to view annotations and to view
2048diffs:
2059 2049
2060@table @kbd 2050@table @kbd
2061@item p 2051@item p
@@ -2071,27 +2061,14 @@ count.
2071 2061
2072@item P 2062@item P
2073Move to the log of the previous file, when the logs of multiple files 2063Move to the log of the previous file, when the logs of multiple files
2074are in the log buffer 2064are in the log buffer (@pxref{VC Directory Mode}). Otherwise, just
2075@iftex 2065move to the beginning of the log. A numeric prefix argument is a
2076(@pxref{VC Directory Mode,,,emacs-xtra, Specialized Emacs Features}). 2066repeat count, so @kbd{C-u 10 P} would move backward 10 files.
2077@end iftex
2078@ifnottex
2079(@pxref{VC Directory Mode}).
2080@end ifnottex
2081Otherwise, just move to the beginning of the log. A numeric prefix
2082argument is a repeat count, so @kbd{C-u 10 P} would move backward 10
2083files.
2084 2067
2085@item N 2068@item N
2086Move to the log of the next file, when the logs of multiple files are 2069Move to the log of the next file, when the logs of multiple files are
2087in the log buffer 2070in the log buffer (@pxref{VC Directory Mode}). It also takes a
2088@iftex 2071numeric prefix argument as a repeat count.
2089(@pxref{VC Directory Mode,,,emacs-xtra, Specialized Emacs Features}).
2090@end iftex
2091@ifnottex
2092(@pxref{VC Directory Mode}).
2093@end ifnottex
2094It also takes a numeric prefix argument as a repeat count.
2095 2072
2096@item a 2073@item a
2097Annotate the revision indicated by the current line. 2074Annotate the revision indicated by the current line.
@@ -2133,12 +2110,12 @@ This undoes your last check-in.
2133@kindex C-x v u 2110@kindex C-x v u
2134@findex vc-revert-buffer 2111@findex vc-revert-buffer
2135 If you want to discard your current set of changes and revert to the 2112 If you want to discard your current set of changes and revert to the
2136working revision from which you started editing the file, use @kbd{C-x v u} 2113working revision from which you started editing the file, use @kbd{C-x
2137(@code{vc-revert-buffer}). This leaves the file unlocked; if locking 2114v u} (@code{vc-revert-buffer}). If the version control system is
2138is in use, you must first lock the file again before you change it 2115locking-based, this leaves the file unlocked, and you must lock it
2139again. @kbd{C-x v u} requires confirmation, unless it sees that you 2116again before making new changes. @kbd{C-x v u} requires confirmation,
2140haven't made any changes with respect to the master copy of the 2117unless it sees that you haven't made any changes with respect to the
2141working revision. 2118master copy of the working revision.
2142 2119
2143 @kbd{C-x v u} is also the command to unlock a file if you lock it and 2120 @kbd{C-x v u} is also the command to unlock a file if you lock it and
2144then decide not to change it. 2121then decide not to change it.
@@ -2148,17 +2125,173 @@ then decide not to change it.
2148 To cancel a change that you already checked in, use @kbd{C-x v c} 2125 To cancel a change that you already checked in, use @kbd{C-x v c}
2149(@code{vc-rollback}). This command discards all record of the most 2126(@code{vc-rollback}). This command discards all record of the most
2150recent checked-in revision, but only if your work file corresponds to 2127recent checked-in revision, but only if your work file corresponds to
2151that revision---you cannot use @kbd{C-x v c} to cancel a revision that is 2128that revision---you cannot use @kbd{C-x v c} to cancel a revision that
2152not the latest on its branch. Note that many version-control systems do 2129is not the latest on its branch. Note that many version control
2153not support rollback at all; this command is something of a historical 2130systems do not support rollback at all; this command is something of a
2154relic. 2131historical relic.
2132
2133@node VC Directory Mode
2134@subsection VC Directory Mode
2135
2136@kindex C-x v d
2137@findex vc-dir
2138 When you are working on a large program, it is often useful to find
2139out which files have changed within an entire directory tree, or to
2140view the status of all files under version control at once, and to
2141perform version control operations on collections of files. You can
2142use the command @kbd{C-x v d} (@code{vc-dir}) to make a directory
2143listing that includes only files relevant for version control. This
2144creates a @dfn{VC Directory buffer} and displays it in a separate
2145window.
2146
2147@cindex PCL-CVS
2148@pindex cvs
2149@cindex CVS directory mode
2150 The VC Directory buffer described here works with all the version
2151control systems that VC supports. Another more powerful facility,
2152designed specifically for CVS, is called PCL-CVS. @xref{Top, , About
2153PCL-CVS, pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
2154
2155 The VC Directory buffer contains a list of version-controlled files
2156in the current directory and its subdirectories. Files which are
2157up-to-date (have no local differences from the repository copy) are
2158omitted; if all files in a directory are up-to-date, the directory is
2159omitted as well. (However, the directory in which @code{vc-dir} was
2160run will always be shown as @file{./}.) There is an exception to this
2161rule: if VC mode detects that a file has changed to an up-to-date
2162state since you last looked at it, that file and its state are shown.
2163
2164 If a directory uses more that one version control system, you can
2165select which system to use for the @code{vc-dir} command by invoking
2166@code{vc-dir} with a prefix argument: @kbd{C-u C-x v d}.
2167
2168 The line for an individual file shows the version control state of
2169the file. Under RCS and SCCS, the name of the user locking the file
2170is shown; under CVS, an abbreviated version of the @samp{cvs status}
2171output is used. Here is an example using CVS:
2155 2172
2156@ifnottex 2173@smallexample
2157@c vc1-xtra.texi needs extra level of lowering. 2174@group
2158@lowersections 2175 ./
2159@include vc1-xtra.texi 2176 modified file1.c
2160@raisesections 2177 needs-update file2.c
2161@end ifnottex 2178 needs-merge file3.c
2179@end group
2180@end smallexample
2181
2182@noindent
2183In this example, @samp{file1.c} is modified with respect to the
2184repository, and @samp{file2.c} is not. @samp{file3.c} is modified,
2185but other changes have also been checked in to the repository---you
2186need to merge them with the work file before you can check it in.
2187
2188@vindex vc-stay-local
2189@vindex vc-cvs-stay-local
2190 In the above, if the repository were on a remote machine, VC only
2191contacts it when the variable @code{vc-stay-local} (or
2192@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
2193because access to the repository may be slow, or you may be working
2194offline and not have access to the repository at all. As a
2195consequence, VC would not be able to tell you that @samp{file3.c} is
2196in the ``merge'' state; you would learn that only when you try to
2197check-in your modified copy of the file, or use a command such as
2198@kbd{C-x v m}.
2199
2200 In practice, this is not a problem because CVS handles this case
2201consistently whenever it arises. In VC, you'll simply get prompted to
2202merge the remote changes into your work file first. The benefits of
2203less network communication usually outweigh the disadvantage of not
2204seeing remote changes immediately.
2205
2206@vindex vc-directory-exclusion-list
2207 When a VC directory displays subdirectories it omits some that
2208should never contain any files under version control. By default,
2209this includes Version Control subdirectories such as @samp{RCS} and
2210@samp{CVS}; you can customize this by setting the variable
2211@code{vc-directory-exclusion-list}.
2212
2213@menu
2214* VC Directory Commands:: Commands to use in a VC directory buffer.
2215@end menu
2216
2217@node VC Directory Commands
2218@subsubsection VC Directory Commands
2219
2220 VC Directory mode has a full set of navigation and marking commands
2221for picking out filesets. Some of these are also available in a
2222context menu invoked by the @kbd{mouse-2} button.
2223
2224 Up- and down-arrow keys move in the buffer; @kbd{n} and @kbd{p} also
2225move vertically as in other list-browsing modes. @key{SPC} and
2226@key{TAB} behave like down-arrow, and @key{BackTab} behaves like
2227up-arrow.
2228
2229 Both @kbd{C-m} and @kbd{f} visit the file on the current
2230line. @kbd{o} visits that file in another window. @kbd{q} dismisses
2231the directory buffer.
2232
2233 @kbd{x} toggles hiding of up-to-date files.
2234
2235 @kbd{m} marks the file or directory on the current line. If the
2236region is active, @kbd{m} marks all the files in the region. There
2237are some restrictions when marking: a file cannot be marked if any of
2238its parent directories are marked, and a directory cannot be marked if
2239any files in it or in its child directories are marked.
2240
2241 @kbd{M} marks all the files with the same VC state as the current
2242file if the cursor is on a file. If the cursor is on a directory, it
2243marks all child files. With a prefix argument: marks all files and
2244directories.
2245
2246 @kbd{u} unmarks the file or directory on the current line. If the
2247region is active, it unmarks all the files in the region.
2248
2249 @kbd{U} marks all the files with the same VC state as the current file
2250if the cursor is on a file. If the cursor is on a directory, it
2251unmarks all child files. With a prefix argument: unmarks all marked
2252files and directories.
2253
2254 It is possible to do search, search and replace, incremental search,
2255and incremental regexp search on multiple files. These commands will
2256work on all the marked files or the current file if nothing is marked.
2257If a directory is marked, the files in that directory shown in the VC
2258directory buffer will be used.
2259
2260 @kbd{S} searches the marked files.
2261
2262 @kbd{Q} does a query replace on the marked files.
2263
2264 @kbd{M-s a C-s} does an incremental search on the marked files.
2265
2266 @kbd{M-s a C-M-s} does an incremental search on the marked files.
2267
2268 Commands are also accessible from the VC-dir menu. Note that some VC
2269backends use the VC-dir menu to make available extra backend specific
2270commands.
2271
2272 Normal VC commands with the @kbd{C-x v} prefix work in VC directory
2273buffers. Some single-key shortcuts are available as well; @kbd{=},
2274@kbd{+}, @kbd{l}, @kbd{i}, and @kbd{v} behave as through prefixed with
2275@kbd{C-x v}.
2276
2277 The command @kbd{C-x v v} (@code{vc-next-action}) operates on all the
2278marked files, so that you can check in several files at once.
2279If the underlying VC supports atomic commits of multiple-file
2280changesets, @kbd{C-x v v} with a selected set of modified but not
2281committed files will commit all of them at once as a single changeset.
2282
2283 When @kbd{C-x v v} (@code{vc-next-action}) operates on a set of files,
2284it requires that all of those files must be either in the same state or
2285in compatible states; otherwise it will throw an error (added,
2286modified and removed states are considered compatible). Note that this
2287differs from the behavior of older versions of VC, which did not have
2288fileset operations and simply did @code{vc-next-action} on each file
2289individually.
2290
2291 If any files are in a state that calls for commit, @kbd{C-x v v} reads a
2292single log entry and uses it for the changeset as a whole. If the
2293underling VCS is file- rather than changeset-oriented, the log entry
2294will be replicated into the history of each file.
2162 2295
2163@node Branches 2296@node Branches
2164@subsection Multiple Branches of a File 2297@subsection Multiple Branches of a File
@@ -2372,7 +2505,7 @@ branch ID. This ensures that Emacs knows which branch it is using
2372during this particular editing session. 2505during this particular editing session.
2373 2506
2374@ifnottex 2507@ifnottex
2375@include vc2-xtra.texi 2508@include vc1-xtra.texi
2376@end ifnottex 2509@end ifnottex
2377 2510
2378@node Directories 2511@node Directories
@@ -3083,8 +3216,8 @@ menu, where each existing fileset is represented by a submenu.
3083 3216
3084 Emacs uses the concept of a fileset elsewhere @pxref{Version 3217 Emacs uses the concept of a fileset elsewhere @pxref{Version
3085Control} to describe sets of files to be treated as a group for 3218Control} to describe sets of files to be treated as a group for
3086purposes of version-control operations. Those filesets are 3219purposes of version control operations. Those filesets are unnamed
3087unnamed and do not persist across Emacs sessions. 3220and do not persist across Emacs sessions.
3088 3221
3089@ignore 3222@ignore
3090 arch-tag: 768d32cb-e15a-4cc1-b7bf-62c00ee12250 3223 arch-tag: 768d32cb-e15a-4cc1-b7bf-62c00ee12250