PageRenderTime 121ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/cvs/doc/cvs.texinfo

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 14187 lines | 11978 code | 2209 blank | 0 comment | 0 complexity | 5b2b61113ddb78ea6f25ebc2d0559833 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause, LGPL-2.0, LGPL-2.1, BSD-2-Clause, 0BSD, JSON, AGPL-1.0, GPL-2.0
  1. \input texinfo @c -*-texinfo-*-
  2. @comment Documentation for CVS.
  3. @setfilename cvs.info
  4. @macro copyleftnotice
  5. @noindent
  6. Copyright @copyright{} 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
  7. 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
  8. Free Software Foundation, Inc.
  9. @multitable @columnfractions .12 .88
  10. @item Portions
  11. @item @tab Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  12. 2006, 2007 Derek R. Price,
  13. @item @tab Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007
  14. Ximbiot @url{http://ximbiot.com},
  15. @item @tab Copyright @copyright{} 1992, 1993, 1999 Signum Support AB,
  16. @item @tab and Copyright @copyright{} others.
  17. @end multitable
  18. @ignore
  19. Permission is granted to process this file through Tex and print the
  20. results, provided the printed document carries copying permission
  21. notice identical to this one except for the removal of this paragraph
  22. (this paragraph not being relevant to the printed manual).
  23. @end ignore
  24. Permission is granted to make and distribute verbatim copies of
  25. this manual provided the copyright notice and this permission notice
  26. are preserved on all copies.
  27. Permission is granted to copy and distribute modified versions of this
  28. manual under the conditions for verbatim copying, provided also that the
  29. entire resulting derived work is distributed under the terms of a
  30. permission notice identical to this one.
  31. Permission is granted to copy and distribute translations of this manual
  32. into another language, under the above conditions for modified versions,
  33. except that this permission notice may be stated in a translation
  34. approved by the Free Software Foundation.
  35. @end macro
  36. @comment This file is part of the CVS distribution.
  37. @comment CVS is free software; you can redistribute it and/or modify
  38. @comment it under the terms of the GNU General Public License as published by
  39. @comment the Free Software Foundation; either version 2, or (at your option)
  40. @comment any later version.
  41. @comment CVS is distributed in the hope that it will be useful,
  42. @comment but WITHOUT ANY WARRANTY; without even the implied warranty of
  43. @comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  44. @comment GNU General Public License for more details.
  45. @c See ../README for A4 vs. US letter size.
  46. @c When we provided A4 postscript, and people tried to
  47. @c print it on US letter, the usual complaint was that the
  48. @c page numbers would get cut off.
  49. @c If one prints US letter on A4, reportedly there is
  50. @c some extra space at the top and/or bottom, and the side
  51. @c margins are a bit narrow, but no text is lost.
  52. @c
  53. @c See
  54. @c http://www.ft.uni-erlangen.de/~mskuhn/iso-paper.html
  55. @c for more on paper sizes. Insuring that margins are
  56. @c big enough to print on either A4 or US letter does
  57. @c indeed seem to be the usual approach (RFC2346).
  58. @c This document seems to get overfull hboxes with some
  59. @c frequency (probably because the tendency is to
  60. @c sanity-check it with "make info" and run TeX less
  61. @c often). The big ugly boxes just seem to add insult
  62. @c to injury, and I'm not aware of them helping to fix
  63. @c the overfull hboxes at all.
  64. @finalout
  65. @include version.texi
  66. @settitle CVS---Concurrent Versions System v@value{VERSION}
  67. @setchapternewpage odd
  68. @c -- TODO list:
  69. @c -- Fix all lines that match "^@c -- "
  70. @c -- Also places marked with FIXME should be manual
  71. @c problems (as opposed to FIXCVS for CVS problems).
  72. @c @splitrcskeyword{} is used to avoid keyword expansion. It is replaced by
  73. @c @asis when generating info and dvi, and by <i></i> in the generated html,
  74. @c such that keywords are not expanded in the generated html.
  75. @ifnothtml
  76. @macro splitrcskeyword {arg}
  77. @asis{}\arg\
  78. @end macro
  79. @end ifnothtml
  80. @ifhtml
  81. @macro splitrcskeyword {arg}
  82. @i{}\arg\
  83. @end macro
  84. @end ifhtml
  85. @dircategory GNU Packages
  86. @direntry
  87. * CVS: (cvs). Concurrent Versions System
  88. @end direntry
  89. @dircategory Individual utilities
  90. @direntry
  91. * cvs: (cvs)CVS commands. Concurrent Versions System
  92. @end direntry
  93. @comment The titlepage section does not appear in the Info file.
  94. @titlepage
  95. @sp 4
  96. @comment The title is printed in a large font.
  97. @center @titlefont{Version Management}
  98. @sp
  99. @center @titlefont{with}
  100. @sp
  101. @center @titlefont{CVS}
  102. @sp 2
  103. @center for @sc{cvs} @value{VERSION}
  104. @comment -release-
  105. @sp 3
  106. @center Per Cederqvist et al
  107. @comment The following two commands start the copyright page
  108. @comment for the printed manual. This will not appear in the Info file.
  109. @page
  110. @vskip 0pt plus 1filll
  111. @copyleftnotice
  112. @end titlepage
  113. @summarycontents
  114. @contents
  115. @comment ================================================================
  116. @comment The real text starts here
  117. @comment ================================================================
  118. @ifnottex
  119. @c ---------------------------------------------------------------------
  120. @node Top
  121. @top
  122. This info manual describes how to use and administer
  123. @sc{cvs} version @value{VERSION}.
  124. @end ifnottex
  125. @ifinfo
  126. @copyleftnotice
  127. @end ifinfo
  128. @c This menu is pretty long. Not sure how easily that
  129. @c can be fixed (no brilliant ideas right away)...
  130. @menu
  131. * Overview:: An introduction to CVS
  132. * Repository:: Where all your sources are stored
  133. * Starting a new project:: Starting a project with CVS
  134. * Revisions:: Numeric and symbolic names for revisions
  135. * Branching and merging:: Diverging/rejoining branches of development
  136. * Recursive behavior:: CVS descends directories
  137. * Adding and removing:: Adding/removing/renaming files/directories
  138. * History browsing:: Viewing the history of files in various ways
  139. CVS and the Real World.
  140. -----------------------
  141. * Binary files:: CVS can handle binary files
  142. * Multiple developers:: How CVS helps a group of developers
  143. * Revision management:: Policy questions for revision management
  144. * Keyword substitution:: CVS can include the revision inside the file
  145. * Tracking sources:: Tracking third-party sources
  146. * Builds:: Issues related to CVS and builds
  147. * Special Files:: Devices, links and other non-regular files
  148. References.
  149. -----------
  150. * CVS commands:: CVS commands share some things
  151. * Invoking CVS:: Quick reference to CVS commands
  152. * Administrative files:: Reference manual for the Administrative files
  153. * Environment variables:: All environment variables which affect CVS
  154. * Compatibility:: Upgrading CVS versions
  155. * Troubleshooting:: Some tips when nothing works
  156. * Credits:: Some of the contributors to this manual
  157. * BUGS:: Dealing with bugs in CVS or this manual
  158. * Index:: Index
  159. @end menu
  160. @c ---------------------------------------------------------------------
  161. @node Overview
  162. @chapter Overview
  163. @cindex Overview
  164. This chapter is for people who have never used
  165. @sc{cvs}, and perhaps have never used version control
  166. software before.
  167. If you are already familiar with @sc{cvs} and are just
  168. trying to learn a particular feature or remember a
  169. certain command, you can probably skip everything here.
  170. @menu
  171. * What is CVS?:: What you can do with @sc{cvs}
  172. * What is CVS not?:: Problems @sc{cvs} doesn't try to solve
  173. * A sample session:: A tour of basic @sc{cvs} usage
  174. @end menu
  175. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  176. @node What is CVS?
  177. @section What is CVS?
  178. @cindex What is CVS?
  179. @cindex Introduction to CVS
  180. @cindex CVS, introduction to
  181. @sc{cvs} is a version control system. Using it, you can
  182. record the history of your source files.
  183. @c -- ///
  184. @c -- ///Those who cannot remember the past are condemned to repeat it.
  185. @c -- /// -- George Santayana
  186. @c -- //////
  187. @c -- Insert history quote here!
  188. For example, bugs sometimes creep in when
  189. software is modified, and you might not detect the bug
  190. until a long time after you make the modification.
  191. With @sc{cvs}, you can easily retrieve old versions to see
  192. exactly which change caused the bug. This can
  193. sometimes be a big help.
  194. You could of course save every version of every file
  195. you have ever created. This would
  196. however waste an enormous amount of disk space. @sc{cvs}
  197. stores all the versions of a file in a single file in a
  198. clever way that only stores the differences between
  199. versions.
  200. @sc{cvs} also helps you if you are part of a group of people working
  201. on the same project. It is all too easy to overwrite
  202. each others' changes unless you are extremely careful.
  203. Some editors, like @sc{gnu} Emacs, try to make sure that
  204. two people never modify the same file at the
  205. same time. Unfortunately, if someone is using another
  206. editor, that safeguard will not work. @sc{cvs} solves this problem
  207. by insulating the different developers from each other. Every
  208. developer works in his own directory, and @sc{cvs} merges
  209. the work when each developer is done.
  210. @cindex History of CVS
  211. @cindex CVS, history of
  212. @cindex Credits (CVS program)
  213. @cindex Contributors (CVS program)
  214. @sc{cvs} started out as a bunch of shell scripts written by
  215. Dick Grune, posted to the newsgroup
  216. @code{comp.sources.unix} in the volume 6
  217. release of July, 1986. While no actual code from
  218. these shell scripts is present in the current version
  219. of @sc{cvs} much of the @sc{cvs} conflict resolution algorithms
  220. come from them.
  221. In April, 1989, Brian Berliner designed and coded @sc{cvs}.
  222. Jeff Polk later helped Brian with the design of the @sc{cvs}
  223. module and vendor branch support.
  224. @cindex Source, getting CVS source
  225. You can get @sc{cvs} in a variety of ways, including
  226. free download from the Internet. For more information
  227. on downloading @sc{cvs} and other @sc{cvs} topics, see:
  228. @example
  229. @url{http://cvs.nongnu.org/}
  230. @end example
  231. @cindex Mailing list
  232. @cindex List, mailing list
  233. @cindex Newsgroups
  234. There is a mailing list, known as @email{info-cvs@@nongnu.org},
  235. devoted to @sc{cvs}. To subscribe or
  236. unsubscribe
  237. write to
  238. @email{info-cvs-request@@nongnu.org}.
  239. If you prefer a Usenet group, there is a one-way mirror (posts to the email
  240. list are usually sent to the news group, but not vice versa) of
  241. @email{info-cvs@@nongnu.org} at @url{news:gnu.cvs.help}. The right
  242. Usenet group for posts is @url{news:comp.software.config-mgmt} which is for
  243. @sc{cvs} discussions (along with other configuration
  244. management systems). In the future, it might be
  245. possible to create a
  246. @code{comp.software.config-mgmt.cvs}, but probably only
  247. if there is sufficient @sc{cvs} traffic on
  248. @url{news:comp.software.config-mgmt}.
  249. @c Other random data is that the tale was very
  250. @c skeptical of comp.software.config-mgmt.cvs when the
  251. @c subject came up around 1995 or so (for one
  252. @c thing, because creating it would be a "reorg" which
  253. @c would need to take a more comprehensive look at the
  254. @c whole comp.software.config-mgmt.* hierarchy).
  255. You can also subscribe to the @email{bug-cvs@@nongnu.org} mailing list,
  256. described in more detail in @ref{BUGS}. To subscribe
  257. send mail to @email{bug-cvs-request@@nongnu.org}. There is a two-way
  258. Usenet mirror (posts to the Usenet group are usually sent to the email list and
  259. vice versa) of @email{bug-cvs@@nongnu.org} named @url{news:gnu.cvs.bug}.
  260. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  261. @node What is CVS not?
  262. @section What is CVS not?
  263. @cindex What is CVS not?
  264. @sc{cvs} can do a lot of things for you, but it does
  265. not try to be everything for everyone.
  266. @table @asis
  267. @item @sc{cvs} is not a build system.
  268. Though the structure of your repository and modules
  269. file interact with your build system
  270. (e.g. @file{Makefile}s), they are essentially
  271. independent.
  272. @sc{cvs} does not dictate how you build anything. It
  273. merely stores files for retrieval in a tree structure
  274. you devise.
  275. @sc{cvs} does not dictate how to use disk space in the
  276. checked out working directories. If you write your
  277. @file{Makefile}s or scripts in every directory so they
  278. have to know the relative positions of everything else,
  279. you wind up requiring the entire repository to be
  280. checked out.
  281. If you modularize your work, and construct a build
  282. system that will share files (via links, mounts,
  283. @code{VPATH} in @file{Makefile}s, etc.), you can
  284. arrange your disk usage however you like.
  285. But you have to remember that @emph{any} such system is
  286. a lot of work to construct and maintain. @sc{cvs} does
  287. not address the issues involved.
  288. Of course, you should place the tools created to
  289. support such a build system (scripts, @file{Makefile}s,
  290. etc.) under @sc{cvs}.
  291. Figuring out what files need to be rebuilt when
  292. something changes is, again, something to be handled
  293. outside the scope of @sc{cvs}. One traditional
  294. approach is to use @code{make} for building, and use
  295. some automated tool for generating the dependencies which
  296. @code{make} uses.
  297. See @ref{Builds}, for more information on doing builds
  298. in conjunction with @sc{cvs}.
  299. @item @sc{cvs} is not a substitute for management.
  300. Your managers and project leaders are expected to talk
  301. to you frequently enough to make certain you are aware
  302. of schedules, merge points, branch names and release
  303. dates. If they don't, @sc{cvs} can't help.
  304. @sc{cvs} is an instrument for making sources dance to
  305. your tune. But you are the piper and the composer. No
  306. instrument plays itself or writes its own music.
  307. @item @sc{cvs} is not a substitute for developer communication.
  308. When faced with conflicts within a single file, most
  309. developers manage to resolve them without too much
  310. effort. But a more general definition of ``conflict''
  311. includes problems too difficult to solve without
  312. communication between developers.
  313. @sc{cvs} cannot determine when simultaneous changes
  314. within a single file, or across a whole collection of
  315. files, will logically conflict with one another. Its
  316. concept of a @dfn{conflict} is purely textual, arising
  317. when two changes to the same base file are near enough
  318. to spook the merge (i.e., @code{diff3}) command.
  319. @sc{cvs} does not claim to help at all in figuring out
  320. non-textual or distributed conflicts in program logic.
  321. For example: Say you change the arguments to function
  322. @code{X} defined in file @file{A}. At the same time,
  323. someone edits file @file{B}, adding new calls to
  324. function @code{X} using the old arguments. You are
  325. outside the realm of @sc{cvs}'s competence.
  326. Acquire the habit of reading specs and talking to your
  327. peers.
  328. @item @sc{cvs} does not have change control
  329. Change control refers to a number of things. First of
  330. all it can mean @dfn{bug-tracking}, that is being able
  331. to keep a database of reported bugs and the status of
  332. each one (Is it fixed? In what release? Has the bug
  333. submitter agreed that it is fixed?). For interfacing
  334. @sc{cvs} to an external bug-tracking system, see the
  335. @file{rcsinfo} and @file{verifymsg} files
  336. (@pxref{Administrative files}).
  337. Another aspect of change control is keeping track of
  338. the fact that changes to several files were in fact
  339. changed together as one logical change. If you check
  340. in several files in a single @code{cvs commit}
  341. operation, @sc{cvs} then forgets that those files were
  342. checked in together, and the fact that they have the
  343. same log message is the only thing tying them
  344. together. Keeping a @sc{gnu} style @file{ChangeLog}
  345. can help somewhat.
  346. @c FIXME: should have an xref to a section which talks
  347. @c more about keeping ChangeLog's with CVS, but that
  348. @c section hasn't been written yet.
  349. Another aspect of change control, in some systems, is
  350. the ability to keep track of the status of each
  351. change. Some changes have been written by a developer,
  352. others have been reviewed by a second developer, and so
  353. on. Generally, the way to do this with @sc{cvs} is to
  354. generate a diff (using @code{cvs diff} or @code{diff})
  355. and email it to someone who can then apply it using the
  356. @code{patch} utility. This is very flexible, but
  357. depends on mechanisms outside @sc{cvs} to make sure
  358. nothing falls through the cracks.
  359. @item @sc{cvs} is not an automated testing program
  360. It should be possible to enforce mandatory use of a
  361. test suite using the @code{commitinfo} file. I haven't
  362. heard a lot about projects trying to do that or whether
  363. there are subtle gotchas, however.
  364. @item @sc{cvs} does not have a built-in process model
  365. Some systems provide ways to ensure that changes or
  366. releases go through various steps, with various
  367. approvals as needed. Generally, one can accomplish
  368. this with @sc{cvs} but it might be a little more work.
  369. In some cases you'll want to use the @file{commitinfo},
  370. @file{loginfo}, @file{rcsinfo}, or @file{verifymsg}
  371. files, to require that certain steps be performed
  372. before cvs will allow a checkin. Also consider whether
  373. features such as branches and tags can be used to
  374. perform tasks such as doing work in a development tree
  375. and then merging certain changes over to a stable tree
  376. only once they have been proven.
  377. @end table
  378. @c ---------------------------------------------------------------------
  379. @node A sample session
  380. @section A sample session
  381. @cindex Example of a work-session
  382. @cindex Getting started
  383. @cindex Work-session, example of
  384. @cindex tc, Trivial Compiler (example)
  385. @cindex Trivial Compiler (example)
  386. @c I think an example is a pretty good way to start. But
  387. @c somewhere in here, maybe after the sample session,
  388. @c we need something which is kind of
  389. @c a "roadmap" which is more directed at sketching out
  390. @c the functionality of CVS and pointing people to
  391. @c various other parts of the manual. As it stands now
  392. @c people who read in order get dumped right into all
  393. @c manner of hair regarding remote repositories,
  394. @c creating a repository, etc.
  395. @c
  396. @c The following was in the old Basic concepts node. I don't
  397. @c know how good a job it does at introducing modules,
  398. @c or whether they need to be introduced so soon, but
  399. @c something of this sort might go into some
  400. @c introductory material somewhere.
  401. @ignore
  402. @cindex Modules (intro)
  403. The repository contains directories and files, in an
  404. arbitrary tree. The @dfn{modules} feature can be used
  405. to group together a set of directories or files into a
  406. single entity (@pxref{modules}). A typical usage is to
  407. define one module per project.
  408. @end ignore
  409. As a way of introducing @sc{cvs}, we'll go through a
  410. typical work-session using @sc{cvs}. The first thing
  411. to understand is that @sc{cvs} stores all files in a
  412. centralized @dfn{repository} (@pxref{Repository}); this
  413. section assumes that a repository is set up.
  414. @c I'm not sure that the sentence concerning the
  415. @c repository quite tells the user what they need to
  416. @c know at this point. Might need to expand on "centralized"
  417. @c slightly (maybe not here, maybe further down in the example?)
  418. Suppose you are working on a simple compiler. The source
  419. consists of a handful of C files and a @file{Makefile}.
  420. The compiler is called @samp{tc} (Trivial Compiler),
  421. and the repository is set up so that there is a module
  422. called @samp{tc}.
  423. @menu
  424. * Getting the source:: Creating a workspace
  425. * Committing your changes:: Making your work available to others
  426. * Cleaning up:: Cleaning up
  427. * Viewing differences:: Viewing differences
  428. @end menu
  429. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  430. @node Getting the source
  431. @subsection Getting the source
  432. @cindex Getting the source
  433. @cindex Checking out source
  434. @cindex Fetching source
  435. @cindex Source, getting from CVS
  436. @cindex Checkout, example
  437. The first thing you must do is to get your own working copy of the
  438. source for @samp{tc}. For this, you use the @code{checkout} command:
  439. @example
  440. $ cvs checkout tc
  441. @end example
  442. @noindent
  443. This will create a new directory called @file{tc} and populate it with
  444. the source files.
  445. @example
  446. $ cd tc
  447. $ ls
  448. CVS Makefile backend.c driver.c frontend.c parser.c
  449. @end example
  450. The @file{CVS} directory is used internally by
  451. @sc{cvs}. Normally, you should not modify or remove
  452. any of the files in it.
  453. You start your favorite editor, hack away at @file{backend.c}, and a couple
  454. of hours later you have added an optimization pass to the compiler.
  455. A note to @sc{rcs} and @sc{sccs} users: There is no need to lock the files that
  456. you want to edit. @xref{Multiple developers}, for an explanation.
  457. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  458. @node Committing your changes
  459. @subsection Committing your changes
  460. @cindex Committing changes to files
  461. @cindex Log message entry
  462. When you have checked that the compiler is still compilable you decide
  463. to make a new version of @file{backend.c}. This will
  464. store your new @file{backend.c} in the repository and
  465. make it available to anyone else who is using that same
  466. repository.
  467. @example
  468. $ cvs commit backend.c
  469. @end example
  470. @noindent
  471. @sc{cvs} starts an editor, to allow you to enter a log
  472. message. You type in ``Added an optimization pass.'',
  473. save the temporary file, and exit the editor.
  474. @cindex CVSEDITOR, environment variable
  475. @cindex EDITOR, environment variable
  476. The environment variable @code{$CVSEDITOR} determines
  477. which editor is started. If @code{$CVSEDITOR} is not
  478. set, then if the environment variable @code{$EDITOR} is
  479. set, it will be used. If both @code{$CVSEDITOR} and
  480. @code{$EDITOR} are not set then there is a default
  481. which will vary with your operating system, for example
  482. @code{vi} for unix or @code{notepad} for Windows
  483. NT/95.
  484. @cindex VISUAL, environment variable
  485. In addition, @sc{cvs} checks the @code{$VISUAL} environment
  486. variable. Opinions vary on whether this behavior is desirable and
  487. whether future releases of @sc{cvs} should check @code{$VISUAL} or
  488. ignore it. You will be OK either way if you make sure that
  489. @code{$VISUAL} is either unset or set to the same thing as
  490. @code{$EDITOR}.
  491. @c This probably should go into some new node
  492. @c containing detailed info on the editor, rather than
  493. @c the intro. In fact, perhaps some of the stuff with
  494. @c CVSEDITOR and -m and so on should too.
  495. When @sc{cvs} starts the editor, it includes a list of
  496. files which are modified. For the @sc{cvs} client,
  497. this list is based on comparing the modification time
  498. of the file against the modification time that the file
  499. had when it was last gotten or updated. Therefore, if
  500. a file's modification time has changed but its contents
  501. have not, it will show up as modified. The simplest
  502. way to handle this is simply not to worry about it---if
  503. you proceed with the commit @sc{cvs} will detect that
  504. the contents are not modified and treat it as an
  505. unmodified file. The next @code{update} will clue
  506. @sc{cvs} in to the fact that the file is unmodified,
  507. and it will reset its stored timestamp so that the file
  508. will not show up in future editor sessions.
  509. @c FIXCVS: Might be nice if "commit" and other commands
  510. @c would reset that timestamp too, but currently commit
  511. @c doesn't.
  512. @c FIXME: Need to talk more about the process of
  513. @c prompting for the log message. Like show an example
  514. @c of what it pops up in the editor, for example. Also
  515. @c a discussion of how to get the "a)bort, c)ontinue,
  516. @c e)dit" prompt and what to do with it. Might also
  517. @c work in the suggestion that if you want a diff, you
  518. @c should make it before running commit (someone
  519. @c suggested that the diff pop up in the editor. I'm
  520. @c not sure that is better than telling people to run
  521. @c "cvs diff" first if that is what they want, but if
  522. @c we want to tell people that, the manual possibly
  523. @c should say it).
  524. If you want to avoid
  525. starting an editor you can specify the log message on
  526. the command line using the @samp{-m} flag instead, like
  527. this:
  528. @example
  529. $ cvs commit -m "Added an optimization pass" backend.c
  530. @end example
  531. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  532. @node Cleaning up
  533. @subsection Cleaning up
  534. @cindex Cleaning up
  535. @cindex Working copy, removing
  536. @cindex Removing your working copy
  537. @cindex Releasing your working copy
  538. Before you turn to other tasks you decide to remove your working copy of
  539. tc. One acceptable way to do that is of course
  540. @example
  541. $ cd ..
  542. $ rm -r tc
  543. @end example
  544. @noindent
  545. but a better way is to use the @code{release} command (@pxref{release}):
  546. @example
  547. $ cd ..
  548. $ cvs release -d tc
  549. M driver.c
  550. ? tc
  551. You have [1] altered files in this repository.
  552. Are you sure you want to release (and delete) directory `tc': n
  553. ** `release' aborted by user choice.
  554. @end example
  555. The @code{release} command checks that all your modifications have been
  556. committed. If history logging is enabled it also makes a note in the
  557. history file. @xref{history file}.
  558. When you use the @samp{-d} flag with @code{release}, it
  559. also removes your working copy.
  560. In the example above, the @code{release} command wrote a couple of lines
  561. of output. @samp{? tc} means that the file @file{tc} is unknown to @sc{cvs}.
  562. That is nothing to worry about: @file{tc} is the executable compiler,
  563. and it should not be stored in the repository. @xref{cvsignore},
  564. for information about how to make that warning go away.
  565. @xref{release output}, for a complete explanation of
  566. all possible output from @code{release}.
  567. @samp{M driver.c} is more serious. It means that the
  568. file @file{driver.c} has been modified since it was
  569. checked out.
  570. The @code{release} command always finishes by telling
  571. you how many modified files you have in your working
  572. copy of the sources, and then asks you for confirmation
  573. before deleting any files or making any note in the
  574. history file.
  575. You decide to play it safe and answer @kbd{n @key{RET}}
  576. when @code{release} asks for confirmation.
  577. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  578. @node Viewing differences
  579. @subsection Viewing differences
  580. @cindex Viewing differences
  581. @cindex Diff
  582. You do not remember modifying @file{driver.c}, so you want to see what
  583. has happened to that file.
  584. @example
  585. $ cd tc
  586. $ cvs diff driver.c
  587. @end example
  588. This command runs @code{diff} to compare the version of @file{driver.c}
  589. that you checked out with your working copy. When you see the output
  590. you remember that you added a command line option that enabled the
  591. optimization pass. You check it in, and release the module.
  592. @c FIXME: we haven't yet defined the term "check in".
  593. @example
  594. $ cvs commit -m "Added an optimization pass" driver.c
  595. Checking in driver.c;
  596. /usr/local/cvsroot/tc/driver.c,v <-- driver.c
  597. new revision: 1.2; previous revision: 1.1
  598. done
  599. $ cd ..
  600. $ cvs release -d tc
  601. ? tc
  602. You have [0] altered files in this repository.
  603. Are you sure you want to release (and delete) directory `tc': y
  604. @end example
  605. @c ---------------------------------------------------------------------
  606. @node Repository
  607. @chapter The Repository
  608. @cindex Repository (intro)
  609. @cindex Repository, example
  610. @cindex Layout of repository
  611. @cindex Typical repository
  612. @cindex /usr/local/cvsroot, as example repository
  613. @cindex cvsroot
  614. The @sc{cvs} @dfn{repository} stores a complete copy of
  615. all the files and directories which are under version
  616. control.
  617. Normally, you never access any of the files in the
  618. repository directly. Instead, you use @sc{cvs}
  619. commands to get your own copy of the files into a
  620. @dfn{working directory}, and then
  621. work on that copy. When you've finished a set of
  622. changes, you check (or @dfn{commit}) them back into the
  623. repository. The repository then contains the changes
  624. which you have made, as well as recording exactly what
  625. you changed, when you changed it, and other such
  626. information. Note that the repository is not a
  627. subdirectory of the working directory, or vice versa;
  628. they should be in separate locations.
  629. @c Need some example, e.g. repository
  630. @c /usr/local/cvsroot; working directory
  631. @c /home/joe/sources. But this node is too long
  632. @c as it is; need a little reorganization...
  633. @cindex :local:, setting up
  634. @sc{cvs} can access a repository by a variety of
  635. means. It might be on the local computer, or it might
  636. be on a computer across the room or across the world.
  637. To distinguish various ways to access a repository, the
  638. repository name can start with an @dfn{access method}.
  639. For example, the access method @code{:local:} means to
  640. access a repository directory, so the repository
  641. @code{:local:/usr/local/cvsroot} means that the
  642. repository is in @file{/usr/local/cvsroot} on the
  643. computer running @sc{cvs}. For information on other
  644. access methods, see @ref{Remote repositories}.
  645. @c Can se say this more concisely? Like by passing
  646. @c more of the buck to the Remote repositories node?
  647. If the access method is omitted, then if the repository
  648. starts with @samp{/}, then @code{:local:} is
  649. assumed. If it does not start with @samp{/} then either
  650. @code{:ext:} or @code{:server:} is assumed. For
  651. example, if you have a local repository in
  652. @file{/usr/local/cvsroot}, you can use
  653. @code{/usr/local/cvsroot} instead of
  654. @code{:local:/usr/local/cvsroot}. But if (under
  655. Windows NT, for example) your local repository is
  656. @file{c:\src\cvsroot}, then you must specify the access
  657. method, as in @code{:local:c:/src/cvsroot}.
  658. @c This might appear to go in Repository storage, but
  659. @c actually it is describing something which is quite
  660. @c user-visible, when you do a "cvs co CVSROOT". This
  661. @c isn't necessary the perfect place for that, though.
  662. The repository is split in two parts. @file{$CVSROOT/CVSROOT} contains
  663. administrative files for @sc{cvs}. The other directories contain the actual
  664. user-defined modules.
  665. @menu
  666. * Specifying a repository:: Telling CVS where your repository is
  667. * Repository storage:: The structure of the repository
  668. * Working directory storage:: The structure of working directories
  669. * Intro administrative files:: Defining modules
  670. * Multiple repositories:: Multiple repositories
  671. * Creating a repository:: Creating a repository
  672. * Backing up:: Backing up a repository
  673. * Moving a repository:: Moving a repository
  674. * Remote repositories:: Accessing repositories on remote machines
  675. * Read-only access:: Granting read-only access to the repository
  676. * Server temporary directory:: The server creates temporary directories
  677. @end menu
  678. @node Specifying a repository
  679. @section Telling CVS where your repository is
  680. There are several ways to tell @sc{cvs}
  681. where to find the repository. You can name the
  682. repository on the command line explicitly, with the
  683. @code{-d} (for "directory") option:
  684. @example
  685. cvs -d /usr/local/cvsroot checkout yoyodyne/tc
  686. @end example
  687. @cindex .profile, setting CVSROOT in
  688. @cindex .cshrc, setting CVSROOT in
  689. @cindex .tcshrc, setting CVSROOT in
  690. @cindex .bashrc, setting CVSROOT in
  691. @cindex CVSROOT, environment variable
  692. Or you can set the @code{$CVSROOT} environment
  693. variable to an absolute path to the root of the
  694. repository, @file{/usr/local/cvsroot} in this example.
  695. To set @code{$CVSROOT}, @code{csh} and @code{tcsh}
  696. users should have this line in their @file{.cshrc} or
  697. @file{.tcshrc} files:
  698. @example
  699. setenv CVSROOT /usr/local/cvsroot
  700. @end example
  701. @noindent
  702. @code{sh} and @code{bash} users should instead have these lines in their
  703. @file{.profile} or @file{.bashrc}:
  704. @example
  705. CVSROOT=/usr/local/cvsroot
  706. export CVSROOT
  707. @end example
  708. @cindex Root file, in CVS directory
  709. @cindex CVS/Root file
  710. A repository specified with @code{-d} will
  711. override the @code{$CVSROOT} environment variable.
  712. Once you've checked a working copy out from the
  713. repository, it will remember where its repository is
  714. (the information is recorded in the
  715. @file{CVS/Root} file in the working copy).
  716. The @code{-d} option and the @file{CVS/Root} file both
  717. override the @code{$CVSROOT} environment variable. If
  718. @code{-d} option differs from @file{CVS/Root}, the
  719. former is used. Of course, for proper operation they
  720. should be two ways of referring to the same repository.
  721. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  722. @node Repository storage
  723. @section How data is stored in the repository
  724. @cindex Repository, how data is stored
  725. For most purposes it isn't important @emph{how}
  726. @sc{cvs} stores information in the repository. In
  727. fact, the format has changed in the past, and is likely
  728. to change in the future. Since in almost all cases one
  729. accesses the repository via @sc{cvs} commands, such
  730. changes need not be disruptive.
  731. However, in some cases it may be necessary to
  732. understand how @sc{cvs} stores data in the repository,
  733. for example you might need to track down @sc{cvs} locks
  734. (@pxref{Concurrency}) or you might need to deal with
  735. the file permissions appropriate for the repository.
  736. @menu
  737. * Repository files:: What files are stored in the repository
  738. * File permissions:: File permissions
  739. * Windows permissions:: Issues specific to Windows
  740. * Attic:: Some files are stored in the Attic
  741. * CVS in repository:: Additional information in CVS directory
  742. * Locks:: CVS locks control concurrent accesses
  743. * CVSROOT storage:: A few things about CVSROOT are different
  744. @end menu
  745. @node Repository files
  746. @subsection Where files are stored within the repository
  747. @c @cindex Filenames, legal
  748. @c @cindex Legal filenames
  749. @c Somewhere we need to say something about legitimate
  750. @c characters in filenames in working directory and
  751. @c repository. Not "/" (not even on non-unix). And
  752. @c here is a specific set of issues:
  753. @c Files starting with a - are handled inconsistently. They can not
  754. @c be added to a repository with an add command, because it they are
  755. @c interpreted as a switch. They can appear in a repository if they are
  756. @c part of a tree that is imported. They can not be removed from the tree
  757. @c once they are there.
  758. @c Note that "--" *is* supported (as a
  759. @c consequence of using GNU getopt). Should document
  760. @c this somewhere ("Common options"?). The other usual technique,
  761. @c "./-foo", isn't as effective, at least for "cvs add"
  762. @c which doesn't support pathnames containing "/".
  763. The overall structure of the repository is a directory
  764. tree corresponding to the directories in the working
  765. directory. For example, supposing the repository is in
  766. @example
  767. /usr/local/cvsroot
  768. @end example
  769. @noindent
  770. here is a possible directory tree (showing only the
  771. directories):
  772. @example
  773. @t{/usr}
  774. |
  775. +--@t{local}
  776. | |
  777. | +--@t{cvsroot}
  778. | | |
  779. | | +--@t{CVSROOT}
  780. | (administrative files)
  781. |
  782. +--@t{gnu}
  783. | |
  784. | +--@t{diff}
  785. | | (source code to @sc{gnu} diff)
  786. | |
  787. | +--@t{rcs}
  788. | | (source code to @sc{rcs})
  789. | |
  790. | +--@t{cvs}
  791. | (source code to @sc{cvs})
  792. |
  793. +--@t{yoyodyne}
  794. |
  795. +--@t{tc}
  796. | |
  797. | +--@t{man}
  798. | |
  799. | +--@t{testing}
  800. |
  801. +--(other Yoyodyne software)
  802. @end example
  803. With the directories are @dfn{history files} for each file
  804. under version control. The name of the history file is
  805. the name of the corresponding file with @samp{,v}
  806. appended to the end. Here is what the repository for
  807. the @file{yoyodyne/tc} directory might look like:
  808. @c FIXME: Should also mention CVS (CVSREP)
  809. @c FIXME? Should we introduce Attic with an xref to
  810. @c Attic? Not sure whether that is a good idea or not.
  811. @example
  812. @code{$CVSROOT}
  813. |
  814. +--@t{yoyodyne}
  815. | |
  816. | +--@t{tc}
  817. | | |
  818. +--@t{Makefile,v}
  819. +--@t{backend.c,v}
  820. +--@t{driver.c,v}
  821. +--@t{frontend.c,v}
  822. +--@t{parser.c,v}
  823. +--@t{man}
  824. | |
  825. | +--@t{tc.1,v}
  826. |
  827. +--@t{testing}
  828. |
  829. +--@t{testpgm.t,v}
  830. +--@t{test2.t,v}
  831. @end example
  832. @cindex History files
  833. @cindex RCS history files
  834. @c The first sentence, about what history files
  835. @c contain, is kind of redundant with our intro to what the
  836. @c repository does in node Repository....
  837. The history files contain, among other things, enough
  838. information to recreate any revision of the file, a log
  839. of all commit messages and the user-name of the person
  840. who committed the revision. The history files are
  841. known as @dfn{RCS files}, because the first program to
  842. store files in that format was a version control system
  843. known as @sc{rcs}. For a full
  844. description of the file format, see the @code{man} page
  845. @cite{rcsfile(5)}, distributed with @sc{rcs}, or the
  846. file @file{doc/RCSFILES} in the @sc{cvs} source
  847. distribution. This
  848. file format has become very common---many systems other
  849. than @sc{cvs} or @sc{rcs} can at least import history
  850. files in this format.
  851. @c FIXME: Think about including documentation for this
  852. @c rather than citing it? In the long run, getting
  853. @c this to be a standard (not sure if we can cope with
  854. @c a standards process as formal as IEEE/ANSI/ISO/etc,
  855. @c though...) is the way to go, so maybe citing is
  856. @c better.
  857. The @sc{rcs} files used in @sc{cvs} differ in a few
  858. ways from the standard format. The biggest difference
  859. is magic branches; for more information see @ref{Magic
  860. branch numbers}. Also in @sc{cvs} the valid tag names
  861. are a subset of what @sc{rcs} accepts; for @sc{cvs}'s
  862. rules see @ref{Tags}.
  863. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  864. @node File permissions
  865. @subsection File permissions
  866. @c -- Move this to @node Creating a repository or similar
  867. @cindex Security, file permissions in repository
  868. @cindex File permissions, general
  869. @cindex Permissions, general
  870. @c FIXME: we need to somehow reflect "permissions in
  871. @c repository" versus "permissions in working
  872. @c directory" in the index entries.
  873. @cindex Group, UNIX file permissions, in repository
  874. @cindex Read-only files, in repository
  875. All @samp{,v} files are created read-only, and you
  876. should not change the permission of those files. The
  877. directories inside the repository should be writable by
  878. the persons that have permission to modify the files in
  879. each directory. This normally means that you must
  880. create a UNIX group (see group(5)) consisting of the
  881. persons that are to edit the files in a project, and
  882. set up the repository so that it is that group that
  883. owns the directory.
  884. (On some systems, you also need to set the set-group-ID-on-execution bit
  885. on the repository directories (see chmod(1)) so that newly-created files
  886. and directories get the group-ID of the parent directory rather than
  887. that of the current process.)
  888. @c See also comment in commitinfo node regarding cases
  889. @c which are really awkward with unix groups.
  890. This means that you can only control access to files on
  891. a per-directory basis.
  892. Note that users must also have write access to check
  893. out files, because @sc{cvs} needs to create lock files
  894. (@pxref{Concurrency}). You can use LockDir in CVSROOT/config
  895. to put the lock files somewhere other than in the repository
  896. if you want to allow read-only access to some directories
  897. (@pxref{config}).
  898. @c CVS seems to use CVSUMASK in picking permissions for
  899. @c val-tags, but maybe we should say more about this.
  900. @c Like val-tags gets created by someone who doesn't
  901. @c have CVSUMASK set right?
  902. @cindex CVSROOT/val-tags file, and read-only access to projects
  903. @cindex val-tags file, and read-only access to projects
  904. Also note that users must have write access to the
  905. @file{CVSROOT/val-tags} file. @sc{cvs} uses it to keep
  906. track of what tags are valid tag names (it is sometimes
  907. updated when tags are used, as well as when they are
  908. created).
  909. Each @sc{rcs} file will be owned by the user who last
  910. checked it in. This has little significance; what
  911. really matters is who owns the directories.
  912. @cindex CVSUMASK, environment variable
  913. @cindex Umask, for repository files
  914. @sc{cvs} tries to set up reasonable file permissions
  915. for new directories that are added inside the tree, but
  916. you must fix the permissions manually when a new
  917. directory should have different permissions than its
  918. parent directory. If you set the @code{CVSUMASK}
  919. environment variable, that will control the file
  920. permissions which @sc{cvs} uses in creating directories
  921. and/or files in the repository. @code{CVSUMASK} does
  922. not affect the file permissions in the working
  923. directory; such files have the permissions which are
  924. typical for newly created files, except that sometimes
  925. @sc{cvs} creates them read-only (see the sections on
  926. watches, @ref{Setting a watch}; -r, @ref{Global
  927. options}; or @code{CVSREAD}, @ref{Environment variables}).
  928. @c FIXME: Need more discussion of which
  929. @c group should own the file in the repository.
  930. @c Include a somewhat detailed example of the usual
  931. @c case where CVSUMASK is 007, the developers are all
  932. @c in a group, and that group owns stuff in the
  933. @c repository. Need to talk about group ownership of
  934. @c newly-created directories/files (on some unices,
  935. @c such as SunOS4, setting the setgid bit on the
  936. @c directories will make files inherit the directory's
  937. @c group. On other unices, your mileage may vary. I
  938. @c can't remember what POSIX says about this, if
  939. @c anything).
  940. Note that using the client/server @sc{cvs}
  941. (@pxref{Remote repositories}), there is no good way to
  942. set @code{CVSUMASK}; the setting on the client machine
  943. has no effect. If you are connecting with @code{rsh}, you
  944. can set @code{CVSUMASK} in @file{.bashrc} or @file{.cshrc}, as
  945. described in the documentation for your operating
  946. system. This behavior might change in future versions
  947. of @sc{cvs}; do not rely on the setting of
  948. @code{CVSUMASK} on the client having no effect.
  949. @c FIXME: need to explain what a umask is or cite
  950. @c someplace which does.
  951. @c
  952. @c There is also a larger (largely separate) issue
  953. @c about the meaning of CVSUMASK in a non-unix context.
  954. @c For example, whether there is
  955. @c an equivalent which fits better into other
  956. @c protection schemes like POSIX.6, VMS, &c.
  957. @c
  958. @c FIXME: Need one place which discusses this
  959. @c read-only files thing. Why would one use -r or
  960. @c CVSREAD? Why would one use watches? How do they
  961. @c interact?
  962. @c
  963. @c FIXME: We need to state
  964. @c whether using CVSUMASK removes the need for manually
  965. @c fixing permissions (in fact, if we are going to mention
  966. @c manually fixing permission, we better document a lot
  967. @c better just what we mean by "fix").
  968. Using pserver, you will generally need stricter
  969. permissions on the @sc{cvsroot} directory and
  970. directories above it in the tree; see @ref{Password
  971. authentication security}.
  972. @cindex Setuid
  973. @cindex Setgid
  974. @cindex Security, setuid
  975. @cindex Installed images (VMS)
  976. Some operating systems have features which allow a
  977. particular program to run with the ability to perform
  978. operations which the caller of the program could not.
  979. For example, the set user ID (setuid) or set group ID
  980. (setgid) features of unix or the installed image
  981. feature of VMS. @sc{cvs} was not written to use such
  982. features and therefore attempting to install @sc{cvs} in
  983. this fashion will provide protection against only
  984. accidental lapses; anyone who is trying to circumvent
  985. the measure will be able to do so, and depending on how
  986. you have set it up may gain access to more than just
  987. @sc{cvs}. You may wish to instead consider pserver. It
  988. shares some of the same attributes, in terms of
  989. possibly providing a false sense of security or opening
  990. security holes wider than the ones you are trying to
  991. fix, so read the documentation on pserver security
  992. carefully if you are considering this option
  993. (@ref{Password authentication security}).
  994. @node Windows permissions
  995. @subsection File Permission issues specific to Windows
  996. @cindex Windows, and permissions
  997. @cindex File permissions, Windows-specific
  998. @cindex Permissions, Windows-specific
  999. Some file permission issues are specific to Windows
  1000. operating systems (Windows 95, Windows NT, and
  1001. presumably future operating systems in this family.
  1002. Some of the following might apply to OS/2 but I'm not
  1003. sure).
  1004. If you are using local @sc{cvs} and the repository is on a
  1005. networked file system which is served by the Samba SMB
  1006. server, some people have reported problems with
  1007. permissions. Enabling WRITE=YES in the samba
  1008. configuration is said to fix/workaround it.
  1009. Disclaimer: I haven't investigated enough to know the
  1010. implications of enabling that option, nor do I know
  1011. whether there is something which @sc{cvs} could be doing
  1012. differently in order to avoid the problem. If you find
  1013. something out, please let us know as described in
  1014. @ref{BUGS}.
  1015. @node Attic
  1016. @subsection The attic
  1017. @cindex Attic
  1018. You will notice that sometimes @sc{cvs} stores an
  1019. @sc{rcs} file in the @code{Attic}. For example, if the
  1020. @sc{cvsroot} is @file{/usr/local/cvsroot} and we are
  1021. talking about the file @file{backend.c} in the
  1022. directory @file{yoyodyne/tc}, then the file normally
  1023. would be in
  1024. @example
  1025. /usr/local/cvsroot/yoyodyne/tc/backend.c,v
  1026. @end example
  1027. @noindent
  1028. but if it goes in the attic, it would be in
  1029. @example
  1030. /usr/local/cvsroot/yoyodyne/tc/Attic/backend.c,v
  1031. @end example
  1032. @noindent
  1033. @cindex Dead state
  1034. instead. It should not matter from a user point of
  1035. view whether a file is in the attic; @sc{cvs} keeps
  1036. track of this and looks in the attic when it needs to.
  1037. But in case you want to know, the rule is that the RCS
  1038. file is stored in the attic if and only if the head
  1039. revision on the trunk has state @code{dead}. A
  1040. @code{dead} state means that file has been removed, or
  1041. never added, for that revision. For example, if you
  1042. add a file on a branch, it will have a trunk revision
  1043. in @code{dead} state, and a branch revision in a
  1044. non-@code{dead} state.
  1045. @c Probably should have some more concrete examples
  1046. @c here, or somewhere (not sure exactly how we should
  1047. @c arrange the discussion of the dead state, versus
  1048. @c discussion of the attic).
  1049. @node CVS in repository
  1050. @subsection The CVS directory in the repository
  1051. @cindex CVS directory, in repository
  1052. The @file{CVS} directory in each repository directory
  1053. contains information such as file attributes (in a file
  1054. called @file{CVS/fileattr}. In the
  1055. future additional files may be added to this directory,
  1056. so implementations should silently ignore additional
  1057. files.
  1058. This behavior is implemented only by @sc{cvs} 1.7 and
  1059. later; for details see @ref{Watches Compatibility}.
  1060. The format of the @file{fileattr} file is a series of entries
  1061. of the following form (where @samp{@{} and @samp{@}}
  1062. means the text between the braces can be repeated zero
  1063. or more times):
  1064. @var{ent-type} @var{filename} <tab> @var{attrname} = @var{attrval}
  1065. @{; @var{attrname} = @var{attrval}@} <linefeed>
  1066. @var{ent-type} is @samp{F} for a file, in which case the entry specifies the
  1067. attributes for that file.
  1068. @var{ent-type} is @samp{D},
  1069. and @var{filename} empty, to specify default attributes
  1070. to be used for newly added files.
  1071. Other @var{ent-type} are reserved for future expansion. @sc{cvs} 1.9 and older
  1072. will delete them any time it writes file attributes.
  1073. @sc{cvs} 1.10 and later will preserve them.
  1074. Note that the order of the lines is not significant;
  1075. a program writing the fileattr file may
  1076. rearrange them at its convenience.
  1077. There is currently no way of quoting tabs or line feeds in the
  1078. filename, @samp{=} in @var{attrname},
  1079. @samp{;} in @var{attrval}, etc. Note: some implementations also
  1080. don't handle a NUL character in any of the fields, but
  1081. implementations are encouraged to allow it.
  1082. By convention, @var{attrname} starting with @samp{_} is for an attribute given
  1083. special meaning by @sc{cvs}; other @var{attrname}s are for user-defined attributes
  1084. (or will be, once implementations start supporting user-defined attributes).
  1085. Built-in attributes:
  1086. @table @code
  1087. @item _watched
  1088. Present means the file is watched and should be checked out
  1089. read-only.
  1090. @item _watchers
  1091. Users with watches for this file. Value is
  1092. @var{watcher} > @var{type} @{ , @var{watcher} > @var{type} @}
  1093. where @var{watcher} is a username, and @var{type}
  1094. is zero or more of edit,unedit,commit separated by
  1095. @samp{+} (that is, nothing if none; there is no "none" or "all" keyword).
  1096. @item _editors
  1097. Users editing this file. Value is
  1098. @var{editor} > @var{val} @{ , @var{editor} > @var{val} @}
  1099. where @var{editor} is a username, and @var{val} is
  1100. @var{time}+@var{hostname}+@var{pathname}, where
  1101. @var{time} is when the @code{cvs edit} command (or
  1102. equivalent) happened,
  1103. and @var{hostname} and @var{pathname} are for the working directory.
  1104. @end table
  1105. Example:
  1106. @c FIXME: sanity.sh should contain a similar test case
  1107. @c so we can compare this example from something from
  1108. @c Real Life(TM). See cvsclient.texi (under Notify) for more
  1109. @c discussion of the date format of _editors.
  1110. @example
  1111. Ffile1 _watched=;_watchers=joe>edit,mary>commit
  1112. Ffile2 _watched=;_editors=sue>8 Jan 1975+workstn1+/home/sue/cvs
  1113. D _watched=
  1114. @end example
  1115. @noindent
  1116. means that the file @file{file1} should be checked out
  1117. read-only. Furthermore, joe is watching for edits and
  1118. mary is watching for commits. The file @file{file2}
  1119. should be checked out read-only; sue started editing it
  1120. on 8 Jan 1975 in the directory @file{/home/sue/cvs} on
  1121. the machine @code{workstn1}. Future files which are
  1122. added should be checked out read-only. To represent
  1123. this example here, we have shown a space after
  1124. @samp{D}, @samp{Ffile1}, and @samp{Ffile2}, but in fact
  1125. there must be a single tab character there and no spaces.
  1126. @node Locks
  1127. @subsection CVS locks in the repository
  1128. @cindex #cvs.rfl, technical details
  1129. @cindex #cvs.wfl, technical details
  1130. @cindex #cvs.lock, technical details
  1131. @cindex Locks, cvs, technical details
  1132. For an introduction to @sc{cvs} locks focusing on
  1133. user-visible behavior, see @ref{Concurrency}. The
  1134. following section is aimed at people who are writing
  1135. tools which want to access a @sc{cvs} repository without
  1136. interfering with other tools accessing the same
  1137. repository. If you find yourself confused by concepts
  1138. described here, like @dfn{read lock}, @dfn{write lock},
  1139. and @dfn{deadlock}, you might consult the literature on
  1140. operating systems or databases.
  1141. @cindex #cvs.tfl
  1142. Any file in the repository with a name starting
  1143. with @file{#cvs.rfl.} is a read lock. Any file in
  1144. the repository with a name starting with
  1145. @file{#cvs.wfl} is a write lock. Old versions of @sc{cvs}
  1146. (before @sc{cvs} 1.5) also created files with names starting
  1147. with @file{#cvs.tfl}, but they are not discussed here.
  1148. The directory @file{#cvs.lock} serves as a master
  1149. lock. That is, one must obtain this lock first before
  1150. creating any of the other locks.
  1151. To obtain a read lock, first create the @file{#cvs.lock}
  1152. directory. This operation must be atomic (which should
  1153. be true for creating a directory under most operating
  1154. systems). If it fails because the directory already
  1155. existed, wait for a while and try again. After
  1156. obtaining the @file{#cvs.lock} lock, create a file
  1157. whose name is @file{#cvs.rfl.} followed by information
  1158. of your choice (for example, hostname and process
  1159. identification number). Then remove the
  1160. @file{#cvs.lock} directory to release the master lock.
  1161. Then proceed with reading the repository. When you are
  1162. done, remove the @file{#cvs.rfl} file to release the
  1163. read lock.
  1164. To obtain a write lock, first create the
  1165. @file{#cvs.lock} directory, as with read locks. Then
  1166. check that there are no files whose names start with
  1167. @file{#cvs.rfl.}. If there are, remove
  1168. @file{#cvs.lock}, wait for a while, and try again. If
  1169. there are no readers, then create a file whose name is
  1170. @file{#cvs.wfl} followed by information of your choice
  1171. (for example, hostname and process identification
  1172. number). Hang on to the @file{#cvs.lock} lock. Proceed
  1173. with writing the repository. When you are done, first
  1174. remove the @file{#cvs.wfl} file and then the
  1175. @file{#cvs.lock} directory. Note that unlike the
  1176. @file{#cvs.rfl} file, the @file{#cvs.wfl} file is just
  1177. informational; it has no effect on the locking operation
  1178. beyond what is provided by holding on to the
  1179. @file{#cvs.lock} lock itself.
  1180. Note that each lock (write lock or read lock) only locks
  1181. a single directory in the repository, including
  1182. @file{Attic} and @file{CVS} but not including
  1183. subdirectories which represent other directories under
  1184. version control. To lock an entire tree, you need to
  1185. lock each directory (note that if you fail to obtain
  1186. any lock you need, you must release the whole tree
  1187. before waiting and trying again, to avoid deadlocks).
  1188. Note also that @sc{cvs} expects write locks to control
  1189. access to individual @file{foo,v} files. @sc{rcs} has
  1190. a scheme where the @file{,foo,} file serves as a lock,
  1191. but @sc{cvs} does not implement it and so taking out a
  1192. @sc{cvs} write lock is recommended. See the comments at
  1193. rcs_internal_lockfile in the @sc{cvs} source code for
  1194. further discussion/rationale.
  1195. @node CVSROOT storage
  1196. @subsection How files are stored in the CVSROOT directory
  1197. @cindex CVSROOT, storage of files
  1198. The @file{$CVSROOT/CVSROOT} directory contains the
  1199. various administrative files. In some ways this
  1200. directory is just like any other directory in the
  1201. repository; it contains @sc{rcs} files whose names end
  1202. in @samp{,v}, and many of the @sc{cvs} commands operate
  1203. on it the same way. However, there are a few
  1204. differences.
  1205. For each administrative file, in addition to the
  1206. @sc{rcs} file, there is also a checked out copy of the
  1207. file. For example, there is an @sc{rcs} file
  1208. @file{loginfo,v} and a file @file{loginfo} which
  1209. contains the latest revision contained in
  1210. @file{loginfo,v}. When you check in an administrative
  1211. file, @sc{cvs} should print
  1212. @example
  1213. cvs commit: Rebuilding administrative file database
  1214. @end example
  1215. @noindent
  1216. and update the checked out copy in
  1217. @file{$CVSROOT/CVSROOT}. If it does not, there is
  1218. something wrong (@pxref{BUGS}). To add your own files
  1219. to the files to be updated in this fashion, you can add
  1220. them to the @file{checkoutlist} administrative file
  1221. (@pxref{checkoutlist}).
  1222. @cindex modules.db
  1223. @cindex modules.pag
  1224. @cindex modules.dir
  1225. By default, the @file{modules} file behaves as
  1226. described above. If the modules file is very large,
  1227. storing it as a flat text file may make looking up
  1228. modules slow (I'm not sure whether this is as much of a
  1229. concern now as when @sc{cvs} first evolved this
  1230. feature; I haven't seen benchmarks). Therefore, by
  1231. making appropriate edits to the @sc{cvs} source code
  1232. one can store the modules file in a database which
  1233. implements the @code{ndbm} interface, such as Berkeley
  1234. db or GDBM. If this option is in use, then the modules
  1235. database will be stored in the files @file{modules.db},
  1236. @file{modules.pag}, and/or @file{modules.dir}.
  1237. @c I think fileattr also will use the database stuff.
  1238. @c Anything else?
  1239. For information on the meaning of the various
  1240. administrative files, see @ref{Administrative files}.
  1241. @node Working directory storage
  1242. @section How data is stored in the working directory
  1243. @c FIXME: Somewhere we should discuss timestamps (test
  1244. @c case "stamps" in sanity.sh). But not here. Maybe
  1245. @c in some kind of "working directory" chapter which
  1246. @c would encompass the "Builds" one? But I'm not sure
  1247. @c whether that is a good organization (is it based on
  1248. @c what the user wants to do?).
  1249. @cindex CVS directory, in working directory
  1250. While we are discussing @sc{cvs} internals which may
  1251. become visible from time to time, we might as well talk
  1252. about what @sc{cvs} puts in the @file{CVS} directories
  1253. in the working directories. As with the repository,
  1254. @sc{cvs} handles this information and one can usually
  1255. access it via @sc{cvs} commands. But in some cases it
  1256. may be useful to look at it, and other programs, such
  1257. as the @code{jCVS} graphical user interface or the
  1258. @code{VC} package for emacs, may need to look at it.
  1259. Such programs should follow the recommendations in this
  1260. section if they hope to be able to work with other
  1261. programs which use those files, including future
  1262. versions of the programs just mentioned and the
  1263. command-line @sc{cvs} client.
  1264. The @file{CVS} directory contains several files.
  1265. Programs which are reading this directory should
  1266. silently ignore files which are in the directory but
  1267. which are not documented here, to allow for future
  1268. expansion.
  1269. The files are stored according to the text file
  1270. convention for the system in question. This means that
  1271. working directories are not portable between systems
  1272. with differing conventions for storing text files.
  1273. This is intentional, on the theory that the files being
  1274. managed by @sc{cvs} probably will not be portable between
  1275. such systems either.
  1276. @table @file
  1277. @item Root
  1278. This file contains the current @sc{cvs} root, as
  1279. described in @ref{Specifying a repository}.
  1280. @cindex Repository file, in CVS directory
  1281. @cindex CVS/Repository file
  1282. @item Repository
  1283. This file contains the directory within the repository
  1284. which the current directory corresponds with. It can
  1285. be either an absolute pathname or a relative pathname;
  1286. @sc{cvs} has had the ability to read either format
  1287. since at least version 1.3 or so. The relative
  1288. pathname is relative to the root, and is the more
  1289. sensible approach, but the absolute pathname is quite
  1290. common and implementations should accept either. For
  1291. example, after the command
  1292. @example
  1293. cvs -d :local:/usr/local/cvsroot checkout yoyodyne/tc
  1294. @end example
  1295. @noindent
  1296. @file{Root} will contain
  1297. @example
  1298. :local:/usr/local/cvsroot
  1299. @end example
  1300. @noindent
  1301. and @file{Repository} will contain either
  1302. @example
  1303. /usr/local/cvsroot/yoyodyne/tc
  1304. @end example
  1305. @noindent
  1306. or
  1307. @example
  1308. yoyodyne/tc
  1309. @end example
  1310. If the particular working directory does not correspond
  1311. to a directory in the repository, then @file{Repository}
  1312. should contain @file{CVSROOT/Emptydir}.
  1313. @cindex Emptydir, in CVSROOT directory
  1314. @cindex CVSROOT/Emptydir directory
  1315. @cindex Entries file, in CVS directory
  1316. @cindex CVS/Entries file
  1317. @item Entries
  1318. This file lists the files and directories in the
  1319. working directory.
  1320. The first character of each line indicates what sort of
  1321. line it is. If the character is unrecognized, programs
  1322. reading the file should silently skip that line, to
  1323. allow for future expansion.
  1324. If the first character is @samp{/}, then the format is:
  1325. @example
  1326. /@var{name}/@var{revision}/@var{timestamp}[+@var{conflict}]/@var{options}/@var{tagdate}
  1327. @end example
  1328. @noindent
  1329. where @samp{[} and @samp{]} are not part of the entry,
  1330. but instead indicate that the @samp{+} and conflict
  1331. marker are optional. @var{name} is the name of the
  1332. file within the directory. @var{revision} is the
  1333. revision that the file in the working derives from, or
  1334. @samp{0} for an added file, or @samp{-} followed by a
  1335. revision for a removed file. @var{timestamp} is the
  1336. timestamp of the file at the time that @sc{cvs} created
  1337. it; if the timestamp differs with the actual
  1338. modification time of the file it means the file has
  1339. been modified. It is stored in
  1340. the format used by the ISO C asctime() function (for
  1341. example, @samp{Sun Apr 7 01:29:26 1996}). One may
  1342. write a string which is not in that format, for
  1343. example, @samp{Result of merge}, to indicate that the
  1344. file should always be considered to be modified. This
  1345. is not a special case; to see whether a file is
  1346. modified a program should take the timestamp of the file
  1347. and simply do a string compare with @var{timestamp}.
  1348. If there was a conflict, @var{conflict} can be set to
  1349. the modification time of the file after the file has been
  1350. written with conflict markers (@pxref{Conflicts example}).
  1351. Thus if @var{conflict} is subsequently the same as the actual
  1352. modification time of the file it means that the user
  1353. has obviously not resolved the conflict. @var{options}
  1354. contains sticky options (for example @samp{-kb} for a
  1355. binary file). @var{tagdate} contains @samp{T} followed
  1356. by a tag name, or @samp{D} for a date, followed by a
  1357. sticky tag or date. Note that if @var{timestamp}
  1358. contains a pair of timestamps separated by a space,
  1359. rather than a single timestamp, you are dealing with a
  1360. version of @sc{cvs} earlier than @sc{cvs} 1.5 (not
  1361. documented here).
  1362. The timezone on the timestamp in CVS/Entries (local or
  1363. universal) should be the same as the operating system
  1364. stores for the timestamp of the file itself. For
  1365. example, on Unix the file's timestamp is in universal
  1366. time (UT), so the timestamp in CVS/Entries should be
  1367. too. On @sc{vms}, the file's timestamp is in local
  1368. time, so @sc{cvs} on @sc{vms} should use local time.
  1369. This rule is so that files do not appear to be modified
  1370. merely because the timezone changed (for example, to or
  1371. from summer time).
  1372. @c See comments and calls to gmtime() and friends in
  1373. @c src/vers_ts.c (function time_stamp).
  1374. If the first character of a line in @file{Entries} is
  1375. @samp{D}, then it indicates a subdirectory. @samp{D}
  1376. on a line all by itself indicates that the program
  1377. which wrote the @file{Entries} file does record
  1378. subdirectories (therefore, if there is such a line and
  1379. no other lines beginning with @samp{D}, one knows there
  1380. are no subdirectories). Otherwise, the line looks
  1381. like:
  1382. @example
  1383. D/@var{name}/@var{filler1}/@var{filler2}/@var{filler3}/@var{filler4}
  1384. @end example
  1385. @noindent
  1386. where @var{name} is the name of the subdirectory, and
  1387. all the @var{filler} fields should be silently ignored,
  1388. for future expansion. Programs which modify
  1389. @code{Entries} files should preserve these fields.
  1390. The lines in the @file{Entries} file can be in any order.
  1391. @cindex Entries.Log file, in CVS directory
  1392. @cindex CVS/Entries.Log file
  1393. @item Entries.Log
  1394. This file does not record any information beyond that
  1395. in @file{Entries}, but it does provide a way to update
  1396. the information without having to rewrite the entire
  1397. @file{Entries} file, including the ability to preserve
  1398. the information even if the program writing
  1399. @file{Entries} and @file{Entries.Log} abruptly aborts.
  1400. Programs which are reading the @file{Entries} file
  1401. should also check for @file{Entries.Log}. If the latter
  1402. exists, they should read @file{Entries} and then apply
  1403. the changes mentioned in @file{Entries.Log}. After
  1404. applying the changes, the recommended practice is to
  1405. rewrite @file{Entries} and then delete @file{Entries.Log}.
  1406. The format of a line in @file{Entries.Log} is a single
  1407. character command followed by a space followed by a
  1408. line in the format specified for a line in
  1409. @file{Entries}. The single character command is
  1410. @samp{A} to indicate that the entry is being added,
  1411. @samp{R} to indicate that the entry is being removed,
  1412. or any other character to indicate that the entire line
  1413. in @file{Entries.Log} should be silently ignored (for
  1414. future expansion). If the second character of the line
  1415. in @file{Entries.Log} is not a space, then it was
  1416. written by an older version of @sc{cvs} (not documented
  1417. here).
  1418. Programs which are writing rather than reading can
  1419. safely ignore @file{Entries.Log} if they so choose.
  1420. @cindex Entries.Backup file, in CVS directory
  1421. @cindex CVS/Entries.Backup file
  1422. @item Entries.Backup
  1423. This is a temporary file. Recommended usage is to
  1424. write a new entries file to @file{Entries.Backup}, and
  1425. then to rename it (atomically, where possible) to @file{Entries}.
  1426. @cindex Entries.Static file, in CVS directory
  1427. @cindex CVS/Entries.Static file
  1428. @item Entries.Static
  1429. The only relevant thing about this file is whether it
  1430. exists or not. If it exists, then it means that only
  1431. part of a directory was gotten and @sc{cvs} will
  1432. not create additional files in that directory. To
  1433. clear it, use the @code{update} command with the
  1434. @samp{-d} option, which will get the additional files
  1435. and remove @file{Entries.Static}.
  1436. @c FIXME: This needs to be better documented, in places
  1437. @c other than Working Directory Storage.
  1438. @c FIXCVS: The fact that this setting exists needs to
  1439. @c be more visible to the user. For example "cvs
  1440. @c status foo", in the case where the file would be
  1441. @c gotten except for Entries.Static, might say
  1442. @c something to distinguish this from other cases.
  1443. @c One thing that periodically gets suggested is to
  1444. @c have "cvs update" print something when it skips
  1445. @c files due to Entries.Static, but IMHO that kind of
  1446. @c noise pretty much makes the Entries.Static feature
  1447. @c useless.
  1448. @cindex Tag file, in CVS directory
  1449. @cindex CVS/Tag file
  1450. @cindex Sticky tags/dates, per-directory
  1451. @cindex Per-directory sticky tags/dates
  1452. @item Tag
  1453. This file contains per-directory sticky tags or dates.
  1454. The first character is @samp{T} for a branch tag,
  1455. @samp{N} for a non-branch tag, or @samp{D} for a date,
  1456. or another character to mean the file should be
  1457. silently ignored, for future expansion. This character
  1458. is followed by the tag or date. Note that
  1459. per-directory sticky tags or dates are used for things
  1460. like applying to files which are newly added; they
  1461. might not be the same as the sticky tags or dates on
  1462. individual files. For general information on sticky
  1463. tags and dates, see @ref{Sticky tags}.
  1464. @c FIXME: This needs to be much better documented,
  1465. @c preferably not in the context of "working directory
  1466. @c storage".
  1467. @c FIXME: The Sticky tags node needs to discuss, or xref to
  1468. @c someplace which discusses, per-directory sticky
  1469. @c tags and the distinction with per-file sticky tags.
  1470. @cindex Notify file, in CVS directory
  1471. @cindex CVS/Notify file
  1472. @item Notify
  1473. This file stores notifications (for example, for
  1474. @code{edit} or @code{unedit}) which have not yet been
  1475. sent to the server. Its format is not yet documented
  1476. here.
  1477. @cindex Notify.tmp file, in CVS directory
  1478. @cindex CVS/Notify.tmp file
  1479. @item Notify.tmp
  1480. This file is to @file{Notify} as @file{Entries.Backup}
  1481. is to @file{Entries}. That is, to write @file{Notify},
  1482. first write the new contents to @file{Notify.tmp} and
  1483. then (atomically where possible), rename it to
  1484. @file{Notify}.
  1485. @cindex Base directory, in CVS directory
  1486. @cindex CVS/Base directory
  1487. @item Base
  1488. If watches are in use, then an @code{edit} command
  1489. stores the original copy of the file in the @file{Base}
  1490. directory. This allows the @code{unedit} command to
  1491. operate even if it is unable to communicate with the
  1492. server.
  1493. @cindex Baserev file, in CVS directory
  1494. @cindex CVS/Baserev file
  1495. @item Baserev
  1496. The file lists the revision for each of the files in
  1497. the @file{Base} directory. The format is:
  1498. @example
  1499. B@var{name}/@var{rev}/@var{expansion}
  1500. @end example
  1501. @noindent
  1502. where @var{expansion} should be ignored, to allow for
  1503. future expansion.
  1504. @cindex Baserev.tmp file, in CVS directory
  1505. @cindex CVS/Baserev.tmp file
  1506. @item Baserev.tmp
  1507. This file is to @file{Baserev} as @file{Entries.Backup}
  1508. is to @file{Entries}. That is, to write @file{Baserev},
  1509. first write the new contents to @file{Baserev.tmp} and
  1510. then (atomically where possible), rename it to
  1511. @file{Baserev}.
  1512. @cindex Template file, in CVS directory
  1513. @cindex CVS/Template file
  1514. @item Template
  1515. This file contains the template specified by the
  1516. @file{rcsinfo} file (@pxref{rcsinfo}). It is only used
  1517. by the client; the non-client/server @sc{cvs} consults
  1518. @file{rcsinfo} directly.
  1519. @end table
  1520. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1521. @node Intro administrative files
  1522. @section The administrative files
  1523. @cindex Administrative files (intro)
  1524. @cindex Modules file
  1525. @cindex CVSROOT, module name
  1526. @cindex Defining modules (intro)
  1527. @c FIXME: this node should be reorganized into "general
  1528. @c information about admin files" and put the "editing
  1529. @c admin files" stuff up front rather than jumping into
  1530. @c the details of modules right away. Then the
  1531. @c Administrative files node can go away, the information
  1532. @c on each admin file distributed to a place appropriate
  1533. @c to its function, and this node can contain a table
  1534. @c listing each file and a @ref to its detailed description.
  1535. The directory @file{$CVSROOT/CVSROOT} contains some @dfn{administrative
  1536. files}. @xref{Administrative files}, for a complete description.
  1537. You can use @sc{cvs} without any of these files, but
  1538. some commands work better when at least the
  1539. @file{modules} file is properly set up.
  1540. The most important of these files is the @file{modules}
  1541. file. It defines all modules in the repository. This
  1542. is a sample @file{modules} file.
  1543. @c FIXME: The CVSROOT line is a goofy example now that
  1544. @c mkmodules doesn't exist.
  1545. @example
  1546. CVSROOT CVSROOT
  1547. modules CVSROOT modules
  1548. cvs gnu/cvs
  1549. rcs gnu/rcs
  1550. diff gnu/diff
  1551. tc yoyodyne/tc
  1552. @end example
  1553. The @file{modules} file is line oriented. In its
  1554. simplest form each line contains the name of the
  1555. module, whitespace, and the directory where the module
  1556. resides. The directory is a path relative to
  1557. @code{$CVSROOT}. The last four lines in the example
  1558. above are examples of such lines.
  1559. @c FIXME: might want to introduce the concept of options in modules file
  1560. @c (the old example which was here, -i mkmodules, is obsolete).
  1561. The line that defines the module called @samp{modules}
  1562. uses features that are not explained here.
  1563. @xref{modules}, for a full explanation of all the
  1564. available features.
  1565. @c FIXME: subsection without node is bogus
  1566. @subsection Editing administrative files
  1567. @cindex Editing administrative files
  1568. @cindex Administrative files, editing them
  1569. You edit the administrative files in the same way that you would edit
  1570. any other module. Use @samp{cvs checkout CVSROOT} to get a working
  1571. copy, edit it, and commit your changes in the normal way.
  1572. It is possible to commit an erroneous administrative
  1573. file. You can often fix the error and check in a new
  1574. revision, but sometimes a particularly bad error in the
  1575. administrative file makes it impossible to commit new
  1576. revisions. If and when this happens, you can correct
  1577. the problem by temporarily copying a corrected administrative file
  1578. directly into the @code{$CVSROOT/CVSROOT} repository directory,
  1579. then committing the same correction via a checkout of the @file{CVSROOT}
  1580. module. It is important that the correction also be made via the
  1581. checked out copy, or the next checkout and commit to the
  1582. <code>CVSROOT</code> module will overwrite the correction that was
  1583. copied directly into the repository, possibly breaking things in such
  1584. a way as to prevent commits again.
  1585. @c @xref{Bad administrative files} for a hint
  1586. @c about how to solve such situations.
  1587. @c -- administrative file checking--
  1588. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1589. @node Multiple repositories
  1590. @section Multiple repositories
  1591. @cindex Multiple repositories
  1592. @cindex Repositories, multiple
  1593. @cindex Many repositories
  1594. @cindex Parallel repositories
  1595. @cindex Disjoint repositories
  1596. @cindex CVSROOT, multiple repositories
  1597. In some situations it is a good idea to have more than
  1598. one repository, for instance if you have two
  1599. development groups that work on separate projects
  1600. without sharing any code. All you have to do to have
  1601. several repositories is to specify the appropriate
  1602. repository, using the @code{CVSROOT} environment
  1603. variable, the @samp{-d} option to @sc{cvs}, or (once
  1604. you have checked out a working directory) by simply
  1605. allowing @sc{cvs} to use the repository that was used
  1606. to check out the working directory
  1607. (@pxref{Specifying a repository}).
  1608. The big advantage of having multiple repositories is
  1609. that they can reside on different servers. With @sc{cvs}
  1610. version 1.10, a single command cannot recurse into
  1611. directories from different repositories. With development
  1612. versions of @sc{cvs}, you can check out code from multiple
  1613. servers into your working directory. @sc{cvs} will
  1614. recurse and handle all the details of making
  1615. connections to as many server machines as necessary to
  1616. perform the requested command. Here is an example of
  1617. how to set up a working directory:
  1618. @example
  1619. cvs -d server1:/cvs co dir1
  1620. cd dir1
  1621. cvs -d server2:/root co sdir
  1622. cvs update
  1623. @end example
  1624. The @code{cvs co} commands set up the working
  1625. directory, and then the @code{cvs update} command will
  1626. contact server2, to update the dir1/sdir subdirectory,
  1627. and server1, to update everything else.
  1628. @c FIXME: Does the FAQ have more about this? I have a
  1629. @c dim recollection, but I'm too lazy to check right now.
  1630. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1631. @node Creating a repository
  1632. @section Creating a repository
  1633. @cindex Repository, setting up
  1634. @cindex Creating a repository
  1635. @cindex Setting up a repository
  1636. This section describes how to set up a @sc{cvs} repository for any
  1637. sort of access method. After completing the setup described in this
  1638. section, you should be able to access your @sc{cvs} repository immediately
  1639. via the local access method and several remote access methods. For
  1640. more information on setting up remote access to the repository you create
  1641. in this section, please read the section on @xref{Remote repositories}.
  1642. To set up a @sc{cvs} repository, first choose the
  1643. machine and disk on which you want to store the
  1644. revision history of the source files. CPU and memory
  1645. requirements are modest, so most machines should be
  1646. adequate. For details see @ref{Server requirements}.
  1647. @c Possible that we should be providing a quick rule of
  1648. @c thumb, like the 32M memory for the server. That
  1649. @c might increase the number of people who are happy
  1650. @c with the answer, without following the xref.
  1651. To estimate disk space
  1652. requirements, if you are importing RCS files from
  1653. another system, the size of those files is the
  1654. approximate initial size of your repository, or if you
  1655. are starting without any version history, a rule of
  1656. thumb is to allow for the server approximately three
  1657. times the size of the code to be under @sc{cvs} for the
  1658. repository (you will eventually outgrow this, but not
  1659. for a while). On the machines on which the developers
  1660. will be working, you'll want disk space for
  1661. approximately one working directory for each developer
  1662. (either the entire tree or a portion of it, depending
  1663. on what each developer uses).
  1664. The repository should be accessible
  1665. (directly or via a networked file system) from all
  1666. machines which want to use @sc{cvs} in server or local
  1667. mode; the client machines need not have any access to
  1668. it other than via the @sc{cvs} protocol. It is not
  1669. possible to use @sc{cvs} to read from a repository
  1670. which one only has read access to; @sc{cvs} needs to be
  1671. able to create lock files (@pxref{Concurrency}).
  1672. @cindex init (subcommand)
  1673. To create a repository, run the @code{cvs init}
  1674. command. It will set up an empty repository in the
  1675. @sc{cvs} root specified in the usual way
  1676. (@pxref{Repository}). For example,
  1677. @example
  1678. cvs -d /usr/local/cvsroot init
  1679. @end example
  1680. @code{cvs init} is careful to never overwrite any
  1681. existing files in the repository, so no harm is done if
  1682. you run @code{cvs init} on an already set-up
  1683. repository.
  1684. @code{cvs init} will enable history logging; if you
  1685. don't want that, remove the history file after running
  1686. @code{cvs init}. @xref{history file}.
  1687. @node Backing up
  1688. @section Backing up a repository
  1689. @cindex Repository, backing up
  1690. @cindex Backing up, repository
  1691. There is nothing particularly magical about the files
  1692. in the repository; for the most part it is possible to
  1693. back them up just like any other files. However, there
  1694. are a few issues to consider.
  1695. @cindex Locks, cvs, and backups
  1696. @cindex #cvs.rfl, and backups
  1697. The first is that to be paranoid, one should either not
  1698. use @sc{cvs} during the backup, or have the backup
  1699. program lock @sc{cvs} while doing the backup. To not
  1700. use @sc{cvs}, you might forbid logins to machines which
  1701. can access the repository, turn off your @sc{cvs}
  1702. server, or similar mechanisms. The details would
  1703. depend on your operating system and how you have
  1704. @sc{cvs} set up. To lock @sc{cvs}, you would create
  1705. @file{#cvs.rfl} locks in each repository directory.
  1706. See @ref{Concurrency}, for more on @sc{cvs} locks.
  1707. Having said all this, if you just back up without any
  1708. of these precautions, the results are unlikely to be
  1709. particularly dire. Restoring from backup, the
  1710. repository might be in an inconsistent state, but this
  1711. would not be particularly hard to fix manually.
  1712. When you restore a repository from backup, assuming
  1713. that changes in the repository were made after the time
  1714. of the backup, working directories which were not
  1715. affected by the failure may refer to revisions which no
  1716. longer exist in the repository. Trying to run @sc{cvs}
  1717. in such directories will typically produce an error
  1718. message. One way to get those changes back into the
  1719. repository is as follows:
  1720. @itemize @bullet
  1721. @item
  1722. Get a new working directory.
  1723. @item
  1724. Copy the files from the working directory from before
  1725. the failure over to the new working directory (do not
  1726. copy the contents of the @file{CVS} directories, of
  1727. course).
  1728. @item
  1729. Working in the new working directory, use commands such
  1730. as @code{cvs update} and @code{cvs diff} to figure out
  1731. what has changed, and then when you are ready, commit
  1732. the changes into the repository.
  1733. @end itemize
  1734. @node Moving a repository
  1735. @section Moving a repository
  1736. @cindex Repository, moving
  1737. @cindex Moving a repository
  1738. @cindex Copying a repository
  1739. Just as backing up the files in the repository is
  1740. pretty much like backing up any other files, if you
  1741. need to move a repository from one place to another it
  1742. is also pretty much like just moving any other
  1743. collection of files.
  1744. The main thing to consider is that working directories
  1745. point to the repository. The simplest way to deal with
  1746. a moved repository is to just get a fresh working
  1747. directory after the move. Of course, you'll want to
  1748. make sure that the old working directory had been
  1749. checked in before the move, or you figured out some
  1750. other way to make sure that you don't lose any
  1751. changes. If you really do want to reuse the existing
  1752. working directory, it should be possible with manual
  1753. surgery on the @file{CVS/Repository} files. You can
  1754. see @ref{Working directory storage}, for information on
  1755. the @file{CVS/Repository} and @file{CVS/Root} files, but
  1756. unless you are sure you want to bother, it probably
  1757. isn't worth it.
  1758. @c FIXME: Surgery on CVS/Repository should be avoided
  1759. @c by making RELATIVE_REPOS the default.
  1760. @c FIXME-maybe: might want some documented way to
  1761. @c change the CVS/Root files in some particular tree.
  1762. @c But then again, I don't know, maybe just having
  1763. @c people do this in perl/shell/&c isn't so bad...
  1764. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1765. @node Remote repositories
  1766. @section Remote repositories
  1767. @cindex Repositories, remote
  1768. @cindex Remote repositories
  1769. @cindex Client/Server Operation
  1770. @cindex Server, CVS
  1771. @cindex Remote repositories, port specification
  1772. @cindex Repositories, remote, port specification
  1773. @cindex Client/Server Operation, port specification
  1774. @cindex pserver (client/server connection method), port specification
  1775. @cindex kserver (client/server connection method), port specification
  1776. @cindex gserver (client/server connection method), port specification
  1777. @cindex port, specifying for remote repositories
  1778. Your working copy of the sources can be on a
  1779. different machine than the repository. Using @sc{cvs}
  1780. in this manner is known as @dfn{client/server}
  1781. operation. You run @sc{cvs} on a machine which can
  1782. mount your working directory, known as the
  1783. @dfn{client}, and tell it to communicate to a machine
  1784. which can mount the repository, known as the
  1785. @dfn{server}. Generally, using a remote
  1786. repository is just like using a local one, except that
  1787. the format of the repository name is:
  1788. @example
  1789. [:@var{method}:][[@var{user}][:@var{password}]@@]@var{hostname}[:[@var{port}]]/path/to/repository
  1790. @end example
  1791. Specifying a password in the repository name is not recommended during
  1792. checkout, since this will cause @sc{cvs} to store a cleartext copy of the
  1793. password in each created directory. @code{cvs login} first instead
  1794. (@pxref{Password authentication client}).
  1795. The details of exactly what needs to be set up depend
  1796. on how you are connecting to the server.
  1797. If @var{method} is not specified, and the repository
  1798. name contains @samp{:}, then the default is @code{ext}
  1799. or @code{server}, depending on your platform; both are
  1800. described in @ref{Connecting via rsh}.
  1801. @c Should we try to explain which platforms are which?
  1802. @c Platforms like unix and VMS, which only allow
  1803. @c privileged programs to bind to sockets <1024 lose on
  1804. @c :server:
  1805. @c Platforms like Mac and VMS, whose rsh program is
  1806. @c unusable or nonexistent, lose on :ext:
  1807. @c Platforms like OS/2 and NT probably could plausibly
  1808. @c default either way (modulo -b troubles).
  1809. @c FIXME: We need to have a better way of explaining
  1810. @c what method to use. This presentation totally
  1811. @c obscures the fact that :ext: and CVS_RSH is the way to
  1812. @c use SSH, for example. Plus it incorrectly implies
  1813. @c that you need an @code{rsh} binary on the client to use
  1814. @c :server:.
  1815. @c Also note that rsh not pserver is the right choice if you want
  1816. @c users to be able to create their own repositories
  1817. @c (because of the --allow-root related issues).
  1818. @menu
  1819. * Server requirements:: Memory and other resources for servers
  1820. * Connecting via rsh:: Using the @code{rsh} program to connect
  1821. * Password authenticated:: Direct connections using passwords
  1822. * GSSAPI authenticated:: Direct connections using GSSAPI
  1823. * Kerberos authenticated:: Direct connections with Kerberos
  1824. * Connecting via fork:: Using a forked @code{cvs server} to connect
  1825. @end menu
  1826. @node Server requirements
  1827. @subsection Server requirements
  1828. The quick answer to what sort of machine is suitable as
  1829. a server is that requirements are modest---a server
  1830. with 32M of memory or even less can handle a fairly
  1831. large source tree with a fair amount of activity.
  1832. @c Say something about CPU speed too? I'm even less sure
  1833. @c what to say on that subject...
  1834. The real answer, of course, is more complicated.
  1835. Estimating the known areas of large memory consumption
  1836. should be sufficient to estimate memory requirements.
  1837. There are two such areas documented here; other memory
  1838. consumption should be small by comparison (if you find
  1839. that is not the case, let us know, as described in
  1840. @ref{BUGS}, so we can update this documentation).
  1841. The first area of big memory consumption is large
  1842. checkouts, when using the @sc{cvs} server. The server
  1843. consists of two processes for each client that it is
  1844. serving. Memory consumption on the child process
  1845. should remain fairly small. Memory consumption on the
  1846. parent process, particularly if the network connection
  1847. to the client is slow, can be expected to grow to
  1848. slightly more than the size of the sources in a single
  1849. directory, or two megabytes, whichever is larger.
  1850. @c "two megabytes" of course is SERVER_HI_WATER. But
  1851. @c we don't mention that here because we are
  1852. @c documenting the default configuration of CVS. If it
  1853. @c is a "standard" thing to change that value, it
  1854. @c should be some kind of run-time configuration.
  1855. @c
  1856. @c See cvsclient.texi for more on the design decision
  1857. @c to not have locks in place while waiting for the
  1858. @c client, which is what results in memory consumption
  1859. @c as high as this.
  1860. Multiplying the size of each @sc{cvs} server by the
  1861. number of servers which you expect to have active at
  1862. one time should give an idea of memory requirements for
  1863. the server. For the most part, the memory consumed by
  1864. the parent process probably can be swap space rather
  1865. than physical memory.
  1866. @c Has anyone verified that notion about swap space?
  1867. @c I say it based pretty much on guessing that the
  1868. @c ->text of the struct buffer_data only gets accessed
  1869. @c in a first in, first out fashion, but I haven't
  1870. @c looked very closely.
  1871. @c What about disk usage in /tmp on the server? I think that
  1872. @c it can be substantial, but I haven't looked at this
  1873. @c again and tried to figure it out ("cvs import" is
  1874. @c probably the worst case...).
  1875. The second area of large memory consumption is
  1876. @code{diff}, when checking in large files. This is
  1877. required even for binary files. The rule of thumb is
  1878. to allow about ten times the size of the largest file
  1879. you will want to check in, although five times may be
  1880. adequate. For example, if you want to check in a file
  1881. which is 10 megabytes, you should have 100 megabytes of
  1882. memory on the machine doing the checkin (the server
  1883. machine for client/server, or the machine running
  1884. @sc{cvs} for non-client/server). This can be swap
  1885. space rather than physical memory. Because the memory
  1886. is only required briefly, there is no particular need
  1887. to allow memory for more than one such checkin at a
  1888. time.
  1889. @c The 5-10 times rule of thumb is from Paul Eggert for
  1890. @c GNU diff. I don't think it is in the GNU diff
  1891. @c manual or anyplace like that.
  1892. @c
  1893. @c Probably we could be saying more about
  1894. @c non-client/server CVS.
  1895. @c I would guess for non-client/server CVS in an NFS
  1896. @c environment the biggest issues are the network and
  1897. @c the NFS server.
  1898. Resource consumption for the client is even more
  1899. modest---any machine with enough capacity to run the
  1900. operating system in question should have little
  1901. trouble.
  1902. @c Is that true? I think the client still wants to
  1903. @c (bogusly) store entire files in memory at times.
  1904. For information on disk space requirements, see
  1905. @ref{Creating a repository}.
  1906. @node Connecting via rsh
  1907. @subsection Connecting with rsh or ssh
  1908. @cindex ssh
  1909. @sc{cvs} may use the @samp{ssh} protocol to perform
  1910. these operations, so the remote user host needs to have
  1911. a either an agent like @code{ssh-agent} to hold
  1912. credentials or a @file{.shosts} file which grants
  1913. access to the local user. Note that the program that
  1914. @sc{cvs} uses for this purpose may be specified using
  1915. the @file{--with-ssh} flag to configure.
  1916. @cindex rsh
  1917. @sc{cvs} uses the @samp{rsh} protocol to perform these
  1918. operations, so the remote user host needs to have a
  1919. @file{.rhosts} file which grants access to the local
  1920. user. Note that the program that @sc{cvs} uses for this
  1921. purpose may be specified using the @file{--with-rsh}
  1922. flag to configure.
  1923. For example, suppose you are the user @samp{mozart} on
  1924. the local machine @samp{toe.example.com}, and the
  1925. server machine is @samp{faun.example.org}. On
  1926. faun, put the following line into the file
  1927. @file{.rhosts} in @samp{bach}'s home directory:
  1928. @example
  1929. toe.example.com mozart
  1930. @end example
  1931. @noindent
  1932. Then test that @samp{rsh} is working with
  1933. @example
  1934. rsh -l bach faun.example.org 'echo $PATH'
  1935. @end example
  1936. @noindent
  1937. To test that @samp{ssh} is working use
  1938. @example
  1939. ssh -l bach faun.example.org 'echo $PATH'
  1940. @end example
  1941. @cindex CVS_SERVER, environment variable
  1942. Next you have to make sure that @code{rsh} will be able
  1943. to find the server. Make sure that the path which
  1944. @code{rsh} printed in the above example includes the
  1945. directory containing a program named @code{cvs} which
  1946. is the server. You need to set the path in
  1947. @file{.bashrc}, @file{.cshrc}, etc., not @file{.login}
  1948. or @file{.profile}. Alternately, you can set the
  1949. environment variable @code{CVS_SERVER} on the client
  1950. machine to the filename of the server you want to use,
  1951. for example @file{/usr/local/bin/cvs-1.6}.
  1952. @c FIXME: there should be a way to specify the
  1953. @c program in CVSROOT, not CVS_SERVER, so that one can use
  1954. @c different ones for different roots. e.g. ":server;cvs=cvs-1.6:"
  1955. @c instead of ":server:".
  1956. There is no need to edit @file{inetd.conf} or start a
  1957. @sc{cvs} server daemon.
  1958. @cindex :server:, setting up
  1959. @cindex :ext:, setting up
  1960. @cindex :extssh:, setting up
  1961. @cindex Kerberos, using kerberized rsh
  1962. @cindex SSH (rsh replacement)
  1963. @cindex rsh replacements (Kerberized, SSH, &c)
  1964. There are three access methods that you use in @code{CVSROOT}
  1965. for rsh or ssh. @code{:server:} specifies an internal rsh
  1966. client, which is supported only by some @sc{cvs} ports.
  1967. @code{:extssh:} specifies an external ssh program. By
  1968. default this is @code{ssh} (unless otherwise specified
  1969. by the @file{--with-ssh} flag to configure) but you may set the
  1970. @code{CVS_SSH} environment variable to invoke another
  1971. program or wrapper script.
  1972. @code{:ext:} specifies an external rsh program. By
  1973. default this is @code{rsh} (unless otherwise specified
  1974. by the @file{--with-rsh} flag to configure) but you may set the
  1975. @code{CVS_RSH} environment variable to invoke another
  1976. program which can access the remote server (for
  1977. example, @code{remsh} on HP-UX 9 because @code{rsh} is
  1978. something different). It must be a program which can
  1979. transmit data to and from the server without modifying
  1980. it; for example the Windows NT @code{rsh} is not
  1981. suitable since it by default translates between CRLF
  1982. and LF. The OS/2 @sc{cvs} port has a hack to pass @samp{-b}
  1983. to @code{rsh} to get around this, but since this could
  1984. potentially cause problems for programs other than the
  1985. standard @code{rsh}, it may change in the future. If
  1986. you set @code{CVS_RSH} to @code{SSH} or some other rsh
  1987. replacement, the instructions in the rest of this
  1988. section concerning @file{.rhosts} and so on are likely
  1989. to be inapplicable; consult the documentation for your rsh
  1990. replacement.
  1991. @c FIXME: there should be a way to specify the
  1992. @c program in CVSROOT, not CVS_RSH, so that one can use
  1993. @c different ones for different roots. e.g.
  1994. @c ":ext;CVS_RSH=remsh:" instead of ":ext:".
  1995. @c See also the comment in src/client.c for rationale
  1996. @c concerning "rsh" being the default and never
  1997. @c "remsh".
  1998. Continuing our example, supposing you want to access
  1999. the module @file{foo} in the repository
  2000. @file{/usr/local/cvsroot/}, on machine
  2001. @file{faun.example.org}, you are ready to go:
  2002. @example
  2003. cvs -d :ext:bach@@faun.example.org:/usr/local/cvsroot checkout foo
  2004. @end example
  2005. @noindent
  2006. (The @file{bach@@} can be omitted if the username is
  2007. the same on both the local and remote hosts.)
  2008. @c Should we mention "rsh host echo hi" and "rsh host
  2009. @c cat" (the latter followed by typing text and ^D)
  2010. @c as troubleshooting techniques? Probably yes
  2011. @c (people tend to have trouble setting this up),
  2012. @c but this kind of thing can be hard to spell out.
  2013. @node Password authenticated
  2014. @subsection Direct connection with password authentication
  2015. The @sc{cvs} client can also connect to the server
  2016. using a password protocol. This is particularly useful
  2017. if using @code{rsh} is not feasible (for example,
  2018. the server is behind a firewall), and Kerberos also is
  2019. not available.
  2020. To use this method, it is necessary to make
  2021. some adjustments on both the server and client sides.
  2022. @menu
  2023. * Password authentication server:: Setting up the server
  2024. * Password authentication client:: Using the client
  2025. * Password authentication security:: What this method does and does not do
  2026. @end menu
  2027. @node Password authentication server
  2028. @subsubsection Setting up the server for password authentication
  2029. First of all, you probably want to tighten the
  2030. permissions on the @file{$CVSROOT} and
  2031. @file{$CVSROOT/CVSROOT} directories. See @ref{Password
  2032. authentication security}, for more details.
  2033. @cindex pserver (subcommand)
  2034. @cindex Remote repositories, port specification
  2035. @cindex Repositories, remote, port specification
  2036. @cindex Client/Server Operation, port specification
  2037. @cindex pserver (client/server connection method), port specification
  2038. @cindex kserver (client/server connection method), port specification
  2039. @cindex gserver (client/server connection method), port specification
  2040. @cindex port, specifying for remote repositories
  2041. @cindex Password server, setting up
  2042. @cindex Authenticating server, setting up
  2043. @cindex inetd, configuring for pserver
  2044. @cindex xinetd, configuring for pserver
  2045. @c FIXME: this isn't quite right regarding port
  2046. @c numbers; CVS looks up "cvspserver" in
  2047. @c /etc/services (on unix, but what about non-unix?).
  2048. On the server side, the file @file{/etc/inetd.conf}
  2049. needs to be edited so @code{inetd} knows to run the
  2050. command @code{cvs pserver} when it receives a
  2051. connection on the right port. By default, the port
  2052. number is 2401; it would be different if your client
  2053. were compiled with @code{CVS_AUTH_PORT} defined to
  2054. something else, though. This can also be specified in the CVSROOT variable
  2055. (@pxref{Remote repositories}) or overridden with the CVS_CLIENT_PORT
  2056. environment variable (@pxref{Environment variables}).
  2057. If your @code{inetd} allows raw port numbers in
  2058. @file{/etc/inetd.conf}, then the following (all on a
  2059. single line in @file{inetd.conf}) should be sufficient:
  2060. @example
  2061. 2401 stream tcp nowait root /usr/local/bin/cvs
  2062. cvs -f --allow-root=/usr/cvsroot pserver
  2063. @end example
  2064. @noindent
  2065. (You could also use the
  2066. @samp{-T} option to specify a temporary directory.)
  2067. The @samp{--allow-root} option specifies the allowable
  2068. @sc{cvsroot} directory. Clients which attempt to use a
  2069. different @sc{cvsroot} directory will not be allowed to
  2070. connect. If there is more than one @sc{cvsroot}
  2071. directory which you want to allow, repeat the option.
  2072. (Unfortunately, many versions of @code{inetd} have very small
  2073. limits on the number of arguments and/or the total length
  2074. of the command. The usual solution to this problem is
  2075. to have @code{inetd} run a shell script which then invokes
  2076. @sc{cvs} with the necessary arguments.)
  2077. If your @code{inetd} wants a symbolic service
  2078. name instead of a raw port number, then put this in
  2079. @file{/etc/services}:
  2080. @example
  2081. cvspserver 2401/tcp
  2082. @end example
  2083. @noindent
  2084. and put @code{cvspserver} instead of @code{2401} in @file{inetd.conf}.
  2085. If your system uses @code{xinetd} instead of @code{inetd},
  2086. the procedure is slightly different.
  2087. Create a file called @file{/etc/xinetd.d/cvspserver} containing the following:
  2088. @example
  2089. service cvspserver
  2090. @{
  2091. port = 2401
  2092. socket_type = stream
  2093. protocol = tcp
  2094. wait = no
  2095. user = root
  2096. passenv = PATH
  2097. server = /usr/local/bin/cvs
  2098. server_args = -f --allow-root=/usr/cvsroot pserver
  2099. @}
  2100. @end example
  2101. @noindent
  2102. (If @code{cvspserver} is defined in @file{/etc/services}, you can omit
  2103. the @code{port} line.)
  2104. Once the above is taken care of, restart your
  2105. @code{inetd}, or do whatever is necessary to force it
  2106. to reread its initialization files.
  2107. If you are having trouble setting this up, see
  2108. @ref{Connection}.
  2109. @cindex CVS passwd file
  2110. @cindex passwd (admin file)
  2111. Because the client stores and transmits passwords in
  2112. cleartext (almost---see @ref{Password authentication
  2113. security}, for details), a separate @sc{cvs} password
  2114. file is generally used, so people don't compromise
  2115. their regular passwords when they access the
  2116. repository. This file is
  2117. @file{$CVSROOT/CVSROOT/passwd} (@pxref{Intro
  2118. administrative files}). It uses a colon-separated
  2119. format, similar to @file{/etc/passwd} on Unix systems,
  2120. except that it has fewer fields: @sc{cvs} username,
  2121. optional password, and an optional system username for
  2122. @sc{cvs} to run as if authentication succeeds. Here is
  2123. an example @file{passwd} file with five entries:
  2124. @example
  2125. anonymous:
  2126. bach:ULtgRLXo7NRxs
  2127. spwang:1sOp854gDF3DY
  2128. melissa:tGX1fS8sun6rY:pubcvs
  2129. qproj:XR4EZcEs0szik:pubcvs
  2130. @end example
  2131. @noindent
  2132. (The passwords are encrypted according to the standard
  2133. Unix @code{crypt()} function, so it is possible to
  2134. paste in passwords directly from regular Unix
  2135. @file{/etc/passwd} files.)
  2136. The first line in the example will grant access to any
  2137. @sc{cvs} client attempting to authenticate as user
  2138. @code{anonymous}, no matter what password they use,
  2139. including an empty password. (This is typical for
  2140. sites granting anonymous read-only access; for
  2141. information on how to do the "read-only" part, see
  2142. @ref{Read-only access}.)
  2143. The second and third lines will grant access to
  2144. @code{bach} and @code{spwang} if they supply their
  2145. respective plaintext passwords.
  2146. @cindex User aliases
  2147. The fourth line will grant access to @code{melissa}, if
  2148. she supplies the correct password, but her @sc{cvs}
  2149. operations will actually run on the server side under
  2150. the system user @code{pubcvs}. Thus, there need not be
  2151. any system user named @code{melissa}, but there
  2152. @emph{must} be one named @code{pubcvs}.
  2153. The fifth line shows that system user identities can be
  2154. shared: any client who successfully authenticates as
  2155. @code{qproj} will actually run as @code{pubcvs}, just
  2156. as @code{melissa} does. That way you could create a
  2157. single, shared system user for each project in your
  2158. repository, and give each developer their own line in
  2159. the @file{$CVSROOT/CVSROOT/passwd} file. The @sc{cvs}
  2160. username on each line would be different, but the
  2161. system username would be the same. The reason to have
  2162. different @sc{cvs} usernames is that @sc{cvs} will log their
  2163. actions under those names: when @code{melissa} commits
  2164. a change to a project, the checkin is recorded in the
  2165. project's history under the name @code{melissa}, not
  2166. @code{pubcvs}. And the reason to have them share a
  2167. system username is so that you can arrange permissions
  2168. in the relevant area of the repository such that only
  2169. that account has write-permission there.
  2170. If the system-user field is present, all
  2171. password-authenticated @sc{cvs} commands run as that
  2172. user; if no system user is specified, @sc{cvs} simply
  2173. takes the @sc{cvs} username as the system username and
  2174. runs commands as that user. In either case, if there
  2175. is no such user on the system, then the @sc{cvs}
  2176. operation will fail (regardless of whether the client
  2177. supplied a valid password).
  2178. The password and system-user fields can both be omitted
  2179. (and if the system-user field is omitted, then also
  2180. omit the colon that would have separated it from the
  2181. encrypted password). For example, this would be a
  2182. valid @file{$CVSROOT/CVSROOT/passwd} file:
  2183. @example
  2184. anonymous::pubcvs
  2185. fish:rKa5jzULzmhOo:kfogel
  2186. sussman:1sOp854gDF3DY
  2187. @end example
  2188. @noindent
  2189. When the password field is omitted or empty, then the
  2190. client's authentication attempt will succeed with any
  2191. password, including the empty string. However, the
  2192. colon after the @sc{cvs} username is always necessary,
  2193. even if the password is empty.
  2194. @sc{cvs} can also fall back to use system authentication.
  2195. When authenticating a password, the server first checks
  2196. for the user in the @file{$CVSROOT/CVSROOT/passwd}
  2197. file. If it finds the user, it will use that entry for
  2198. authentication as described above. But if it does not
  2199. find the user, or if the @sc{cvs} @file{passwd} file
  2200. does not exist, then the server can try to authenticate
  2201. the username and password using the operating system's
  2202. user-lookup routines (this "fallback" behavior can be
  2203. disabled by setting @code{SystemAuth=no} in the
  2204. @sc{cvs} @file{config} file, @pxref{config}). Be
  2205. aware, however, that falling back to system
  2206. authentication might be a security risk: @sc{cvs}
  2207. operations would then be authenticated with that user's
  2208. regular login password, and the password flies across
  2209. the network in plaintext. See @ref{Password
  2210. authentication security} for more on this.
  2211. Right now, the only way to put a password in the
  2212. @sc{cvs} @file{passwd} file is to paste it there from
  2213. somewhere else. Someday, there may be a @code{cvs
  2214. passwd} command.
  2215. Unlike many of the files in @file{$CVSROOT/CVSROOT}, it
  2216. is normal to edit the @file{passwd} file in-place,
  2217. rather than via @sc{cvs}. This is because of the
  2218. possible security risks of having the @file{passwd}
  2219. file checked out to people's working copies. If you do
  2220. want to include the @file{passwd} file in checkouts of
  2221. @file{$CVSROOT/CVSROOT}, see @ref{checkoutlist}.
  2222. @c We might also suggest using the @code{htpasswd} command
  2223. @c from freely available web servers as well, but that
  2224. @c would open up a can of worms in that the users next
  2225. @c questions are likely to be "where do I get it?" and
  2226. @c "how do I use it?"
  2227. @c Also note that htpasswd, at least the version I had,
  2228. @c likes to clobber the third field.
  2229. @node Password authentication client
  2230. @subsubsection Using the client with password authentication
  2231. @cindex Login (subcommand)
  2232. @cindex Password client, using
  2233. @cindex Authenticated client, using
  2234. @cindex :pserver:, setting up
  2235. To run a @sc{cvs} command on a remote repository via
  2236. the password-authenticating server, one specifies the
  2237. @code{pserver} protocol, optional username, repository host, an
  2238. optional port number, and path to the repository. For example:
  2239. @example
  2240. cvs -d :pserver:faun.example.org:/usr/local/cvsroot checkout someproj
  2241. @end example
  2242. @noindent
  2243. or
  2244. @example
  2245. CVSROOT=:pserver:bach@@faun.example.org:2401/usr/local/cvsroot
  2246. cvs checkout someproj
  2247. @end example
  2248. However, unless you're connecting to a public-access
  2249. repository (i.e., one where that username doesn't
  2250. require a password), you'll need to supply a password or @dfn{log in} first.
  2251. Logging in verifies your password with the repository and stores it in a file.
  2252. It's done with the @code{login} command, which will
  2253. prompt you interactively for the password if you didn't supply one as part of
  2254. @var{$CVSROOT}:
  2255. @example
  2256. cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot login
  2257. CVS password:
  2258. @end example
  2259. @noindent
  2260. or
  2261. @example
  2262. cvs -d :pserver:bach:p4ss30rd@@faun.example.org:/usr/local/cvsroot login
  2263. @end example
  2264. After you enter the password, @sc{cvs} verifies it with
  2265. the server. If the verification succeeds, then that
  2266. combination of username, host, repository, and password
  2267. is permanently recorded, so future transactions with
  2268. that repository won't require you to run @code{cvs
  2269. login}. (If verification fails, @sc{cvs} will exit
  2270. complaining that the password was incorrect, and
  2271. nothing will be recorded.)
  2272. The records are stored, by default, in the file
  2273. @file{$HOME/.cvspass}. That file's format is
  2274. human-readable, and to a degree human-editable, but
  2275. note that the passwords are not stored in
  2276. cleartext---they are trivially encoded to protect them
  2277. from "innocent" compromise (i.e., inadvertent viewing
  2278. by a system administrator or other non-malicious
  2279. person).
  2280. @cindex CVS_PASSFILE, environment variable
  2281. You can change the default location of this file by
  2282. setting the @code{CVS_PASSFILE} environment variable.
  2283. If you use this variable, make sure you set it
  2284. @emph{before} @code{cvs login} is run. If you were to
  2285. set it after running @code{cvs login}, then later
  2286. @sc{cvs} commands would be unable to look up the
  2287. password for transmission to the server.
  2288. Once you have logged in, all @sc{cvs} commands using
  2289. that remote repository and username will authenticate
  2290. with the stored password. So, for example
  2291. @example
  2292. cvs -d :pserver:bach@@faun.example.org:/usr/local/cvsroot checkout foo
  2293. @end example
  2294. @noindent
  2295. should just work (unless the password changes on the
  2296. server side, in which case you'll have to re-run
  2297. @code{cvs login}).
  2298. Note that if the @samp{:pserver:} were not present in
  2299. the repository specification, @sc{cvs} would assume it
  2300. should use @code{rsh} to connect with the server
  2301. instead (@pxref{Connecting via rsh}).
  2302. Of course, once you have a working copy checked out and
  2303. are running @sc{cvs} commands from within it, there is
  2304. no longer any need to specify the repository
  2305. explicitly, because @sc{cvs} can deduce the repository
  2306. from the working copy's @file{CVS} subdirectory.
  2307. @c FIXME: seems to me this needs somewhat more
  2308. @c explanation.
  2309. @cindex Logout (subcommand)
  2310. The password for a given remote repository can be
  2311. removed from the @code{CVS_PASSFILE} by using the
  2312. @code{cvs logout} command.
  2313. @node Password authentication security
  2314. @subsubsection Security considerations with password authentication
  2315. @cindex Security, of pserver
  2316. The passwords are stored on the client side in a
  2317. trivial encoding of the cleartext, and transmitted in
  2318. the same encoding. The encoding is done only to
  2319. prevent inadvertent password compromises (i.e., a
  2320. system administrator accidentally looking at the file),
  2321. and will not prevent even a naive attacker from gaining
  2322. the password.
  2323. @c FIXME: The bit about "access to the repository
  2324. @c implies general access to the system is *not* specific
  2325. @c to pserver; it applies to kerberos and SSH and
  2326. @c everything else too. Should reorganize the
  2327. @c documentation to make this clear.
  2328. The separate @sc{cvs} password file (@pxref{Password
  2329. authentication server}) allows people
  2330. to use a different password for repository access than
  2331. for login access. On the other hand, once a user has
  2332. non-read-only
  2333. access to the repository, she can execute programs on
  2334. the server system through a variety of means. Thus, repository
  2335. access implies fairly broad system access as well. It
  2336. might be possible to modify @sc{cvs} to prevent that,
  2337. but no one has done so as of this writing.
  2338. @c OpenBSD uses chroot() and copies the repository to
  2339. @c provide anonymous read-only access (for details see
  2340. @c http://www.openbsd.org/anoncvs.shar). While this
  2341. @c closes the most obvious holes, I'm not sure it
  2342. @c closes enough holes to recommend it (plus it is
  2343. @c *very* easy to accidentally screw up a setup of this
  2344. @c type).
  2345. Note that because the @file{$CVSROOT/CVSROOT} directory
  2346. contains @file{passwd} and other files which are used
  2347. to check security, you must control the permissions on
  2348. this directory as tightly as the permissions on
  2349. @file{/etc}. The same applies to the @file{$CVSROOT}
  2350. directory itself and any directory
  2351. above it in the tree. Anyone who has write access to
  2352. such a directory will have the ability to become any
  2353. user on the system. Note that these permissions are
  2354. typically tighter than you would use if you are not
  2355. using pserver.
  2356. @c TODO: Would be really nice to document/implement a
  2357. @c scheme where the CVS server can run as some non-root
  2358. @c user, e.g. "cvs". CVSROOT/passwd would contain a
  2359. @c bunch of entries of the form foo:xxx:cvs (or the "cvs"
  2360. @c would be implicit). This would greatly reduce
  2361. @c security risks such as those hinted at in the
  2362. @c previous paragraph. I think minor changes to CVS
  2363. @c might be required but mostly this would just need
  2364. @c someone who wants to play with it, document it, &c.
  2365. In summary, anyone who gets the password gets
  2366. repository access (which may imply some measure of general system
  2367. access as well). The password is available to anyone
  2368. who can sniff network packets or read a protected
  2369. (i.e., user read-only) file. If you want real
  2370. security, get Kerberos.
  2371. @node GSSAPI authenticated
  2372. @subsection Direct connection with GSSAPI
  2373. @cindex GSSAPI
  2374. @cindex Security, GSSAPI
  2375. @cindex :gserver:, setting up
  2376. @cindex Kerberos, using :gserver:
  2377. GSSAPI is a generic interface to network security
  2378. systems such as Kerberos 5.
  2379. If you have a working GSSAPI library, you can have
  2380. @sc{cvs} connect via a direct @sc{tcp} connection,
  2381. authenticating with GSSAPI.
  2382. To do this, @sc{cvs} needs to be compiled with GSSAPI
  2383. support; when configuring @sc{cvs} it tries to detect
  2384. whether GSSAPI libraries using Kerberos version 5 are
  2385. present. You can also use the @file{--with-gssapi}
  2386. flag to configure.
  2387. The connection is authenticated using GSSAPI, but the
  2388. message stream is @emph{not} authenticated by default.
  2389. You must use the @code{-a} global option to request
  2390. stream authentication.
  2391. The data transmitted is @emph{not} encrypted by
  2392. default. Encryption support must be compiled into both
  2393. the client and the server; use the
  2394. @file{--enable-encrypt} configure option to turn it on.
  2395. You must then use the @code{-x} global option to
  2396. request encryption.
  2397. GSSAPI connections are handled on the server side by
  2398. the same server which handles the password
  2399. authentication server; see @ref{Password authentication
  2400. server}. If you are using a GSSAPI mechanism such as
  2401. Kerberos which provides for strong authentication, you
  2402. will probably want to disable the ability to
  2403. authenticate via cleartext passwords. To do so, create
  2404. an empty @file{CVSROOT/passwd} password file, and set
  2405. @code{SystemAuth=no} in the config file
  2406. (@pxref{config}).
  2407. The GSSAPI server uses a principal name of
  2408. cvs/@var{hostname}, where @var{hostname} is the
  2409. canonical name of the server host. You will have to
  2410. set this up as required by your GSSAPI mechanism.
  2411. To connect using GSSAPI, use the @samp{:gserver:} method. For
  2412. example,
  2413. @example
  2414. cvs -d :gserver:faun.example.org:/usr/local/cvsroot checkout foo
  2415. @end example
  2416. @node Kerberos authenticated
  2417. @subsection Direct connection with Kerberos
  2418. @cindex Kerberos, using :kserver:
  2419. @cindex Security, Kerberos
  2420. @cindex :kserver:, setting up
  2421. The easiest way to use Kerberos is to use the Kerberos
  2422. @code{rsh}, as described in @ref{Connecting via rsh}.
  2423. The main disadvantage of using rsh is that all the data
  2424. needs to pass through additional programs, so it may be
  2425. slower. So if you have Kerberos installed you can
  2426. connect via a direct @sc{tcp} connection,
  2427. authenticating with Kerberos.
  2428. This section concerns the Kerberos network security
  2429. system, version 4. Kerberos version 5 is supported via
  2430. the GSSAPI generic network security interface, as
  2431. described in the previous section.
  2432. To do this, @sc{cvs} needs to be compiled with Kerberos
  2433. support; when configuring @sc{cvs} it tries to detect
  2434. whether Kerberos is present or you can use the
  2435. @file{--with-krb4} flag to configure.
  2436. The data transmitted is @emph{not} encrypted by
  2437. default. Encryption support must be compiled into both
  2438. the client and server; use the
  2439. @file{--enable-encryption} configure option to turn it
  2440. on. You must then use the @code{-x} global option to
  2441. request encryption.
  2442. @cindex CVS_CLIENT_PORT
  2443. You need to edit @file{inetd.conf} on the server
  2444. machine to run @code{cvs kserver}. The client uses
  2445. port 1999 by default; if you want to use another port
  2446. specify it in the @code{CVSROOT} (@pxref{Remote repositories})
  2447. or the @code{CVS_CLIENT_PORT} environment variable
  2448. (@pxref{Environment variables}) on the client.
  2449. @cindex kinit
  2450. When you want to use @sc{cvs}, get a ticket in the
  2451. usual way (generally @code{kinit}); it must be a ticket
  2452. which allows you to log into the server machine. Then
  2453. you are ready to go:
  2454. @example
  2455. cvs -d :kserver:faun.example.org:/usr/local/cvsroot checkout foo
  2456. @end example
  2457. Previous versions of @sc{cvs} would fall back to a
  2458. connection via rsh; this version will not do so.
  2459. @node Connecting via fork
  2460. @subsection Connecting with fork
  2461. @cindex fork, access method
  2462. @cindex :fork:, setting up
  2463. This access method allows you to connect to a
  2464. repository on your local disk via the remote protocol.
  2465. In other words it does pretty much the same thing as
  2466. @code{:local:}, but various quirks, bugs and the like are
  2467. those of the remote @sc{cvs} rather than the local
  2468. @sc{cvs}.
  2469. For day-to-day operations you might prefer either
  2470. @code{:local:} or @code{:fork:}, depending on your
  2471. preferences. Of course @code{:fork:} comes in
  2472. particularly handy in testing or
  2473. debugging @code{cvs} and the remote protocol.
  2474. Specifically, we avoid all of the network-related
  2475. setup/configuration, timeouts, and authentication
  2476. inherent in the other remote access methods but still
  2477. create a connection which uses the remote protocol.
  2478. To connect using the @code{fork} method, use
  2479. @samp{:fork:} and the pathname to your local
  2480. repository. For example:
  2481. @example
  2482. cvs -d :fork:/usr/local/cvsroot checkout foo
  2483. @end example
  2484. @cindex CVS_SERVER, and :fork:
  2485. As with @code{:ext:}, the server is called @samp{cvs}
  2486. by default, or the value of the @code{CVS_SERVER}
  2487. environment variable.
  2488. @c ---------------------------------------------------------------------
  2489. @node Read-only access
  2490. @section Read-only repository access
  2491. @cindex Read-only repository access
  2492. @cindex readers (admin file)
  2493. @cindex writers (admin file)
  2494. It is possible to grant read-only repository
  2495. access to people using the password-authenticated
  2496. server (@pxref{Password authenticated}). (The
  2497. other access methods do not have explicit support for
  2498. read-only users because those methods all assume login
  2499. access to the repository machine anyway, and therefore
  2500. the user can do whatever local file permissions allow
  2501. her to do.)
  2502. A user who has read-only access can do only
  2503. those @sc{cvs} operations which do not modify the
  2504. repository, except for certain ``administrative'' files
  2505. (such as lock files and the history file). It may be
  2506. desirable to use this feature in conjunction with
  2507. user-aliasing (@pxref{Password authentication server}).
  2508. Unlike with previous versions of @sc{cvs}, read-only
  2509. users should be able merely to read the repository, and
  2510. not to execute programs on the server or otherwise gain
  2511. unexpected levels of access. Or to be more accurate,
  2512. the @emph{known} holes have been plugged. Because this
  2513. feature is new and has not received a comprehensive
  2514. security audit, you should use whatever level of
  2515. caution seems warranted given your attitude concerning
  2516. security.
  2517. There are two ways to specify read-only access
  2518. for a user: by inclusion, and by exclusion.
  2519. "Inclusion" means listing that user
  2520. specifically in the @file{$CVSROOT/CVSROOT/readers}
  2521. file, which is simply a newline-separated list of
  2522. users. Here is a sample @file{readers} file:
  2523. @example
  2524. melissa
  2525. splotnik
  2526. jrandom
  2527. @end example
  2528. @noindent
  2529. (Don't forget the newline after the last user.)
  2530. "Exclusion" means explicitly listing everyone
  2531. who has @emph{write} access---if the file
  2532. @example
  2533. $CVSROOT/CVSROOT/writers
  2534. @end example
  2535. @noindent
  2536. exists, then only
  2537. those users listed in it have write access, and
  2538. everyone else has read-only access (of course, even the
  2539. read-only users still need to be listed in the
  2540. @sc{cvs} @file{passwd} file). The
  2541. @file{writers} file has the same format as the
  2542. @file{readers} file.
  2543. Note: if your @sc{cvs} @file{passwd}
  2544. file maps cvs users onto system users (@pxref{Password
  2545. authentication server}), make sure you deny or grant
  2546. read-only access using the @emph{cvs} usernames, not
  2547. the system usernames. That is, the @file{readers} and
  2548. @file{writers} files contain cvs usernames, which may
  2549. or may not be the same as system usernames.
  2550. Here is a complete description of the server's
  2551. behavior in deciding whether to grant read-only or
  2552. read-write access:
  2553. If @file{readers} exists, and this user is
  2554. listed in it, then she gets read-only access. Or if
  2555. @file{writers} exists, and this user is NOT listed in
  2556. it, then she also gets read-only access (this is true
  2557. even if @file{readers} exists but she is not listed
  2558. there). Otherwise, she gets full read-write access.
  2559. Of course there is a conflict if the user is
  2560. listed in both files. This is resolved in the more
  2561. conservative way, it being better to protect the
  2562. repository too much than too little: such a user gets
  2563. read-only access.
  2564. @node Server temporary directory
  2565. @section Temporary directories for the server
  2566. @cindex Temporary directories, and server
  2567. @cindex Server, temporary directories
  2568. While running, the @sc{cvs} server creates temporary
  2569. directories. They are named
  2570. @example
  2571. cvs-serv@var{pid}
  2572. @end example
  2573. @noindent
  2574. where @var{pid} is the process identification number of
  2575. the server.
  2576. They are located in the directory specified by
  2577. the @samp{-T} global option (@pxref{Global options}),
  2578. the @code{TMPDIR} environment variable (@pxref{Environment variables}),
  2579. or, failing that, @file{/tmp}.
  2580. In most cases the server will remove the temporary
  2581. directory when it is done, whether it finishes normally
  2582. or abnormally. However, there are a few cases in which
  2583. the server does not or cannot remove the temporary
  2584. directory, for example:
  2585. @itemize @bullet
  2586. @item
  2587. If the server aborts due to an internal server error,
  2588. it may preserve the directory to aid in debugging
  2589. @item
  2590. If the server is killed in a way that it has no way of
  2591. cleaning up (most notably, @samp{kill -KILL} on unix).
  2592. @item
  2593. If the system shuts down without an orderly shutdown,
  2594. which tells the server to clean up.
  2595. @end itemize
  2596. In cases such as this, you will need to manually remove
  2597. the @file{cvs-serv@var{pid}} directories. As long as
  2598. there is no server running with process identification
  2599. number @var{pid}, it is safe to do so.
  2600. @c ---------------------------------------------------------------------
  2601. @node Starting a new project
  2602. @chapter Starting a project with CVS
  2603. @cindex Starting a project with CVS
  2604. @cindex Creating a project
  2605. @comment --moduledb--
  2606. Because renaming files and moving them between
  2607. directories is somewhat inconvenient, the first thing
  2608. you do when you start a new project should be to think
  2609. through your file organization. It is not impossible
  2610. to rename or move files, but it does increase the
  2611. potential for confusion and @sc{cvs} does have some
  2612. quirks particularly in the area of renaming
  2613. directories. @xref{Moving files}.
  2614. What to do next depends on the situation at hand.
  2615. @menu
  2616. * Setting up the files:: Getting the files into the repository
  2617. * Defining the module:: How to make a module of the files
  2618. @end menu
  2619. @c -- File permissions!
  2620. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2621. @node Setting up the files
  2622. @section Setting up the files
  2623. The first step is to create the files inside the repository. This can
  2624. be done in a couple of different ways.
  2625. @c -- The contributed scripts
  2626. @menu
  2627. * From files:: This method is useful with old projects
  2628. where files already exists.
  2629. * From other version control systems:: Old projects where you want to
  2630. preserve history from another system.
  2631. * From scratch:: Creating a directory tree from scratch.
  2632. @end menu
  2633. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  2634. @node From files
  2635. @subsection Creating a directory tree from a number of files
  2636. @cindex Importing files
  2637. When you begin using @sc{cvs}, you will probably already have several
  2638. projects that can be
  2639. put under @sc{cvs} control. In these cases the easiest way is to use the
  2640. @code{import} command. An example is probably the easiest way to
  2641. explain how to use it. If the files you want to install in
  2642. @sc{cvs} reside in @file{@var{wdir}}, and you want them to appear in the
  2643. repository as @file{$CVSROOT/yoyodyne/@var{rdir}}, you can do this:
  2644. @example
  2645. $ cd @var{wdir}
  2646. $ cvs import -m "Imported sources" yoyodyne/@var{rdir} yoyo start
  2647. @end example
  2648. Unless you supply a log message with the @samp{-m}
  2649. flag, @sc{cvs} starts an editor and prompts for a
  2650. message. The string @samp{yoyo} is a @dfn{vendor tag},
  2651. and @samp{start} is a @dfn{release tag}. They may fill
  2652. no purpose in this context, but since @sc{cvs} requires
  2653. them they must be present. @xref{Tracking sources}, for
  2654. more information about them.
  2655. You can now verify that it worked, and remove your
  2656. original source directory.
  2657. @c FIXME: Need to say more about "verify that it
  2658. @c worked". What should the user look for in the output
  2659. @c from "diff -r"?
  2660. @example
  2661. $ cd ..
  2662. $ cvs checkout yoyodyne/@var{rdir} # @r{Explanation below}
  2663. $ diff -r @var{wdir} yoyodyne/@var{rdir}
  2664. $ rm -r @var{wdir}
  2665. @end example
  2666. @noindent
  2667. Erasing the original sources is a good idea, to make sure that you do
  2668. not accidentally edit them in @var{wdir}, bypassing @sc{cvs}.
  2669. Of course, it would be wise to make sure that you have
  2670. a backup of the sources before you remove them.
  2671. The @code{checkout} command can either take a module
  2672. name as argument (as it has done in all previous
  2673. examples) or a path name relative to @code{$CVSROOT},
  2674. as it did in the example above.
  2675. It is a good idea to check that the permissions
  2676. @sc{cvs} sets on the directories inside @code{$CVSROOT}
  2677. are reasonable, and that they belong to the proper
  2678. groups. @xref{File permissions}.
  2679. If some of the files you want to import are binary, you
  2680. may want to use the wrappers features to specify which
  2681. files are binary and which are not. @xref{Wrappers}.
  2682. @c The node name is too long, but I am having trouble
  2683. @c thinking of something more concise.
  2684. @node From other version control systems
  2685. @subsection Creating Files From Other Version Control Systems
  2686. @cindex Importing files, from other version control systems
  2687. If you have a project which you are maintaining with
  2688. another version control system, such as @sc{rcs}, you
  2689. may wish to put the files from that project into
  2690. @sc{cvs}, and preserve the revision history of the
  2691. files.
  2692. @table @asis
  2693. @cindex RCS, importing files from
  2694. @item From RCS
  2695. If you have been using @sc{rcs}, find the @sc{rcs}
  2696. files---usually a file named @file{foo.c} will have its
  2697. @sc{rcs} file in @file{RCS/foo.c,v} (but it could be
  2698. other places; consult the @sc{rcs} documentation for
  2699. details). Then create the appropriate directories in
  2700. @sc{cvs} if they do not already exist. Then copy the
  2701. files into the appropriate directories in the @sc{cvs}
  2702. repository (the name in the repository must be the name
  2703. of the source file with @samp{,v} added; the files go
  2704. directly in the appropriate directory of the repository,
  2705. not in an @file{RCS} subdirectory). This is one of the
  2706. few times when it is a good idea to access the @sc{cvs}
  2707. repository directly, rather than using @sc{cvs}
  2708. commands. Then you are ready to check out a new
  2709. working directory.
  2710. @c Someday there probably should be a "cvs import -t
  2711. @c rcs" or some such. It could even create magic
  2712. @c branches. It could also do something about the case
  2713. @c where the RCS file had a (non-magic) "0" branch.
  2714. The @sc{rcs} file should not be locked when you move it
  2715. into @sc{cvs}; if it is, @sc{cvs} will have trouble
  2716. letting you operate on it.
  2717. @c What is the easiest way to unlock your files if you
  2718. @c have them locked? Especially if you have a lot of them?
  2719. @c This is a CVS bug/misfeature; importing RCS files
  2720. @c should ignore whether they are locked and leave them in
  2721. @c an unlocked state. Yet another reason for a separate
  2722. @c "import RCS file" command.
  2723. @c How many is "many"? Or do they just import RCS files?
  2724. @item From another version control system
  2725. Many version control systems have the ability to export
  2726. @sc{rcs} files in the standard format. If yours does,
  2727. export the @sc{rcs} files and then follow the above
  2728. instructions.
  2729. Failing that, probably your best bet is to write a
  2730. script that will check out the files one revision at a
  2731. time using the command line interface to the other
  2732. system, and then check the revisions into @sc{cvs}.
  2733. The @file{sccs2rcs} script mentioned below may be a
  2734. useful example to follow.
  2735. @cindex SCCS, importing files from
  2736. @item From SCCS
  2737. There is a script in the @file{contrib} directory of
  2738. the @sc{cvs} source distribution called @file{sccs2rcs}
  2739. which converts @sc{sccs} files to @sc{rcs} files.
  2740. Note: you must run it on a machine which has both
  2741. @sc{sccs} and @sc{rcs} installed, and like everything
  2742. else in contrib it is unsupported (your mileage may
  2743. vary).
  2744. @cindex PVCS, importing files from
  2745. @item From PVCS
  2746. There is a script in the @file{contrib} directory of
  2747. the @sc{cvs} source distribution called @file{pvcs_to_rcs}
  2748. which converts @sc{pvcs} archives to @sc{rcs} files.
  2749. You must run it on a machine which has both
  2750. @sc{pvcs} and @sc{rcs} installed, and like everything
  2751. else in contrib it is unsupported (your mileage may
  2752. vary). See the comments in the script for details.
  2753. @end table
  2754. @c CMZ and/or PATCHY were systems that were used in the
  2755. @c high energy physics community (especially for
  2756. @c CERNLIB). CERN has replaced them with CVS, but the
  2757. @c CAR format seems to live on as a way to submit
  2758. @c changes. There is a program car2cvs which converts
  2759. @c but I'm not sure where one gets a copy.
  2760. @c Not sure it is worth mentioning here, since it would
  2761. @c appear to affect only one particular community.
  2762. @c Best page for more information is:
  2763. @c http://wwwcn1.cern.ch/asd/cvs/index.html
  2764. @c See also:
  2765. @c http://ecponion.cern.ch/ecpsa/cernlib.html
  2766. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  2767. @node From scratch
  2768. @subsection Creating a directory tree from scratch
  2769. @c Also/instead should be documenting
  2770. @c $ cvs co -l .
  2771. @c $ mkdir tc
  2772. @c $ cvs add tc
  2773. @c $ cd tc
  2774. @c $ mkdir man
  2775. @c $ cvs add man
  2776. @c etc.
  2777. @c Using import to create the directories only is
  2778. @c probably a somewhat confusing concept.
  2779. For a new project, the easiest thing to do is probably
  2780. to create an empty directory structure, like this:
  2781. @example
  2782. $ mkdir tc
  2783. $ mkdir tc/man
  2784. $ mkdir tc/testing
  2785. @end example
  2786. After that, you use the @code{import} command to create
  2787. the corresponding (empty) directory structure inside
  2788. the repository:
  2789. @example
  2790. $ cd tc
  2791. $ cvs import -m "Created directory structure" yoyodyne/@var{dir} yoyo start
  2792. @end example
  2793. This will add yoyodyne/@var{dir} as a directory under
  2794. @code{$CVSROOT}.
  2795. Use @code{checkout} to get the new project. Then, use @code{add}
  2796. to add files (and new directories) as needed.
  2797. @example
  2798. $ cd ..
  2799. $ cvs co yoyodyne/@var{dir}
  2800. @end example
  2801. Check that the permissions @sc{cvs} sets on the
  2802. directories inside @code{$CVSROOT} are reasonable.
  2803. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2804. @node Defining the module
  2805. @section Defining the module
  2806. @cindex Defining a module
  2807. @cindex Editing the modules file
  2808. @cindex Module, defining
  2809. @cindex Modules file, changing
  2810. The next step is to define the module in the
  2811. @file{modules} file. This is not strictly necessary,
  2812. but modules can be convenient in grouping together
  2813. related files and directories.
  2814. In simple cases these steps are sufficient to define a module.
  2815. @enumerate
  2816. @item
  2817. Get a working copy of the modules file.
  2818. @example
  2819. $ cvs checkout CVSROOT/modules
  2820. $ cd CVSROOT
  2821. @end example
  2822. @item
  2823. Edit the file and insert a line that defines the module. @xref{Intro
  2824. administrative files}, for an introduction. @xref{modules}, for a full
  2825. description of the modules file. You can use the
  2826. following line to define the module @samp{tc}:
  2827. @example
  2828. tc yoyodyne/tc
  2829. @end example
  2830. @item
  2831. Commit your changes to the modules file.
  2832. @example
  2833. $ cvs commit -m "Added the tc module." modules
  2834. @end example
  2835. @item
  2836. Release the modules module.
  2837. @example
  2838. $ cd ..
  2839. $ cvs release -d CVSROOT
  2840. @end example
  2841. @end enumerate
  2842. @c ---------------------------------------------------------------------
  2843. @node Revisions
  2844. @chapter Revisions
  2845. For many uses of @sc{cvs}, one doesn't need to worry
  2846. too much about revision numbers; @sc{cvs} assigns
  2847. numbers such as @code{1.1}, @code{1.2}, and so on, and
  2848. that is all one needs to know. However, some people
  2849. prefer to have more knowledge and control concerning
  2850. how @sc{cvs} assigns revision numbers.
  2851. If one wants to keep track of a set of revisions
  2852. involving more than one file, such as which revisions
  2853. went into a particular release, one uses a @dfn{tag},
  2854. which is a symbolic revision which can be assigned to a
  2855. numeric revision in each file.
  2856. @menu
  2857. * Revision numbers:: The meaning of a revision number
  2858. * Versions revisions releases:: Terminology used in this manual
  2859. * Assigning revisions:: Assigning revisions
  2860. * Tags:: Tags--Symbolic revisions
  2861. * Tagging the working directory:: The cvs tag command
  2862. * Tagging by date/tag:: The cvs rtag command
  2863. * Modifying tags:: Adding, renaming, and deleting tags
  2864. * Tagging add/remove:: Tags with adding and removing files
  2865. * Sticky tags:: Certain tags are persistent
  2866. @end menu
  2867. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2868. @node Revision numbers
  2869. @section Revision numbers
  2870. @cindex Revision numbers
  2871. @cindex Revision tree
  2872. @cindex Linear development
  2873. @cindex Number, revision-
  2874. @cindex Decimal revision number
  2875. @cindex Branch number
  2876. @cindex Number, branch
  2877. Each version of a file has a unique @dfn{revision
  2878. number}. Revision numbers look like @samp{1.1},
  2879. @samp{1.2}, @samp{1.3.2.2} or even @samp{1.3.2.2.4.5}.
  2880. A revision number always has an even number of
  2881. period-separated decimal integers. By default revision
  2882. 1.1 is the first revision of a file. Each successive
  2883. revision is given a new number by increasing the
  2884. rightmost number by one. The following figure displays
  2885. a few revisions, with newer revisions to the right.
  2886. @example
  2887. +-----+ +-----+ +-----+ +-----+ +-----+
  2888. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
  2889. +-----+ +-----+ +-----+ +-----+ +-----+
  2890. @end example
  2891. It is also possible to end up with numbers containing
  2892. more than one period, for example @samp{1.3.2.2}. Such
  2893. revisions represent revisions on branches
  2894. (@pxref{Branching and merging}); such revision numbers
  2895. are explained in detail in @ref{Branches and
  2896. revisions}.
  2897. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2898. @node Versions revisions releases
  2899. @section Versions, revisions and releases
  2900. @cindex Revisions, versions and releases
  2901. @cindex Versions, revisions and releases
  2902. @cindex Releases, revisions and versions
  2903. A file can have several versions, as described above.
  2904. Likewise, a software product can have several versions.
  2905. A software product is often given a version number such
  2906. as @samp{4.1.1}.
  2907. Versions in the first sense are called @dfn{revisions}
  2908. in this document, and versions in the second sense are
  2909. called @dfn{releases}. To avoid confusion, the word
  2910. @dfn{version} is almost never used in this document.
  2911. @node Assigning revisions
  2912. @section Assigning revisions
  2913. @c We avoid the "major revision" terminology. It seems
  2914. @c like jargon. Hopefully "first number" is clear enough.
  2915. By default, @sc{cvs} will assign numeric revisions by
  2916. leaving the first number the same and incrementing the
  2917. second number. For example, @code{1.1}, @code{1.2},
  2918. @code{1.3}, etc.
  2919. When adding a new file, the second number will always
  2920. be one and the first number will equal the highest
  2921. first number of any file in that directory. For
  2922. example, the current directory contains files whose
  2923. highest numbered revisions are @code{1.7}, @code{3.1},
  2924. and @code{4.12}, then an added file will be given the
  2925. numeric revision @code{4.1}.
  2926. (When using client/server @sc{cvs},
  2927. only files that are actually sent to the server are considered.)
  2928. @c This is sort of redundant with something we said a
  2929. @c while ago. Somewhere we need a better way of
  2930. @c introducing how the first number can be anything
  2931. @c except "1", perhaps. Also I don't think this
  2932. @c presentation is clear on why we are discussing releases
  2933. @c and first numbers of numeric revisions in the same
  2934. @c breath.
  2935. Normally there is no reason to care
  2936. about the revision numbers---it is easier to treat them
  2937. as internal numbers that @sc{cvs} maintains, and tags
  2938. provide a better way to distinguish between things like
  2939. release 1 versus release 2 of your product
  2940. (@pxref{Tags}). However, if you want to set the
  2941. numeric revisions, the @samp{-r} option to @code{cvs
  2942. commit} can do that. The @samp{-r} option implies the
  2943. @samp{-f} option, in the sense that it causes the
  2944. files to be committed even if they are not modified.
  2945. For example, to bring all your files up to
  2946. revision 3.0 (including those that haven't changed),
  2947. you might invoke:
  2948. @example
  2949. $ cvs commit -r 3.0
  2950. @end example
  2951. Note that the number you specify with @samp{-r} must be
  2952. larger than any existing revision number. That is, if
  2953. revision 3.0 exists, you cannot @samp{cvs commit
  2954. -r 1.3}. If you want to maintain several releases in
  2955. parallel, you need to use a branch (@pxref{Branching and merging}).
  2956. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2957. @node Tags
  2958. @section Tags--Symbolic revisions
  2959. @cindex Tags
  2960. The revision numbers live a life of their own. They
  2961. need not have anything at all to do with the release
  2962. numbers of your software product. Depending
  2963. on how you use @sc{cvs} the revision numbers might change several times
  2964. between two releases. As an example, some of the
  2965. source files that make up @sc{rcs} 5.6 have the following
  2966. revision numbers:
  2967. @cindex RCS revision numbers
  2968. @example
  2969. ci.c 5.21
  2970. co.c 5.9
  2971. ident.c 5.3
  2972. rcs.c 5.12
  2973. rcsbase.h 5.11
  2974. rcsdiff.c 5.10
  2975. rcsedit.c 5.11
  2976. rcsfcmp.c 5.9
  2977. rcsgen.c 5.10
  2978. rcslex.c 5.11
  2979. rcsmap.c 5.2
  2980. rcsutil.c 5.10
  2981. @end example
  2982. @cindex tag, command, introduction
  2983. @cindex Tag, symbolic name
  2984. @cindex Symbolic name (tag)
  2985. @cindex Name, symbolic (tag)
  2986. @cindex HEAD, as reserved tag name
  2987. @cindex BASE, as reserved tag name
  2988. You can use the @code{tag} command to give a symbolic name to a
  2989. certain revision of a file. You can use the @samp{-v} flag to the
  2990. @code{status} command to see all tags that a file has, and
  2991. which revision numbers they represent. Tag names must
  2992. start with an uppercase or lowercase letter and can
  2993. contain uppercase and lowercase letters, digits,
  2994. @samp{-}, and @samp{_}. The two tag names @code{BASE}
  2995. and @code{HEAD} are reserved for use by @sc{cvs}. It
  2996. is expected that future names which are special to
  2997. @sc{cvs} will be specially named, for example by
  2998. starting with @samp{.}, rather than being named analogously to
  2999. @code{BASE} and @code{HEAD}, to avoid conflicts with
  3000. actual tag names.
  3001. @c Including a character such as % or = has also been
  3002. @c suggested as the naming convention for future
  3003. @c special tag names. Starting with . is nice because
  3004. @c that is not a legal tag name as far as RCS is concerned.
  3005. @c FIXME: CVS actually accepts quite a few characters
  3006. @c in tag names, not just the ones documented above
  3007. @c (see RCS_check_tag). RCS
  3008. @c defines legitimate tag names by listing illegal
  3009. @c characters rather than legal ones. CVS is said to lose its
  3010. @c mind if you try to use "/" (try making such a tag sticky
  3011. @c and using "cvs status" client/server--see remote
  3012. @c protocol format for entries line for probable cause).
  3013. @c TODO: The testsuite
  3014. @c should test for whatever are documented above as
  3015. @c officially-OK tag names, and CVS should at least reject
  3016. @c characters that won't work, like "/".
  3017. You'll want to choose some convention for naming tags,
  3018. based on information such as the name of the program
  3019. and the version number of the release. For example,
  3020. one might take the name of the program, immediately
  3021. followed by the version number with @samp{.} changed to
  3022. @samp{-}, so that @sc{cvs} 1.9 would be tagged with the name
  3023. @code{cvs1-9}. If you choose a consistent convention,
  3024. then you won't constantly be guessing whether a tag is
  3025. @code{cvs-1-9} or @code{cvs1_9} or what. You might
  3026. even want to consider enforcing your convention in the
  3027. @file{taginfo} file (@pxref{taginfo}).
  3028. @c Might be nice to say more about using taginfo this
  3029. @c way, like giving an example, or pointing out any particular
  3030. @c issues which arise.
  3031. @cindex Adding a tag
  3032. @cindex Tag, example
  3033. The following example shows how you can add a tag to a
  3034. file. The commands must be issued inside your working
  3035. directory. That is, you should issue the
  3036. command in the directory where @file{backend.c}
  3037. resides.
  3038. @example
  3039. $ cvs tag rel-0-4 backend.c
  3040. T backend.c
  3041. $ cvs status -v backend.c
  3042. ===================================================================
  3043. File: backend.c Status: Up-to-date
  3044. Version: 1.4 Tue Dec 1 14:39:01 1992
  3045. RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v
  3046. Sticky Tag: (none)
  3047. Sticky Date: (none)
  3048. Sticky Options: (none)
  3049. Existing Tags:
  3050. rel-0-4 (revision: 1.4)
  3051. @end example
  3052. For a complete summary of the syntax of @code{cvs tag},
  3053. including the various options, see @ref{Invoking CVS}.
  3054. There is seldom reason to tag a file in isolation. A more common use is
  3055. to tag all the files that constitute a module with the same tag at
  3056. strategic points in the development life-cycle, such as when a release
  3057. is made.
  3058. @example
  3059. $ cvs tag rel-1-0 .
  3060. cvs tag: Tagging .
  3061. T Makefile
  3062. T backend.c
  3063. T driver.c
  3064. T frontend.c
  3065. T parser.c
  3066. @end example
  3067. @noindent
  3068. (When you give @sc{cvs} a directory as argument, it generally applies the
  3069. operation to all the files in that directory, and (recursively), to any
  3070. subdirectories that it may contain. @xref{Recursive behavior}.)
  3071. @cindex Retrieving an old revision using tags
  3072. @cindex Tag, retrieving old revisions
  3073. The @code{checkout} command has a flag, @samp{-r}, that lets you check out
  3074. a certain revision of a module. This flag makes it easy to
  3075. retrieve the sources that make up release 1.0 of the module @samp{tc} at
  3076. any time in the future:
  3077. @example
  3078. $ cvs checkout -r rel-1-0 tc
  3079. @end example
  3080. @noindent
  3081. This is useful, for instance, if someone claims that there is a bug in
  3082. that release, but you cannot find the bug in the current working copy.
  3083. You can also check out a module as it was at any given date.
  3084. @xref{checkout options}. When specifying @samp{-r} to
  3085. any of these commands, you will need beware of sticky
  3086. tags; see @ref{Sticky tags}.
  3087. When you tag more than one file with the same tag you
  3088. can think about the tag as "a curve drawn through a
  3089. matrix of filename vs.@: revision number." Say we have 5
  3090. files with the following revisions:
  3091. @example
  3092. @group
  3093. file1 file2 file3 file4 file5
  3094. 1.1 1.1 1.1 1.1 /--1.1* <-*- TAG
  3095. 1.2*- 1.2 1.2 -1.2*-
  3096. 1.3 \- 1.3*- 1.3 / 1.3
  3097. 1.4 \ 1.4 / 1.4
  3098. \-1.5*- 1.5
  3099. 1.6
  3100. @end group
  3101. @end example
  3102. At some time in the past, the @code{*} versions were tagged.
  3103. You can think of the tag as a handle attached to the curve
  3104. drawn through the tagged revisions. When you pull on
  3105. the handle, you get all the tagged revisions. Another
  3106. way to look at it is that you "sight" through a set of
  3107. revisions that is "flat" along the tagged revisions,
  3108. like this:
  3109. @example
  3110. @group
  3111. file1 file2 file3 file4 file5
  3112. 1.1
  3113. 1.2
  3114. 1.1 1.3 _
  3115. 1.1 1.2 1.4 1.1 /
  3116. 1.2*----1.3*----1.5*----1.2*----1.1 (--- <--- Look here
  3117. 1.3 1.6 1.3 \_
  3118. 1.4 1.4
  3119. 1.5
  3120. @end group
  3121. @end example
  3122. @node Tagging the working directory
  3123. @section Specifying what to tag from the working directory
  3124. @cindex tag (subcommand)
  3125. The example in the previous section demonstrates one of
  3126. the most common ways to choose which revisions to tag.
  3127. Namely, running the @code{cvs tag} command without
  3128. arguments causes @sc{cvs} to select the revisions which
  3129. are checked out in the current working directory. For
  3130. example, if the copy of @file{backend.c} in working
  3131. directory was checked out from revision 1.4, then
  3132. @sc{cvs} will tag revision 1.4. Note that the tag is
  3133. applied immediately to revision 1.4 in the repository;
  3134. tagging is not like modifying a file, or other
  3135. operations in which one first modifies the working
  3136. directory and then runs @code{cvs commit} to transfer
  3137. that modification to the repository.
  3138. One potentially surprising aspect of the fact that
  3139. @code{cvs tag} operates on the repository is that you
  3140. are tagging the checked-in revisions, which may differ
  3141. from locally modified files in your working directory.
  3142. If you want to avoid doing this by mistake, specify the
  3143. @samp{-c} option to @code{cvs tag}. If there are any
  3144. locally modified files, @sc{cvs} will abort with an
  3145. error before it tags any files:
  3146. @example
  3147. $ cvs tag -c rel-0-4
  3148. cvs tag: backend.c is locally modified
  3149. cvs [tag aborted]: correct the above errors first!
  3150. @end example
  3151. @node Tagging by date/tag
  3152. @section Specifying what to tag by date or revision
  3153. @cindex rtag (subcommand)
  3154. The @code{cvs rtag} command tags the repository as of a
  3155. certain date or time (or can be used to tag the latest
  3156. revision). @code{rtag} works directly on the
  3157. repository contents (it requires no prior checkout and
  3158. does not look for a working directory).
  3159. The following options specify which date or revision to
  3160. tag. See @ref{Common options}, for a complete
  3161. description of them.
  3162. @table @code
  3163. @item -D @var{date}
  3164. Tag the most recent revision no later than @var{date}.
  3165. @item -f
  3166. Only useful with the @samp{-D @var{date}} or @samp{-r @var{tag}}
  3167. flags. If no matching revision is found, use the most
  3168. recent revision (instead of ignoring the file).
  3169. @item -r @var{tag}
  3170. Only tag those files that contain existing tag @var{tag}.
  3171. @end table
  3172. The @code{cvs tag} command also allows one to specify
  3173. files by revision or date, using the same @samp{-r},
  3174. @samp{-D}, and @samp{-f} options. However, this
  3175. feature is probably not what you want. The reason is
  3176. that @code{cvs tag} chooses which files to tag based on
  3177. the files that exist in the working directory, rather
  3178. than the files which existed as of the given tag/date.
  3179. Therefore, you are generally better off using @code{cvs
  3180. rtag}. The exceptions might be cases like:
  3181. @example
  3182. cvs tag -r 1.4 backend.c
  3183. @end example
  3184. @node Modifying tags
  3185. @section Deleting, moving, and renaming tags
  3186. @c Also see:
  3187. @c "How do I move or rename a magic branch tag?"
  3188. @c in the FAQ (I think the issues it talks about still
  3189. @c apply, but this could use some sanity.sh work).
  3190. Normally one does not modify tags. They exist in order
  3191. to record the history of the repository and so deleting
  3192. them or changing their meaning would, generally, not be
  3193. what you want.
  3194. However, there might be cases in which one uses a tag
  3195. temporarily or accidentally puts one in the wrong
  3196. place. Therefore, one might delete, move, or rename a
  3197. tag.
  3198. @noindent
  3199. @strong{WARNING: The commands in this section are
  3200. dangerous; they permanently discard historical
  3201. information and it can be difficult or impossible to
  3202. recover from errors. If you are a @sc{cvs}
  3203. administrator, you may consider restricting these
  3204. commands with the @file{taginfo} file (@pxref{taginfo}).}
  3205. @cindex Deleting tags
  3206. @cindex Deleting branch tags
  3207. @cindex Removing tags
  3208. @cindex Removing branch tags
  3209. @cindex Tags, deleting
  3210. @cindex Branch tags, deleting
  3211. To delete a tag, specify the @samp{-d} option to either
  3212. @code{cvs tag} or @code{cvs rtag}. For example:
  3213. @example
  3214. cvs rtag -d rel-0-4 tc
  3215. @end example
  3216. @noindent
  3217. deletes the non-branch tag @code{rel-0-4} from the module @code{tc}.
  3218. In the event that branch tags are encountered within the repository
  3219. with the given name, a warning message will be issued and the branch
  3220. tag will not be deleted. If you are absolutely certain you know what
  3221. you are doing, the @code{-B} option may be specified to allow deletion
  3222. of branch tags. In that case, any non-branch tags encountered will
  3223. trigger warnings and will not be deleted.
  3224. @noindent
  3225. @strong{WARNING: Moving branch tags is very dangerous! If you think
  3226. you need the @code{-B} option, think again and ask your @sc{cvs}
  3227. administrator about it (if that isn't you). There is almost certainly
  3228. another way to accomplish what you want to accomplish.}
  3229. @cindex Moving tags
  3230. @cindex Moving branch tags
  3231. @cindex Tags, moving
  3232. @cindex Branch tags, moving
  3233. When we say @dfn{move} a tag, we mean to make the same
  3234. name point to different revisions. For example, the
  3235. @code{stable} tag may currently point to revision 1.4
  3236. of @file{backend.c} and perhaps we want to make it
  3237. point to revision 1.6. To move a non-branch tag, specify the
  3238. @samp{-F} option to either @code{cvs tag} or @code{cvs
  3239. rtag}. For example, the task just mentioned might be
  3240. accomplished as:
  3241. @example
  3242. cvs tag -r 1.6 -F stable backend.c
  3243. @end example
  3244. @noindent
  3245. If any branch tags are encountered in the repository
  3246. with the given name, a warning is issued and the branch
  3247. tag is not disturbed. If you are absolutely certain you
  3248. wish to move the branch tag, the @code{-B} option may be specified.
  3249. In that case, non-branch tags encountered with the given
  3250. name are ignored with a warning message.
  3251. @noindent
  3252. @strong{WARNING: Moving branch tags is very dangerous! If you think you
  3253. need the @code{-B} option, think again and ask your @sc{cvs}
  3254. administrator about it (if that isn't you). There is almost certainly
  3255. another way to accomplish what you want to accomplish.}
  3256. @cindex Renaming tags
  3257. @cindex Tags, renaming
  3258. When we say @dfn{rename} a tag, we mean to make a
  3259. different name point to the same revisions as the old
  3260. tag. For example, one may have misspelled the tag name
  3261. and want to correct it (hopefully before others are
  3262. relying on the old spelling). To rename a tag, first
  3263. create a new tag using the @samp{-r} option to
  3264. @code{cvs rtag}, and then delete the old name. (Caution:
  3265. this method will not work with branch tags.)
  3266. This leaves the new tag on exactly the
  3267. same files as the old tag. For example:
  3268. @example
  3269. cvs rtag -r old-name-0-4 rel-0-4 tc
  3270. cvs rtag -d old-name-0-4 tc
  3271. @end example
  3272. @node Tagging add/remove
  3273. @section Tagging and adding and removing files
  3274. The subject of exactly how tagging interacts with
  3275. adding and removing files is somewhat obscure; for the
  3276. most part @sc{cvs} will keep track of whether files
  3277. exist or not without too much fussing. By default,
  3278. tags are applied to only files which have a revision
  3279. corresponding to what is being tagged. Files which did
  3280. not exist yet, or which were already removed, simply
  3281. omit the tag, and @sc{cvs} knows to treat the absence
  3282. of a tag as meaning that the file didn't exist as of
  3283. that tag.
  3284. However, this can lose a small amount of information.
  3285. For example, suppose a file was added and then removed.
  3286. Then, if the tag is missing for that file, there is no
  3287. way to know whether the tag refers to the time before
  3288. the file was added, or the time after it was removed.
  3289. If you specify the @samp{-r} option to @code{cvs rtag},
  3290. then @sc{cvs} tags the files which have been removed,
  3291. and thereby avoids this problem. For example, one
  3292. might specify @code{-r HEAD} to tag the head.
  3293. On the subject of adding and removing files, the
  3294. @code{cvs rtag} command has a @samp{-a} option which
  3295. means to clear the tag from removed files that would
  3296. not otherwise be tagged. For example, one might
  3297. specify this option in conjunction with @samp{-F} when
  3298. moving a tag. If one moved a tag without @samp{-a},
  3299. then the tag in the removed files might still refer to
  3300. the old revision, rather than reflecting the fact that
  3301. the file had been removed. I don't think this is
  3302. necessary if @samp{-r} is specified, as noted above.
  3303. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3304. @node Sticky tags
  3305. @section Sticky tags
  3306. @cindex Sticky tags
  3307. @cindex Tags, sticky
  3308. @c A somewhat related issue is per-directory sticky
  3309. @c tags (see comment at CVS/Tag in node Working
  3310. @c directory storage); we probably want to say
  3311. @c something like "you can set a sticky tag for only
  3312. @c some files, but you don't want to" or some such.
  3313. Sometimes a working copy's revision has extra data
  3314. associated with it, for example it might be on a branch
  3315. (@pxref{Branching and merging}), or restricted to
  3316. versions prior to a certain date by @samp{checkout -D}
  3317. or @samp{update -D}. Because this data persists --
  3318. that is, it applies to subsequent commands in the
  3319. working copy -- we refer to it as @dfn{sticky}.
  3320. Most of the time, stickiness is an obscure aspect of
  3321. @sc{cvs} that you don't need to think about. However,
  3322. even if you don't want to use the feature, you may need
  3323. to know @emph{something} about sticky tags (for
  3324. example, how to avoid them!).
  3325. You can use the @code{status} command to see if any
  3326. sticky tags or dates are set:
  3327. @example
  3328. $ cvs status driver.c
  3329. ===================================================================
  3330. File: driver.c Status: Up-to-date
  3331. Version: 1.7.2.1 Sat Dec 5 19:35:03 1992
  3332. RCS Version: 1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
  3333. Sticky Tag: rel-1-0-patches (branch: 1.7.2)
  3334. Sticky Date: (none)
  3335. Sticky Options: (none)
  3336. @end example
  3337. @cindex Resetting sticky tags
  3338. @cindex Sticky tags, resetting
  3339. @cindex Deleting sticky tags
  3340. The sticky tags will remain on your working files until
  3341. you delete them with @samp{cvs update -A}. The
  3342. @samp{-A} option merges local changes into the version of the
  3343. file from the head of the trunk, removing any sticky tags,
  3344. dates, or options (other than sticky @samp{-k} options on locally
  3345. modified files). See @ref{update} for more on the operation
  3346. of @code{cvs update}.
  3347. @cindex Sticky date
  3348. The most common use of sticky tags is to identify which
  3349. branch one is working on, as described in
  3350. @ref{Accessing branches}. However, non-branch
  3351. sticky tags have uses as well. For example,
  3352. suppose that you want to avoid updating your working
  3353. directory, to isolate yourself from possibly
  3354. destabilizing changes other people are making. You
  3355. can, of course, just refrain from running @code{cvs
  3356. update}. But if you want to avoid updating only a
  3357. portion of a larger tree, then sticky tags can help.
  3358. If you check out a certain revision (such as 1.4) it
  3359. will become sticky. Subsequent @code{cvs update}
  3360. commands will
  3361. not retrieve the latest revision until you reset the
  3362. tag with @code{cvs update -A}. Likewise, use of the
  3363. @samp{-D} option to @code{update} or @code{checkout}
  3364. sets a @dfn{sticky date}, which, similarly, causes that
  3365. date to be used for future retrievals.
  3366. People often want to retrieve an old version of
  3367. a file without setting a sticky tag. This can
  3368. be done with the @samp{-p} option to @code{checkout} or
  3369. @code{update}, which sends the contents of the file to
  3370. standard output. For example:
  3371. @example
  3372. $ cvs update -p -r 1.1 file1 >file1
  3373. ===================================================================
  3374. Checking out file1
  3375. RCS: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
  3376. VERS: 1.1
  3377. ***************
  3378. $
  3379. @end example
  3380. However, this isn't the easiest way, if you are asking
  3381. how to undo a previous checkin (in this example, put
  3382. @file{file1} back to the way it was as of revision
  3383. 1.1). In that case you are better off using the
  3384. @samp{-j} option to @code{update}; for further
  3385. discussion see @ref{Merging two revisions}.
  3386. @c ---------------------------------------------------------------------
  3387. @node Branching and merging
  3388. @chapter Branching and merging
  3389. @cindex Branching
  3390. @cindex Merging
  3391. @cindex Copying changes
  3392. @cindex Main trunk and branches
  3393. @cindex Revision tree, making branches
  3394. @cindex Branches, copying changes between
  3395. @cindex Changes, copying between branches
  3396. @cindex Modifications, copying between branches
  3397. @sc{cvs} allows you to isolate changes onto a separate
  3398. line of development, known as a @dfn{branch}. When you
  3399. change files on a branch, those changes do not appear
  3400. on the main trunk or other branches.
  3401. Later you can move changes from one branch to another
  3402. branch (or the main trunk) by @dfn{merging}. Merging
  3403. involves first running @code{cvs update -j}, to merge
  3404. the changes into the working directory.
  3405. You can then commit that revision, and thus effectively
  3406. copy the changes onto another branch.
  3407. @menu
  3408. * Branches motivation:: What branches are good for
  3409. * Creating a branch:: Creating a branch
  3410. * Accessing branches:: Checking out and updating branches
  3411. * Branches and revisions:: Branches are reflected in revision numbers
  3412. * Magic branch numbers:: Magic branch numbers
  3413. * Merging a branch:: Merging an entire branch
  3414. * Merging more than once:: Merging from a branch several times
  3415. * Merging two revisions:: Merging differences between two revisions
  3416. * Merging adds and removals:: What if files are added or removed?
  3417. * Merging and keywords:: Avoiding conflicts due to keyword substitution
  3418. @end menu
  3419. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3420. @node Branches motivation
  3421. @section What branches are good for
  3422. @cindex Branches motivation
  3423. @cindex What branches are good for
  3424. @cindex Motivation for branches
  3425. @c FIXME: this node mentions one way to use branches,
  3426. @c but it is by no means the only way. For example,
  3427. @c the technique of committing a new feature on a branch,
  3428. @c until it is ready for the main trunk. The whole
  3429. @c thing is generally speaking more akin to the
  3430. @c "Revision management" node although it isn't clear to
  3431. @c me whether policy matters should be centralized or
  3432. @c distributed throughout the relevant sections.
  3433. Suppose that release 1.0 of tc has been made. You are continuing to
  3434. develop tc, planning to create release 1.1 in a couple of months. After a
  3435. while your customers start to complain about a fatal bug. You check
  3436. out release 1.0 (@pxref{Tags}) and find the bug
  3437. (which turns out to have a trivial fix). However, the current revision
  3438. of the sources are in a state of flux and are not expected to be stable
  3439. for at least another month. There is no way to make a
  3440. bug fix release based on the newest sources.
  3441. The thing to do in a situation like this is to create a @dfn{branch} on
  3442. the revision trees for all the files that make up
  3443. release 1.0 of tc. You can then make
  3444. modifications to the branch without disturbing the main trunk. When the
  3445. modifications are finished you can elect to either incorporate them on
  3446. the main trunk, or leave them on the branch.
  3447. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3448. @node Creating a branch
  3449. @section Creating a branch
  3450. @cindex Creating a branch
  3451. @cindex Branch, creating a
  3452. @cindex tag, creating a branch using
  3453. @cindex rtag, creating a branch using
  3454. You can create a branch with @code{tag -b}; for
  3455. example, assuming you're in a working copy:
  3456. @example
  3457. $ cvs tag -b rel-1-0-patches
  3458. @end example
  3459. @c FIXME: we should be more explicit about the value of
  3460. @c having a tag on the branchpoint. For example
  3461. @c "cvs tag rel-1-0-patches-branchpoint" before
  3462. @c the "cvs tag -b". This points out that
  3463. @c rel-1-0-patches is a pretty awkward name for
  3464. @c this example (more so than for the rtag example
  3465. @c below).
  3466. This splits off a branch based on the current revisions
  3467. in the working copy, assigning that branch the name
  3468. @samp{rel-1-0-patches}.
  3469. It is important to understand that branches get created
  3470. in the repository, not in the working copy. Creating a
  3471. branch based on current revisions, as the above example
  3472. does, will @emph{not} automatically switch the working
  3473. copy to be on the new branch. For information on how
  3474. to do that, see @ref{Accessing branches}.
  3475. You can also create a branch without reference to any
  3476. working copy, by using @code{rtag}:
  3477. @example
  3478. $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
  3479. @end example
  3480. @samp{-r rel-1-0} says that this branch should be
  3481. rooted at the revision that
  3482. corresponds to the tag @samp{rel-1-0}. It need not
  3483. be the most recent revision -- it's often useful to
  3484. split a branch off an old revision (for example, when
  3485. fixing a bug in a past release otherwise known to be
  3486. stable).
  3487. As with @samp{tag}, the @samp{-b} flag tells
  3488. @code{rtag} to create a branch (rather than just a
  3489. symbolic revision name). Note that the numeric
  3490. revision number that matches @samp{rel-1-0} will
  3491. probably be different from file to file.
  3492. So, the full effect of the command is to create a new
  3493. branch -- named @samp{rel-1-0-patches} -- in module
  3494. @samp{tc}, rooted in the revision tree at the point tagged
  3495. by @samp{rel-1-0}.
  3496. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3497. @node Accessing branches
  3498. @section Accessing branches
  3499. @cindex Check out a branch
  3500. @cindex Retrieve a branch
  3501. @cindex Access a branch
  3502. @cindex Identifying a branch
  3503. @cindex Branch, check out
  3504. @cindex Branch, retrieving
  3505. @cindex Branch, accessing
  3506. @cindex Branch, identifying
  3507. You can retrieve a branch in one of two ways: by
  3508. checking it out fresh from the repository, or by
  3509. switching an existing working copy over to the branch.
  3510. To check out a branch from the repository, invoke
  3511. @samp{checkout} with the @samp{-r} flag, followed by
  3512. the tag name of the branch (@pxref{Creating a branch}):
  3513. @example
  3514. $ cvs checkout -r rel-1-0-patches tc
  3515. @end example
  3516. Or, if you already have a working copy, you can switch
  3517. it to a given branch with @samp{update -r}:
  3518. @example
  3519. $ cvs update -r rel-1-0-patches tc
  3520. @end example
  3521. @noindent
  3522. or equivalently:
  3523. @example
  3524. $ cd tc
  3525. $ cvs update -r rel-1-0-patches
  3526. @end example
  3527. It does not matter if the working copy was originally
  3528. on the main trunk or on some other branch -- the above
  3529. command will switch it to the named branch. And
  3530. similarly to a regular @samp{update} command,
  3531. @samp{update -r} merges any changes you have made,
  3532. notifying you of conflicts where they occur.
  3533. Once you have a working copy tied to a particular
  3534. branch, it remains there until you tell it otherwise.
  3535. This means that changes checked in from the working
  3536. copy will add new revisions on that branch, while
  3537. leaving the main trunk and other branches unaffected.
  3538. @cindex Branches, sticky
  3539. To find out what branch a working copy is on, you can
  3540. use the @samp{status} command. In its output, look for
  3541. the field named @samp{Sticky tag} (@pxref{Sticky tags})
  3542. -- that's @sc{cvs}'s way of telling you the branch, if
  3543. any, of the current working files:
  3544. @example
  3545. $ cvs status -v driver.c backend.c
  3546. ===================================================================
  3547. File: driver.c Status: Up-to-date
  3548. Version: 1.7 Sat Dec 5 18:25:54 1992
  3549. RCS Version: 1.7 /u/cvsroot/yoyodyne/tc/driver.c,v
  3550. Sticky Tag: rel-1-0-patches (branch: 1.7.2)
  3551. Sticky Date: (none)
  3552. Sticky Options: (none)
  3553. Existing Tags:
  3554. rel-1-0-patches (branch: 1.7.2)
  3555. rel-1-0 (revision: 1.7)
  3556. ===================================================================
  3557. File: backend.c Status: Up-to-date
  3558. Version: 1.4 Tue Dec 1 14:39:01 1992
  3559. RCS Version: 1.4 /u/cvsroot/yoyodyne/tc/backend.c,v
  3560. Sticky Tag: rel-1-0-patches (branch: 1.4.2)
  3561. Sticky Date: (none)
  3562. Sticky Options: (none)
  3563. Existing Tags:
  3564. rel-1-0-patches (branch: 1.4.2)
  3565. rel-1-0 (revision: 1.4)
  3566. rel-0-4 (revision: 1.4)
  3567. @end example
  3568. Don't be confused by the fact that the branch numbers
  3569. for each file are different (@samp{1.7.2} and
  3570. @samp{1.4.2} respectively). The branch tag is the
  3571. same, @samp{rel-1-0-patches}, and the files are
  3572. indeed on the same branch. The numbers simply reflect
  3573. the point in each file's revision history at which the
  3574. branch was made. In the above example, one can deduce
  3575. that @samp{driver.c} had been through more changes than
  3576. @samp{backend.c} before this branch was created.
  3577. See @ref{Branches and revisions} for details about how
  3578. branch numbers are constructed.
  3579. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3580. @node Branches and revisions
  3581. @section Branches and revisions
  3582. @cindex Branch number
  3583. @cindex Number, branch
  3584. @cindex Revision numbers (branches)
  3585. Ordinarily, a file's revision history is a linear
  3586. series of increments (@pxref{Revision numbers}):
  3587. @example
  3588. +-----+ +-----+ +-----+ +-----+ +-----+
  3589. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !
  3590. +-----+ +-----+ +-----+ +-----+ +-----+
  3591. @end example
  3592. However, @sc{cvs} is not limited to linear development. The
  3593. @dfn{revision tree} can be split into @dfn{branches},
  3594. where each branch is a self-maintained line of
  3595. development. Changes made on one branch can easily be
  3596. moved back to the main trunk.
  3597. Each branch has a @dfn{branch number}, consisting of an
  3598. odd number of period-separated decimal integers. The
  3599. branch number is created by appending an integer to the
  3600. revision number where the corresponding branch forked
  3601. off. Having branch numbers allows more than one branch
  3602. to be forked off from a certain revision.
  3603. @need 3500
  3604. All revisions on a branch have revision numbers formed
  3605. by appending an ordinal number to the branch number.
  3606. The following figure illustrates branching with an
  3607. example.
  3608. @example
  3609. @c This example used to have a 1.2.2.4 revision, which
  3610. @c might help clarify that development can continue on
  3611. @c 1.2.2. Might be worth reinstating if it can be done
  3612. @c without overfull hboxes.
  3613. @group
  3614. +-------------+
  3615. Branch 1.2.2.3.2 -> ! 1.2.2.3.2.1 !
  3616. / +-------------+
  3617. /
  3618. /
  3619. +---------+ +---------+ +---------+
  3620. Branch 1.2.2 -> _! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
  3621. / +---------+ +---------+ +---------+
  3622. /
  3623. /
  3624. +-----+ +-----+ +-----+ +-----+ +-----+
  3625. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
  3626. +-----+ +-----+ +-----+ +-----+ +-----+
  3627. !
  3628. !
  3629. ! +---------+ +---------+ +---------+
  3630. Branch 1.2.4 -> +---! 1.2.4.1 !----! 1.2.4.2 !----! 1.2.4.3 !
  3631. +---------+ +---------+ +---------+
  3632. @end group
  3633. @end example
  3634. @c -- However, at least for me the figure is not enough. I suggest more
  3635. @c -- text to accompany it. "A picture is worth a thousand words", so you
  3636. @c -- have to make sure the reader notices the couple of hundred words
  3637. @c -- *you* had in mind more than the others!
  3638. @c -- Why an even number of segments? This section implies that this is
  3639. @c -- how the main trunk is distinguished from branch roots, but you never
  3640. @c -- explicitly say that this is the purpose of the [by itself rather
  3641. @c -- surprising] restriction to an even number of segments.
  3642. The exact details of how the branch number is
  3643. constructed is not something you normally need to be
  3644. concerned about, but here is how it works: When
  3645. @sc{cvs} creates a branch number it picks the first
  3646. unused even integer, starting with 2. So when you want
  3647. to create a branch from revision 6.4 it will be
  3648. numbered 6.4.2. All branch numbers ending in a zero
  3649. (such as 6.4.0) are used internally by @sc{cvs}
  3650. (@pxref{Magic branch numbers}). The branch 1.1.1 has a
  3651. special meaning. @xref{Tracking sources}.
  3652. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3653. @node Magic branch numbers
  3654. @section Magic branch numbers
  3655. @c Want xref to here from "log"?
  3656. This section describes a @sc{cvs} feature called
  3657. @dfn{magic branches}. For most purposes, you need not
  3658. worry about magic branches; @sc{cvs} handles them for
  3659. you. However, they are visible to you in certain
  3660. circumstances, so it may be useful to have some idea of
  3661. how it works.
  3662. Externally, branch numbers consist of an odd number of
  3663. dot-separated decimal integers. @xref{Revision
  3664. numbers}. That is not the whole truth, however. For
  3665. efficiency reasons @sc{cvs} sometimes inserts an extra 0
  3666. in the second rightmost position (1.2.4 becomes
  3667. 1.2.0.4, 8.9.10.11.12 becomes 8.9.10.11.0.12 and so
  3668. on).
  3669. @sc{cvs} does a pretty good job at hiding these so
  3670. called magic branches, but in a few places the hiding
  3671. is incomplete:
  3672. @itemize @bullet
  3673. @ignore
  3674. @c This is in ignore as I'm taking their word for it,
  3675. @c that this was fixed
  3676. @c a long time ago. But before deleting this
  3677. @c entirely, I'd rather verify it (and add a test
  3678. @c case to the testsuite).
  3679. @item
  3680. The magic branch can appear in the output from
  3681. @code{cvs status} in vanilla @sc{cvs} 1.3. This is
  3682. fixed in @sc{cvs} 1.3-s2.
  3683. @end ignore
  3684. @item
  3685. The magic branch number appears in the output from
  3686. @code{cvs log}.
  3687. @c What output should appear instead?
  3688. @item
  3689. You cannot specify a symbolic branch name to @code{cvs
  3690. admin}.
  3691. @end itemize
  3692. @c Can CVS do this automatically the first time
  3693. @c you check something in to that branch? Should
  3694. @c it?
  3695. You can use the @code{admin} command to reassign a
  3696. symbolic name to a branch the way @sc{rcs} expects it
  3697. to be. If @code{R4patches} is assigned to the branch
  3698. 1.4.2 (magic branch number 1.4.0.2) in file
  3699. @file{numbers.c} you can do this:
  3700. @example
  3701. $ cvs admin -NR4patches:1.4.2 numbers.c
  3702. @end example
  3703. It only works if at least one revision is already
  3704. committed on the branch. Be very careful so that you
  3705. do not assign the tag to the wrong number. (There is
  3706. no way to see how the tag was assigned yesterday).
  3707. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3708. @node Merging a branch
  3709. @section Merging an entire branch
  3710. @cindex Merging a branch
  3711. @cindex -j (merging branches)
  3712. You can merge changes made on a branch into your working copy by giving
  3713. the @samp{-j @var{branchname}} flag to the @code{update} subcommand. With one
  3714. @samp{-j @var{branchname}} option it merges the changes made between the
  3715. greatest common ancestor (GCA) of the branch and the destination revision (in
  3716. the simple case below the GCA is the point where the branch forked) and the
  3717. newest revision on that branch into your working copy.
  3718. @cindex Join
  3719. The @samp{-j} stands for ``join''.
  3720. @cindex Branch merge example
  3721. @cindex Example, branch merge
  3722. @cindex Merge, branch example
  3723. Consider this revision tree:
  3724. @example
  3725. +-----+ +-----+ +-----+ +-----+
  3726. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 ! <- The main trunk
  3727. +-----+ +-----+ +-----+ +-----+
  3728. !
  3729. !
  3730. ! +---------+ +---------+
  3731. Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
  3732. +---------+ +---------+
  3733. @end example
  3734. @noindent
  3735. The branch 1.2.2 has been given the tag (symbolic name) @samp{R1fix}. The
  3736. following example assumes that the module @samp{mod} contains only one
  3737. file, @file{m.c}.
  3738. @example
  3739. $ cvs checkout mod # @r{Retrieve the latest revision, 1.4}
  3740. $ cvs update -j R1fix m.c # @r{Merge all changes made on the branch,}
  3741. # @r{i.e. the changes between revision 1.2}
  3742. # @r{and 1.2.2.2, into your working copy}
  3743. # @r{of the file.}
  3744. $ cvs commit -m "Included R1fix" # @r{Create revision 1.5.}
  3745. @end example
  3746. A conflict can result from a merge operation. If that
  3747. happens, you should resolve it before committing the
  3748. new revision. @xref{Conflicts example}.
  3749. If your source files contain keywords (@pxref{Keyword substitution}),
  3750. you might be getting more conflicts than strictly necessary. See
  3751. @ref{Merging and keywords}, for information on how to avoid this.
  3752. The @code{checkout} command also supports the @samp{-j @var{branchname}} flag. The
  3753. same effect as above could be achieved with this:
  3754. @example
  3755. $ cvs checkout -j R1fix mod
  3756. $ cvs commit -m "Included R1fix"
  3757. @end example
  3758. It should be noted that @code{update -j @var{tagname}} will also work but may
  3759. not produce the desired result. @xref{Merging adds and removals}, for more.
  3760. @node Merging more than once
  3761. @section Merging from a branch several times
  3762. Continuing our example, the revision tree now looks
  3763. like this:
  3764. @example
  3765. +-----+ +-----+ +-----+ +-----+ +-----+
  3766. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
  3767. +-----+ +-----+ +-----+ +-----+ +-----+
  3768. ! *
  3769. ! *
  3770. ! +---------+ +---------+
  3771. Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !
  3772. +---------+ +---------+
  3773. @end example
  3774. @noindent
  3775. where the starred line represents the merge from the
  3776. @samp{R1fix} branch to the main trunk, as just
  3777. discussed.
  3778. Now suppose that development continues on the
  3779. @samp{R1fix} branch:
  3780. @example
  3781. +-----+ +-----+ +-----+ +-----+ +-----+
  3782. ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 ! <- The main trunk
  3783. +-----+ +-----+ +-----+ +-----+ +-----+
  3784. ! *
  3785. ! *
  3786. ! +---------+ +---------+ +---------+
  3787. Branch R1fix -> +---! 1.2.2.1 !----! 1.2.2.2 !----! 1.2.2.3 !
  3788. +---------+ +---------+ +---------+
  3789. @end example
  3790. @noindent
  3791. and then you want to merge those new changes onto the
  3792. main trunk. If you just use the @code{cvs update -j
  3793. R1fix m.c} command again, @sc{cvs} will attempt to
  3794. merge again the changes which you have already merged,
  3795. which can have undesirable side effects.
  3796. So instead you need to specify that you only want to
  3797. merge the changes on the branch which have not yet been
  3798. merged into the trunk. To do that you specify two
  3799. @samp{-j} options, and @sc{cvs} merges the changes from
  3800. the first revision to the second revision. For
  3801. example, in this case the simplest way would be
  3802. @example
  3803. cvs update -j 1.2.2.2 -j R1fix m.c # @r{Merge changes from 1.2.2.2 to the}
  3804. # @r{head of the R1fix branch}
  3805. @end example
  3806. The problem with this is that you need to specify the
  3807. 1.2.2.2 revision manually. A slightly better approach
  3808. might be to use the date the last merge was done:
  3809. @example
  3810. cvs update -j R1fix:yesterday -j R1fix m.c
  3811. @end example
  3812. Better yet, tag the R1fix branch after every merge into
  3813. the trunk, and then use that tag for subsequent merges:
  3814. @example
  3815. cvs update -j merged_from_R1fix_to_trunk -j R1fix m.c
  3816. @end example
  3817. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3818. @node Merging two revisions
  3819. @section Merging differences between any two revisions
  3820. @cindex Merging two revisions
  3821. @cindex Revisions, merging differences between
  3822. @cindex Differences, merging
  3823. With two @samp{-j @var{revision}} flags, the @code{update}
  3824. (and @code{checkout}) command can merge the differences
  3825. between any two revisions into your working file.
  3826. @cindex Undoing a change
  3827. @cindex Removing a change
  3828. @example
  3829. $ cvs update -j 1.5 -j 1.3 backend.c
  3830. @end example
  3831. @noindent
  3832. will undo all changes made between revision
  3833. 1.3 and 1.5. Note the order of the revisions!
  3834. If you try to use this option when operating on
  3835. multiple files, remember that the numeric revisions will
  3836. probably be very different between the various files.
  3837. You almost always use symbolic
  3838. tags rather than revision numbers when operating on
  3839. multiple files.
  3840. @cindex Restoring old version of removed file
  3841. @cindex Resurrecting old version of dead file
  3842. Specifying two @samp{-j} options can also undo file
  3843. removals or additions. For example, suppose you have
  3844. a file
  3845. named @file{file1} which existed as revision 1.1, and
  3846. you then removed it (thus adding a dead revision 1.2).
  3847. Now suppose you want to add it again, with the same
  3848. contents it had previously. Here is how to do it:
  3849. @example
  3850. $ cvs update -j 1.2 -j 1.1 file1
  3851. U file1
  3852. $ cvs commit -m test
  3853. Checking in file1;
  3854. /tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1
  3855. new revision: 1.3; previous revision: 1.2
  3856. done
  3857. $
  3858. @end example
  3859. @node Merging adds and removals
  3860. @section Merging can add or remove files
  3861. If the changes which you are merging involve removing
  3862. or adding some files, @code{update -j} will reflect
  3863. such additions or removals.
  3864. @c FIXME: This example needs a lot more explanation.
  3865. @c We also need other examples for some of the other
  3866. @c cases (not all--there are too many--as long as we present a
  3867. @c coherent general principle).
  3868. For example:
  3869. @example
  3870. cvs update -A
  3871. touch a b c
  3872. cvs add a b c ; cvs ci -m "added" a b c
  3873. cvs tag -b branchtag
  3874. cvs update -r branchtag
  3875. touch d ; cvs add d
  3876. rm a ; cvs rm a
  3877. cvs ci -m "added d, removed a"
  3878. cvs update -A
  3879. cvs update -jbranchtag
  3880. @end example
  3881. After these commands are executed and a @samp{cvs commit} is done,
  3882. file @file{a} will be removed and file @file{d} added in the main branch.
  3883. @c (which was determined by trying it)
  3884. Note that using a single static tag (@samp{-j @var{tagname}})
  3885. rather than a dynamic tag (@samp{-j @var{branchname}}) to merge
  3886. changes from a branch will usually not remove files which were removed on the
  3887. branch since @sc{cvs} does not automatically add static tags to dead revisions.
  3888. The exception to this rule occurs when
  3889. a static tag has been attached to a dead revision manually. Use the branch tag
  3890. to merge all changes from the branch or use two static tags as merge endpoints
  3891. to be sure that all intended changes are propagated in the merge.
  3892. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3893. @node Merging and keywords
  3894. @section Merging and keywords
  3895. @cindex Merging, and keyword substitution
  3896. @cindex Keyword substitution, and merging
  3897. @cindex -j (merging branches), and keyword substitution
  3898. @cindex -kk, to avoid conflicts during a merge
  3899. If you merge files containing keywords (@pxref{Keyword
  3900. substitution}), you will normally get numerous
  3901. conflicts during the merge, because the keywords are
  3902. expanded differently in the revisions which you are
  3903. merging.
  3904. Therefore, you will often want to specify the
  3905. @samp{-kk} (@pxref{Substitution modes}) switch to the
  3906. merge command line. By substituting just the name of
  3907. the keyword, not the expanded value of that keyword,
  3908. this option ensures that the revisions which you are
  3909. merging will be the same as each other, and avoid
  3910. spurious conflicts.
  3911. For example, suppose you have a file like this:
  3912. @example
  3913. +---------+
  3914. _! 1.1.2.1 ! <- br1
  3915. / +---------+
  3916. /
  3917. /
  3918. +-----+ +-----+
  3919. ! 1.1 !----! 1.2 !
  3920. +-----+ +-----+
  3921. @end example
  3922. @noindent
  3923. and your working directory is currently on the trunk
  3924. (revision 1.2). Then you might get the following
  3925. results from a merge:
  3926. @example
  3927. $ cat file1
  3928. key $@splitrcskeyword{Revision}: 1.2 $
  3929. . . .
  3930. $ cvs update -j br1
  3931. U file1
  3932. RCS file: /cvsroot/first-dir/file1,v
  3933. retrieving revision 1.1
  3934. retrieving revision 1.1.2.1
  3935. Merging differences between 1.1 and 1.1.2.1 into file1
  3936. rcsmerge: warning: conflicts during merge
  3937. $ cat file1
  3938. @asis{}<<<<<<< file1
  3939. key $@splitrcskeyword{Revision}: 1.2 $
  3940. @asis{}=======
  3941. key $@splitrcskeyword{Revision}: 1.1.2.1 $
  3942. @asis{}>>>>>>> 1.1.2.1
  3943. . . .
  3944. @end example
  3945. What happened was that the merge tried to merge the
  3946. differences between 1.1 and 1.1.2.1 into your working
  3947. directory. So, since the keyword changed from
  3948. @code{Revision: 1.1} to @code{Revision: 1.1.2.1},
  3949. @sc{cvs} tried to merge that change into your working
  3950. directory, which conflicted with the fact that your
  3951. working directory had contained @code{Revision: 1.2}.
  3952. Here is what happens if you had used @samp{-kk}:
  3953. @example
  3954. $ cat file1
  3955. key $@splitrcskeyword{Revision}: 1.2 $
  3956. . . .
  3957. $ cvs update -kk -j br1
  3958. U file1
  3959. RCS file: /cvsroot/first-dir/file1,v
  3960. retrieving revision 1.1
  3961. retrieving revision 1.1.2.1
  3962. Merging differences between 1.1 and 1.1.2.1 into file1
  3963. $ cat file1
  3964. key $@splitrcskeyword{Revision}$
  3965. . . .
  3966. @end example
  3967. What is going on here is that revision 1.1 and 1.1.2.1
  3968. both expand as plain @code{Revision}, and therefore
  3969. merging the changes between them into the working
  3970. directory need not change anything. Therefore, there
  3971. is no conflict.
  3972. There is, however, one major caveat with using
  3973. @samp{-kk} on merges. Namely, it overrides whatever
  3974. keyword expansion mode @sc{cvs} would normally have
  3975. used. In particular, this is a problem if the mode had
  3976. been @samp{-kb} for a binary file. Therefore, if your
  3977. repository contains binary files, you will need to deal
  3978. with the conflicts rather than using @samp{-kk}.
  3979. @ignore
  3980. The following seems rather confusing, possibly buggy,
  3981. and in general, in need of much more thought before it
  3982. is a recommended technique. For one thing, does it
  3983. apply on Windows as well as on Unix?
  3984. Unchanged binary files will undergo the same keyword substitution
  3985. but will not be checked in on a subsequent
  3986. @code{cvs commit}. Be aware that binary files containing keyword
  3987. strings which are present in or below the working directory
  3988. will most likely remain corrupt until repaired, however. A simple
  3989. @code{cvs update -A} is sufficient to fix these otherwise unaltered binary files
  3990. if the merge is being done to the main branch but
  3991. this must be done after the merge has been committed or the merge itself
  3992. will be lost.
  3993. For Example:
  3994. @example
  3995. cvs update -Akk -jbranchtag
  3996. cvs commit
  3997. cvs update -A
  3998. @end example
  3999. @noindent
  4000. will update the current directory from the main trunk of the
  4001. repository, substituting the base keyword strings for keywords,
  4002. and merge changes made on the branch @samp{branchtag} into the new
  4003. work files, performing the same keyword substitution on that file set before
  4004. comparing the two sets. The final @code{cvs update -A} will restore any
  4005. corrupted binary files as well as resetting the sticky @samp{-kk} tags which
  4006. were present on the files in and below the working directory.
  4007. Unfortunately, this doesn't work as well with an arbitrary branch tag, as the
  4008. @samp{-r @var{branchtag}} switch does not reset the sticky @samp{-kk}
  4009. switches attached to the working files as @samp{-A} does. The workaround
  4010. for this is to release the working directory after the merge has been
  4011. committed and check it out again.
  4012. @end ignore
  4013. As a result of using @samp{-kk} during the merge, each file examined by the
  4014. update will have @samp{-kk} set as sticky options. Running @code{update -A}
  4015. will clear the sticky options on unmodified files, but it will not clear
  4016. the sticky options on modified files. To get back to the default keyword
  4017. substitution for modified files, you must commit the results of the merge
  4018. and then run @code{update -A}.
  4019. @c ---------------------------------------------------------------------
  4020. @node Recursive behavior
  4021. @chapter Recursive behavior
  4022. @cindex Recursive (directory descending)
  4023. @cindex Directory, descending
  4024. @cindex Descending directories
  4025. @cindex Subdirectories
  4026. Almost all of the subcommands of @sc{cvs} work
  4027. recursively when you specify a directory as an
  4028. argument. For instance, consider this directory
  4029. structure:
  4030. @example
  4031. @code{$HOME}
  4032. |
  4033. +--@t{tc}
  4034. | |
  4035. +--@t{CVS}
  4036. | (internal @sc{cvs} files)
  4037. +--@t{Makefile}
  4038. +--@t{backend.c}
  4039. +--@t{driver.c}
  4040. +--@t{frontend.c}
  4041. +--@t{parser.c}
  4042. +--@t{man}
  4043. | |
  4044. | +--@t{CVS}
  4045. | | (internal @sc{cvs} files)
  4046. | +--@t{tc.1}
  4047. |
  4048. +--@t{testing}
  4049. |
  4050. +--@t{CVS}
  4051. | (internal @sc{cvs} files)
  4052. +--@t{testpgm.t}
  4053. +--@t{test2.t}
  4054. @end example
  4055. @noindent
  4056. If @file{tc} is the current working directory, the
  4057. following is true:
  4058. @itemize @bullet
  4059. @item
  4060. @samp{cvs update testing} is equivalent to
  4061. @example
  4062. cvs update testing/testpgm.t testing/test2.t
  4063. @end example
  4064. @item
  4065. @samp{cvs update testing man} updates all files in the
  4066. subdirectories
  4067. @item
  4068. @samp{cvs update .} or just @samp{cvs update} updates
  4069. all files in the @code{tc} directory
  4070. @end itemize
  4071. If no arguments are given to @code{update} it will
  4072. update all files in the current working directory and
  4073. all its subdirectories. In other words, @file{.} is a
  4074. default argument to @code{update}. This is also true
  4075. for most of the @sc{cvs} subcommands, not only the
  4076. @code{update} command.
  4077. The recursive behavior of the @sc{cvs} subcommands can be
  4078. turned off with the @samp{-l} option.
  4079. Conversely, the @samp{-R} option can be used to force recursion if
  4080. @samp{-l} is specified in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
  4081. @example
  4082. $ cvs update -l # @r{Don't update files in subdirectories}
  4083. @end example
  4084. @c ---------------------------------------------------------------------
  4085. @node Adding and removing
  4086. @chapter Adding, removing, and renaming files and directories
  4087. In the course of a project, one will often add new
  4088. files. Likewise with removing or renaming, or with
  4089. directories. The general concept to keep in mind in
  4090. all these cases is that instead of making an
  4091. irreversible change you want @sc{cvs} to record the
  4092. fact that a change has taken place, just as with
  4093. modifying an existing file. The exact mechanisms to do
  4094. this in @sc{cvs} vary depending on the situation.
  4095. @menu
  4096. * Adding files:: Adding files
  4097. * Removing files:: Removing files
  4098. * Removing directories:: Removing directories
  4099. * Moving files:: Moving and renaming files
  4100. * Moving directories:: Moving and renaming directories
  4101. @end menu
  4102. @node Adding files
  4103. @section Adding files to a directory
  4104. @cindex Adding files
  4105. To add a new file to a directory, follow these steps.
  4106. @itemize @bullet
  4107. @item
  4108. You must have a working copy of the directory.
  4109. @xref{Getting the source}.
  4110. @item
  4111. Create the new file inside your working copy of the directory.
  4112. @item
  4113. Use @samp{cvs add @var{filename}} to tell @sc{cvs} that you
  4114. want to version control the file. If the file contains
  4115. binary data, specify @samp{-kb} (@pxref{Binary files}).
  4116. @item
  4117. Use @samp{cvs commit @var{filename}} to actually check
  4118. in the file into the repository. Other developers
  4119. cannot see the file until you perform this step.
  4120. @end itemize
  4121. You can also use the @code{add} command to add a new
  4122. directory.
  4123. @c FIXCVS and/or FIXME: Adding a directory doesn't
  4124. @c require the commit step. This probably can be
  4125. @c considered a CVS bug, but it is possible we should
  4126. @c warn people since this behavior probably won't be
  4127. @c changing right away.
  4128. Unlike most other commands, the @code{add} command is
  4129. not recursive. You have to explicitly name files and
  4130. directories that you wish to add to the repository.
  4131. However, each directory will need to be added
  4132. separately before you will be able to add new files
  4133. to those directories.
  4134. @example
  4135. $ mkdir -p foo/bar
  4136. $ cp ~/myfile foo/bar/myfile
  4137. $ cvs add foo foo/bar
  4138. $ cvs add foo/bar/myfile
  4139. @end example
  4140. @cindex add (subcommand)
  4141. @deffn Command {cvs add} [@code{-k} kflag] [@code{-m} message] files @dots{}
  4142. Schedule @var{files} to be added to the repository.
  4143. The files or directories specified with @code{add} must
  4144. already exist in the current directory. To add a whole
  4145. new directory hierarchy to the source repository (for
  4146. example, files received from a third-party vendor), use
  4147. the @code{import} command instead. @xref{import}.
  4148. The added files are not placed in the source repository
  4149. until you use @code{commit} to make the change
  4150. permanent. Doing an @code{add} on a file that was
  4151. removed with the @code{remove} command will undo the
  4152. effect of the @code{remove}, unless a @code{commit}
  4153. command intervened. @xref{Removing files}, for an
  4154. example.
  4155. The @samp{-k} option specifies the default way that
  4156. this file will be checked out; for more information see
  4157. @ref{Substitution modes}.
  4158. @c As noted in BUGS, -m is broken client/server (Nov
  4159. @c 96). Also see testsuite log2-* tests.
  4160. The @samp{-m} option specifies a description for the
  4161. file. This description appears in the history log (if
  4162. it is enabled, @pxref{history file}). It will also be
  4163. saved in the version history inside the repository when
  4164. the file is committed. The @code{log} command displays
  4165. this description. The description can be changed using
  4166. @samp{admin -t}. @xref{admin}. If you omit the
  4167. @samp{-m @var{description}} flag, an empty string will
  4168. be used. You will not be prompted for a description.
  4169. @end deffn
  4170. For example, the following commands add the file
  4171. @file{backend.c} to the repository:
  4172. @c This example used to specify
  4173. @c -m "Optimizer and code generation passes."
  4174. @c to the cvs add command, but that doesn't work
  4175. @c client/server (see log2 in sanity.sh). Should fix CVS,
  4176. @c but also seems strange to document things which
  4177. @c don't work...
  4178. @example
  4179. $ cvs add backend.c
  4180. $ cvs commit -m "Early version. Not yet compilable." backend.c
  4181. @end example
  4182. When you add a file it is added only on the branch
  4183. which you are working on (@pxref{Branching and merging}). You can
  4184. later merge the additions to another branch if you want
  4185. (@pxref{Merging adds and removals}).
  4186. @c Should we mention that earlier versions of CVS
  4187. @c lacked this feature (1.3) or implemented it in a buggy
  4188. @c way (well, 1.8 had many bugs in cvs update -j)?
  4189. @c Should we mention the bug/limitation regarding a
  4190. @c file being a regular file on one branch and a directory
  4191. @c on another?
  4192. @c FIXME: This needs an example, or several, here or
  4193. @c elsewhere, for it to make much sense.
  4194. @c Somewhere we need to discuss the aspects of death
  4195. @c support which don't involve branching, I guess.
  4196. @c Like the ability to re-create a release from a tag.
  4197. @c ---------------------------------------------------------------------
  4198. @node Removing files
  4199. @section Removing files
  4200. @cindex Removing files
  4201. @cindex Deleting files
  4202. @c FIXME: this node wants to be split into several
  4203. @c smaller nodes. Could make these children of
  4204. @c "Adding and removing", probably (death support could
  4205. @c be its own section, for example, as could the
  4206. @c various bits about undoing mistakes in adding and
  4207. @c removing).
  4208. Directories change. New files are added, and old files
  4209. disappear. Still, you want to be able to retrieve an
  4210. exact copy of old releases.
  4211. Here is what you can do to remove a file,
  4212. but remain able to retrieve old revisions:
  4213. @itemize @bullet
  4214. @c FIXME: should probably be saying something about
  4215. @c having a working directory in the first place.
  4216. @item
  4217. Make sure that you have not made any uncommitted
  4218. modifications to the file. @xref{Viewing differences},
  4219. for one way to do that. You can also use the
  4220. @code{status} or @code{update} command. If you remove
  4221. the file without committing your changes, you will of
  4222. course not be able to retrieve the file as it was
  4223. immediately before you deleted it.
  4224. @item
  4225. Remove the file from your working copy of the directory.
  4226. You can for instance use @code{rm}.
  4227. @item
  4228. Use @samp{cvs remove @var{filename}} to tell @sc{cvs} that
  4229. you really want to delete the file.
  4230. @item
  4231. Use @samp{cvs commit @var{filename}} to actually
  4232. perform the removal of the file from the repository.
  4233. @end itemize
  4234. @c FIXME: Somehow this should be linked in with a more
  4235. @c general discussion of death support. I don't know
  4236. @c whether we want to use the term "death support" or
  4237. @c not (we can perhaps get by without it), but we do
  4238. @c need to discuss the "dead" state in "cvs log" and
  4239. @c related subjects. The current discussion is
  4240. @c scattered around, and not xref'd to each other.
  4241. @c FIXME: I think this paragraph wants to be moved
  4242. @c later down, at least after the first example.
  4243. When you commit the removal of the file, @sc{cvs}
  4244. records the fact that the file no longer exists. It is
  4245. possible for a file to exist on only some branches and
  4246. not on others, or to re-add another file with the same
  4247. name later. @sc{cvs} will correctly create or not create
  4248. the file, based on the @samp{-r} and @samp{-D} options
  4249. specified to @code{checkout} or @code{update}.
  4250. @c FIXME: This style seems to clash with how we
  4251. @c document things in general.
  4252. @cindex Remove (subcommand)
  4253. @deffn Command {cvs remove} [options] files @dots{}
  4254. Schedule file(s) to be removed from the repository
  4255. (files which have not already been removed from the
  4256. working directory are not processed). This command
  4257. does not actually remove the file from the repository
  4258. until you commit the removal. For a full list of
  4259. options, see @ref{Invoking CVS}.
  4260. @end deffn
  4261. Here is an example of removing several files:
  4262. @example
  4263. $ cd test
  4264. $ rm *.c
  4265. $ cvs remove
  4266. cvs remove: Removing .
  4267. cvs remove: scheduling a.c for removal
  4268. cvs remove: scheduling b.c for removal
  4269. cvs remove: use 'cvs commit' to remove these files permanently
  4270. $ cvs ci -m "Removed unneeded files"
  4271. cvs commit: Examining .
  4272. cvs commit: Committing .
  4273. @end example
  4274. As a convenience you can remove the file and @code{cvs
  4275. remove} it in one step, by specifying the @samp{-f}
  4276. option. For example, the above example could also be
  4277. done like this:
  4278. @example
  4279. $ cd test
  4280. $ cvs remove -f *.c
  4281. cvs remove: scheduling a.c for removal
  4282. cvs remove: scheduling b.c for removal
  4283. cvs remove: use 'cvs commit' to remove these files permanently
  4284. $ cvs ci -m "Removed unneeded files"
  4285. cvs commit: Examining .
  4286. cvs commit: Committing .
  4287. @end example
  4288. If you execute @code{remove} for a file, and then
  4289. change your mind before you commit, you can undo the
  4290. @code{remove} with an @code{add} command.
  4291. @ignore
  4292. @c is this worth saying or not? Somehow it seems
  4293. @c confusing to me.
  4294. Of course,
  4295. since you have removed your copy of file in the working
  4296. directory, @sc{cvs} does not necessarily bring back the
  4297. contents of the file from right before you executed
  4298. @code{remove}; instead it gets the file from the
  4299. repository again.
  4300. @end ignore
  4301. @c FIXME: what if you change your mind after you commit
  4302. @c it? (answer is also "cvs add" but we don't say that...).
  4303. @c We need some index entries for thinks like "undoing
  4304. @c removal" too.
  4305. @example
  4306. $ ls
  4307. CVS ja.h oj.c
  4308. $ rm oj.c
  4309. $ cvs remove oj.c
  4310. cvs remove: scheduling oj.c for removal
  4311. cvs remove: use 'cvs commit' to remove this file permanently
  4312. $ cvs add oj.c
  4313. U oj.c
  4314. cvs add: oj.c, version 1.1.1.1, resurrected
  4315. @end example
  4316. If you realize your mistake before you run the
  4317. @code{remove} command you can use @code{update} to
  4318. resurrect the file:
  4319. @example
  4320. $ rm oj.c
  4321. $ cvs update oj.c
  4322. cvs update: warning: oj.c was lost
  4323. U oj.c
  4324. @end example
  4325. When you remove a file it is removed only on the branch
  4326. which you are working on (@pxref{Branching and merging}). You can
  4327. later merge the removals to another branch if you want
  4328. (@pxref{Merging adds and removals}).
  4329. @node Removing directories
  4330. @section Removing directories
  4331. @cindex Removing directories
  4332. @cindex Directories, removing
  4333. In concept, removing directories is somewhat similar to
  4334. removing files---you want the directory to not exist in
  4335. your current working directories, but you also want to
  4336. be able to retrieve old releases in which the directory
  4337. existed.
  4338. The way that you remove a directory is to remove all
  4339. the files in it. You don't remove the directory
  4340. itself; there is no way to do that.
  4341. Instead you specify the @samp{-P} option to
  4342. @code{cvs update} or @code{cvs checkout},
  4343. which will cause @sc{cvs} to remove empty
  4344. directories from working directories.
  4345. (Note that @code{cvs export} always removes empty directories.)
  4346. Probably the
  4347. best way to do this is to always specify @samp{-P}; if
  4348. you want an empty directory then put a dummy file (for
  4349. example @file{.keepme}) in it to prevent @samp{-P} from
  4350. removing it.
  4351. @c I'd try to give a rationale for this, but I'm not
  4352. @c sure there is a particularly convincing one. What
  4353. @c we would _like_ is for CVS to do a better job of version
  4354. @c controlling whether directories exist, to eliminate the
  4355. @c need for -P and so that a file can be a directory in
  4356. @c one revision and a regular file in another.
  4357. Note that @samp{-P} is implied by the @samp{-r} or @samp{-D}
  4358. options of @code{checkout}. This way,
  4359. @sc{cvs} will be able to correctly create the directory
  4360. or not depending on whether the particular version you
  4361. are checking out contains any files in that directory.
  4362. @c ---------------------------------------------------------------------
  4363. @node Moving files
  4364. @section Moving and renaming files
  4365. @cindex Moving files
  4366. @cindex Renaming files
  4367. @cindex Files, moving
  4368. Moving files to a different directory or renaming them
  4369. is not difficult, but some of the ways in which this
  4370. works may be non-obvious. (Moving or renaming a
  4371. directory is even harder. @xref{Moving directories}.).
  4372. The examples below assume that the file @var{old} is renamed to
  4373. @var{new}.
  4374. @menu
  4375. * Outside:: The normal way to Rename
  4376. * Inside:: A tricky, alternative way
  4377. * Rename by copying:: Another tricky, alternative way
  4378. @end menu
  4379. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4380. @node Outside
  4381. @subsection The Normal way to Rename
  4382. @c More rename issues. Not sure whether these are
  4383. @c worth documenting; I'm putting them here because
  4384. @c it seems to be as good a place as any to try to
  4385. @c set down the issues.
  4386. @c * "cvs annotate" will annotate either the new
  4387. @c file or the old file; it cannot annotate _each
  4388. @c line_ based on whether it was last changed in the
  4389. @c new or old file. Unlike "cvs log", where the
  4390. @c consequences of having to select either the new
  4391. @c or old name seem fairly benign, this may be a
  4392. @c real advantage to having CVS know about renames
  4393. @c other than as a deletion and an addition.
  4394. The normal way to move a file is to copy @var{old} to
  4395. @var{new}, and then issue the normal @sc{cvs} commands
  4396. to remove @var{old} from the repository, and add
  4397. @var{new} to it.
  4398. @c The following sentence is not true: one must cd into
  4399. @c the directory to run "cvs add".
  4400. @c (Both @var{old} and @var{new} could
  4401. @c contain relative paths, for example @file{foo/bar.c}).
  4402. @example
  4403. $ mv @var{old} @var{new}
  4404. $ cvs remove @var{old}
  4405. $ cvs add @var{new}
  4406. $ cvs commit -m "Renamed @var{old} to @var{new}" @var{old} @var{new}
  4407. @end example
  4408. This is the simplest way to move a file, it is not
  4409. error-prone, and it preserves the history of what was
  4410. done. Note that to access the history of the file you
  4411. must specify the old or the new name, depending on what
  4412. portion of the history you are accessing. For example,
  4413. @code{cvs log @var{old}} will give the log up until the
  4414. time of the rename.
  4415. When @var{new} is committed its revision numbers will
  4416. start again, usually at 1.1, so if that bothers you,
  4417. use the @samp{-r rev} option to commit. For more
  4418. information see @ref{Assigning revisions}.
  4419. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4420. @node Inside
  4421. @subsection Moving the history file
  4422. This method is more dangerous, since it involves moving
  4423. files inside the repository. Read this entire section
  4424. before trying it out!
  4425. @example
  4426. $ cd $CVSROOT/@var{dir}
  4427. $ mv @var{old},v @var{new},v
  4428. @end example
  4429. @noindent
  4430. Advantages:
  4431. @itemize @bullet
  4432. @item
  4433. The log of changes is maintained intact.
  4434. @item
  4435. The revision numbers are not affected.
  4436. @end itemize
  4437. @noindent
  4438. Disadvantages:
  4439. @itemize @bullet
  4440. @item
  4441. Old releases cannot easily be fetched from the
  4442. repository. (The file will show up as @var{new} even
  4443. in revisions from the time before it was renamed).
  4444. @item
  4445. There is no log information of when the file was renamed.
  4446. @item
  4447. Nasty things might happen if someone accesses the history file
  4448. while you are moving it. Make sure no one else runs any of the @sc{cvs}
  4449. commands while you move it.
  4450. @end itemize
  4451. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4452. @node Rename by copying
  4453. @subsection Copying the history file
  4454. This way also involves direct modifications to the
  4455. repository. It is safe, but not without drawbacks.
  4456. @example
  4457. # @r{Copy the @sc{rcs} file inside the repository}
  4458. $ cd $CVSROOT/@var{dir}
  4459. $ cp @var{old},v @var{new},v
  4460. # @r{Remove the old file}
  4461. $ cd ~/@var{dir}
  4462. $ rm @var{old}
  4463. $ cvs remove @var{old}
  4464. $ cvs commit @var{old}
  4465. # @r{Remove all tags from @var{new}}
  4466. $ cvs update @var{new}
  4467. $ cvs log @var{new} # @r{Remember the non-branch tag names}
  4468. $ cvs tag -d @var{tag1} @var{new}
  4469. $ cvs tag -d @var{tag2} @var{new}
  4470. @dots{}
  4471. @end example
  4472. By removing the tags you will be able to check out old
  4473. revisions.
  4474. @noindent
  4475. Advantages:
  4476. @itemize @bullet
  4477. @item
  4478. @c FIXME: Is this true about -D now that we have death
  4479. @c support? See 5B.3 in the FAQ.
  4480. Checking out old revisions works correctly, as long as
  4481. you use @samp{-r@var{tag}} and not @samp{-D@var{date}}
  4482. to retrieve the revisions.
  4483. @item
  4484. The log of changes is maintained intact.
  4485. @item
  4486. The revision numbers are not affected.
  4487. @end itemize
  4488. @noindent
  4489. Disadvantages:
  4490. @itemize @bullet
  4491. @item
  4492. You cannot easily see the history of the file across the rename.
  4493. @ignore
  4494. @c Is this true? I don't see how the revision numbers
  4495. @c _could_ start over, when new,v is just old,v with
  4496. @c the tags deleted.
  4497. @c If there is some need to reinstate this text,
  4498. @c it is "usually 1.1", not "1.0" and it needs an
  4499. @c xref to Assigning revisions
  4500. @item
  4501. Unless you use the @samp{-r rev} (@pxref{commit
  4502. options}) flag when @var{new} is committed its revision
  4503. numbers will start at 1.0 again.
  4504. @end ignore
  4505. @end itemize
  4506. @c ---------------------------------------------------------------------
  4507. @node Moving directories
  4508. @section Moving and renaming directories
  4509. @cindex Moving directories
  4510. @cindex Renaming directories
  4511. @cindex Directories, moving
  4512. The normal way to rename or move a directory is to
  4513. rename or move each file within it as described in
  4514. @ref{Outside}. Then check out with the @samp{-P}
  4515. option, as described in @ref{Removing directories}.
  4516. If you really want to hack the repository to rename or
  4517. delete a directory in the repository, you can do it
  4518. like this:
  4519. @enumerate
  4520. @item
  4521. Inform everyone who has a checked out copy of the directory that the
  4522. directory will be renamed. They should commit all their changes in all their
  4523. copies of the project containing the directory to be removed, and remove
  4524. all their working copies of said project, before you take the steps below.
  4525. @item
  4526. Rename the directory inside the repository.
  4527. @example
  4528. $ cd $CVSROOT/@var{parent-dir}
  4529. $ mv @var{old-dir} @var{new-dir}
  4530. @end example
  4531. @item
  4532. Fix the @sc{cvs} administrative files, if necessary (for
  4533. instance if you renamed an entire module).
  4534. @item
  4535. Tell everyone that they can check out again and continue
  4536. working.
  4537. @end enumerate
  4538. If someone had a working copy the @sc{cvs} commands will
  4539. cease to work for him, until he removes the directory
  4540. that disappeared inside the repository.
  4541. It is almost always better to move the files in the
  4542. directory instead of moving the directory. If you move the
  4543. directory you are unlikely to be able to retrieve old
  4544. releases correctly, since they probably depend on the
  4545. name of the directories.
  4546. @c ---------------------------------------------------------------------
  4547. @node History browsing
  4548. @chapter History browsing
  4549. @cindex History browsing
  4550. @cindex Traceability
  4551. @cindex Isolation
  4552. @ignore
  4553. @c This is too long for an introduction (goal is
  4554. @c one 20x80 character screen), and also mixes up a
  4555. @c variety of issues (parallel development, history,
  4556. @c maybe even touches on process control).
  4557. @c -- @quote{To lose ones history is to lose ones soul.}
  4558. @c -- ///
  4559. @c -- ///Those who cannot remember the past are condemned to repeat it.
  4560. @c -- /// -- George Santayana
  4561. @c -- ///
  4562. @sc{cvs} tries to make it easy for a group of people to work
  4563. together. This is done in two ways:
  4564. @itemize @bullet
  4565. @item
  4566. Isolation---You have your own working copy of the
  4567. source. You are not affected by modifications made by
  4568. others until you decide to incorporate those changes
  4569. (via the @code{update} command---@pxref{update}).
  4570. @item
  4571. Traceability---When something has changed, you can
  4572. always see @emph{exactly} what changed.
  4573. @end itemize
  4574. There are several features of @sc{cvs} that together lead
  4575. to traceability:
  4576. @itemize @bullet
  4577. @item
  4578. Each revision of a file has an accompanying log
  4579. message.
  4580. @item
  4581. All commits are optionally logged to a central history
  4582. database.
  4583. @item
  4584. Logging information can be sent to a user-defined
  4585. program (@pxref{loginfo}).
  4586. @end itemize
  4587. @c -- More text here.
  4588. This chapter should talk about the history file, the
  4589. @code{log} command, the usefulness of ChangeLogs
  4590. even when you run @sc{cvs}, and things like that.
  4591. @end ignore
  4592. @c kind of lame, in a lot of ways the above text inside
  4593. @c the @ignore motivates this chapter better
  4594. Once you have used @sc{cvs} to store a version control
  4595. history---what files have changed when, how, and by
  4596. whom, there are a variety of mechanisms for looking
  4597. through the history.
  4598. @c FIXME: should also be talking about how you look at
  4599. @c old revisions (e.g. "cvs update -p -r 1.2 foo.c").
  4600. @menu
  4601. * log messages:: Log messages
  4602. * history database:: The history database
  4603. * user-defined logging:: User-defined logging
  4604. @end menu
  4605. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4606. @node log messages
  4607. @section Log messages
  4608. @c FIXME: @xref to place where we talk about how to
  4609. @c specify message to commit.
  4610. Whenever you commit a file you specify a log message.
  4611. @c FIXME: bring the information here, and get rid of or
  4612. @c greatly shrink the "log" node.
  4613. To look through the log messages which have been
  4614. specified for every revision which has been committed,
  4615. use the @code{cvs log} command (@pxref{log}).
  4616. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4617. @node history database
  4618. @section The history database
  4619. @c FIXME: bring the information from the history file
  4620. @c and history nodes here. Rewrite it to be motivated
  4621. @c better (start out by clearly explaining what gets
  4622. @c logged in history, for example).
  4623. You can use the history file (@pxref{history file}) to
  4624. log various @sc{cvs} actions. To retrieve the
  4625. information from the history file, use the @code{cvs
  4626. history} command (@pxref{history}).
  4627. Note: you can control what is logged to this file by using the
  4628. @samp{LogHistory} keyword in the @file{CVSROOT/config} file
  4629. (@pxref{config}).
  4630. @c
  4631. @c The history database has many problems:
  4632. @c * It is very unclear what field means what. This
  4633. @c could be improved greatly by better documentation,
  4634. @c but there are still non-orthogonalities (for
  4635. @c example, tag does not record the "repository"
  4636. @c field but most records do).
  4637. @c * Confusion about files, directories, and modules.
  4638. @c Some commands record one, some record others.
  4639. @c * File removal is not logged. There is an 'R'
  4640. @c record type documented, but CVS never uses it.
  4641. @c * Tags are only logged for the "cvs rtag" command,
  4642. @c not "cvs tag". The fix for this is not completely
  4643. @c clear (see above about modules vs. files).
  4644. @c * Are there other cases of operations that are not
  4645. @c logged? One would hope for all changes to the
  4646. @c repository to be logged somehow (particularly
  4647. @c operations like tagging, "cvs admin -k", and other
  4648. @c operations which do not record a history that one
  4649. @c can get with "cvs log"). Operations on the working
  4650. @c directory, like export, get, and release, are a
  4651. @c second category also covered by the current "cvs
  4652. @c history".
  4653. @c * The history file does not record the options given
  4654. @c to a command. The most serious manifestation of
  4655. @c this is perhaps that it doesn't record whether a command
  4656. @c was recursive. It is not clear to me whether one
  4657. @c wants to log at a level very close to the command
  4658. @c line, as a sort of way of logging each command
  4659. @c (more or less), or whether one wants
  4660. @c to log more at the level of what was changed (or
  4661. @c something in between), but either way the current
  4662. @c information has pretty big gaps.
  4663. @c * Further details about a tag--like whether it is a
  4664. @c branch tag or, if a non-branch tag, which branch it
  4665. @c is on. One can find out this information about the
  4666. @c tag as it exists _now_, but if the tag has been
  4667. @c moved, one doesn't know what it was like at the time
  4668. @c the history record was written.
  4669. @c * Whether operating on a particular tag, date, or
  4670. @c options was implicit (sticky) or explicit.
  4671. @c
  4672. @c Another item, only somewhat related to the above, is a
  4673. @c way to control what is logged in the history file.
  4674. @c This is probably the only good way to handle
  4675. @c different people having different ideas about
  4676. @c information/space tradeoffs.
  4677. @c
  4678. @c It isn't really clear that it makes sense to try to
  4679. @c patch up the history file format as it exists now to
  4680. @c include all that stuff. It might be better to
  4681. @c design a whole new CVSROOT/nhistory file and "cvs
  4682. @c nhistory" command, or some such, or in some other
  4683. @c way trying to come up with a clean break from the
  4684. @c past, which can address the above concerns. Another
  4685. @c open question is how/whether this relates to
  4686. @c taginfo/loginfo/etc.
  4687. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4688. @node user-defined logging
  4689. @section User-defined logging
  4690. @c FIXME: probably should centralize this information
  4691. @c here, at least to some extent. Maybe by moving the
  4692. @c loginfo, etc., nodes here and replacing
  4693. @c the "user-defined logging" node with one node for
  4694. @c each method.
  4695. You can customize @sc{cvs} to log various kinds of
  4696. actions, in whatever manner you choose. These
  4697. mechanisms operate by executing a script at various
  4698. times. The script might append a message to a file
  4699. listing the information and the programmer who created
  4700. it, or send mail to a group of developers, or, perhaps,
  4701. post a message to a particular newsgroup. To log
  4702. commits, use the @file{loginfo} file (@pxref{loginfo}).
  4703. To log tags, use the @file{taginfo} file (@pxref{taginfo}).
  4704. @c FIXME: What is difference between doing it in the
  4705. @c modules file and using loginfo/taginfo? Why should
  4706. @c user use one or the other?
  4707. To log checkouts, exports, and tags,
  4708. respectively, you can also use the
  4709. @samp{-o}, @samp{-e}, and @samp{-t} options in the
  4710. modules file. For a more flexible way of giving
  4711. notifications to various users, which requires less in
  4712. the way of keeping centralized scripts up to date, use
  4713. the @code{cvs watch add} command (@pxref{Getting
  4714. Notified}); this command is useful even if you are not
  4715. using @code{cvs watch on}.
  4716. @c ---------------------------------------------------------------------
  4717. @node Binary files
  4718. @chapter Handling binary files
  4719. @cindex Binary files
  4720. The most common use for @sc{cvs} is to store text
  4721. files. With text files, @sc{cvs} can merge revisions,
  4722. display the differences between revisions in a
  4723. human-visible fashion, and other such operations.
  4724. However, if you are willing to give up a few of these
  4725. abilities, @sc{cvs} can store binary files. For
  4726. example, one might store a web site in @sc{cvs}
  4727. including both text files and binary images.
  4728. @menu
  4729. * Binary why:: More details on issues with binary files
  4730. * Binary howto:: How to store them
  4731. @end menu
  4732. @node Binary why
  4733. @section The issues with binary files
  4734. While the need to manage binary files may seem obvious
  4735. if the files that you customarily work with are binary,
  4736. putting them into version control does present some
  4737. additional issues.
  4738. One basic function of version control is to show the
  4739. differences between two revisions. For example, if
  4740. someone else checked in a new version of a file, you
  4741. may wish to look at what they changed and determine
  4742. whether their changes are good. For text files,
  4743. @sc{cvs} provides this functionality via the @code{cvs
  4744. diff} command. For binary files, it may be possible to
  4745. extract the two revisions and then compare them with a
  4746. tool external to @sc{cvs} (for example, word processing
  4747. software often has such a feature). If there is no
  4748. such tool, one must track changes via other mechanisms,
  4749. such as urging people to write good log messages, and
  4750. hoping that the changes they actually made were the
  4751. changes that they intended to make.
  4752. Another ability of a version control system is the
  4753. ability to merge two revisions. For @sc{cvs} this
  4754. happens in two contexts. The first is when users make
  4755. changes in separate working directories
  4756. (@pxref{Multiple developers}). The second is when one
  4757. merges explicitly with the @samp{update -j} command
  4758. (@pxref{Branching and merging}).
  4759. In the case of text
  4760. files, @sc{cvs} can merge changes made independently,
  4761. and signal a conflict if the changes conflict. With
  4762. binary files, the best that @sc{cvs} can do is present
  4763. the two different copies of the file, and leave it to
  4764. the user to resolve the conflict. The user may choose
  4765. one copy or the other, or may run an external merge
  4766. tool which knows about that particular file format, if
  4767. one exists.
  4768. Note that having the user merge relies primarily on the
  4769. user to not accidentally omit some changes, and thus is
  4770. potentially error prone.
  4771. If this process is thought to be undesirable, the best
  4772. choice may be to avoid merging. To avoid the merges
  4773. that result from separate working directories, see the
  4774. discussion of reserved checkouts (file locking) in
  4775. @ref{Multiple developers}. To avoid the merges
  4776. resulting from branches, restrict use of branches.
  4777. @node Binary howto
  4778. @section How to store binary files
  4779. There are two issues with using @sc{cvs} to store
  4780. binary files. The first is that @sc{cvs} by default
  4781. converts line endings between the canonical form in
  4782. which they are stored in the repository (linefeed
  4783. only), and the form appropriate to the operating system
  4784. in use on the client (for example, carriage return
  4785. followed by line feed for Windows NT).
  4786. The second is that a binary file might happen to
  4787. contain data which looks like a keyword (@pxref{Keyword
  4788. substitution}), so keyword expansion must be turned
  4789. off.
  4790. @c FIXME: the third is that one can't do merges with
  4791. @c binary files. xref to Multiple Developers and the
  4792. @c reserved checkout issues.
  4793. The @samp{-kb} option available with some @sc{cvs}
  4794. commands insures that neither line ending conversion
  4795. nor keyword expansion will be done.
  4796. Here is an example of how you can create a new file
  4797. using the @samp{-kb} flag:
  4798. @example
  4799. $ echo '$@splitrcskeyword{Id}$' > kotest
  4800. $ cvs add -kb -m"A test file" kotest
  4801. $ cvs ci -m"First checkin; contains a keyword" kotest
  4802. @end example
  4803. If a file accidentally gets added without @samp{-kb},
  4804. one can use the @code{cvs admin} command to recover.
  4805. For example:
  4806. @example
  4807. $ echo '$@splitrcskeyword{Id}$' > kotest
  4808. $ cvs add -m"A test file" kotest
  4809. $ cvs ci -m"First checkin; contains a keyword" kotest
  4810. $ cvs admin -kb kotest
  4811. $ cvs update -A kotest
  4812. # @r{For non-unix systems:}
  4813. # @r{Copy in a good copy of the file from outside CVS}
  4814. $ cvs commit -m "make it binary" kotest
  4815. @end example
  4816. @c Trying to describe this for both unix and non-unix
  4817. @c in the same description is very confusing. Might
  4818. @c want to split the two, or just ditch the unix "shortcut"
  4819. @c (unixheads don't do much with binary files, anyway).
  4820. @c This used to say "(Try the above example, and do a
  4821. @c @code{cat kotest} after every command)". But that
  4822. @c only really makes sense for the unix case.
  4823. When you check in the file @file{kotest} the file is
  4824. not preserved as a binary file, because you did not
  4825. check it in as a binary file. The @code{cvs
  4826. admin -kb} command sets the default keyword
  4827. substitution method for this file, but it does not
  4828. alter the working copy of the file that you have. If you need to
  4829. cope with line endings (that is, you are using
  4830. @sc{cvs} on a non-unix system), then you need to
  4831. check in a new copy of the file, as shown by the
  4832. @code{cvs commit} command above.
  4833. On unix, the @code{cvs update -A} command suffices.
  4834. @c FIXME: should also describe what the *other users*
  4835. @c need to do, if they have checked out copies which
  4836. @c have been corrupted by lack of -kb. I think maybe
  4837. @c "cvs update -kb" or "cvs
  4838. @c update -A" would suffice, although the user who
  4839. @c reported this suggested removing the file, manually
  4840. @c removing it from CVS/Entries, and then "cvs update"
  4841. (Note that you can use @code{cvs log} to determine the default keyword
  4842. substitution method for a file and @code{cvs status} to determine
  4843. the keyword substitution method for a working copy.)
  4844. However, in using @code{cvs admin -k} to change the
  4845. keyword expansion, be aware that the keyword expansion
  4846. mode is not version controlled. This means that, for
  4847. example, that if you have a text file in old releases,
  4848. and a binary file with the same name in new releases,
  4849. @sc{cvs} provides no way to check out the file in text
  4850. or binary mode depending on what version you are
  4851. checking out. There is no good workaround for this
  4852. problem.
  4853. You can also set a default for whether @code{cvs add}
  4854. and @code{cvs import} treat a file as binary based on
  4855. its name; for example you could say that files who
  4856. names end in @samp{.exe} are binary. @xref{Wrappers}.
  4857. There is currently no way to have @sc{cvs} detect
  4858. whether a file is binary based on its contents. The
  4859. main difficulty with designing such a feature is that
  4860. it is not clear how to distinguish between binary and
  4861. non-binary files, and the rules to apply would vary
  4862. considerably with the operating system.
  4863. @c For example, it would be good on MS-DOS-family OSes
  4864. @c for anything containing ^Z to be binary. Having
  4865. @c characters with the 8th bit set imply binary is almost
  4866. @c surely a bad idea in the context of ISO-8859-* and
  4867. @c other such character sets. On VMS or the Mac, we
  4868. @c could use the OS's file typing. This is a
  4869. @c commonly-desired feature, and something of this sort
  4870. @c may make sense. But there are a lot of pitfalls here.
  4871. @c
  4872. @c Another, probably better, way to tell is to read the
  4873. @c file in text mode, write it to a temp file in text
  4874. @c mode, and then do a binary mode compare of the two
  4875. @c files. If they differ, it is a binary file. This
  4876. @c might have problems on VMS (or some other system
  4877. @c with several different text modes), but in general
  4878. @c should be relatively portable. The only other
  4879. @c downside I can think of is that it would be fairly
  4880. @c slow, but that is perhaps a small price to pay for
  4881. @c not having your files corrupted. Another issue is
  4882. @c what happens if you import a text file with bare
  4883. @c linefeeds on Windows. Such files will show up on
  4884. @c Windows sometimes (I think some native windows
  4885. @c programs even write them, on occasion). Perhaps it
  4886. @c is reasonable to treat such files as binary; after
  4887. @c all it is something of a presumption to assume that
  4888. @c the user would want the linefeeds converted to CRLF.
  4889. @c ---------------------------------------------------------------------
  4890. @node Multiple developers
  4891. @chapter Multiple developers
  4892. @cindex Multiple developers
  4893. @cindex Team of developers
  4894. @cindex File locking
  4895. @cindex Locking files
  4896. @cindex Working copy
  4897. @cindex Reserved checkouts
  4898. @cindex Unreserved checkouts
  4899. @cindex RCS-style locking
  4900. When more than one person works on a software project
  4901. things often get complicated. Often, two people try to
  4902. edit the same file simultaneously. One solution, known
  4903. as @dfn{file locking} or @dfn{reserved checkouts}, is
  4904. to allow only one person to edit each file at a time.
  4905. This is the only solution with some version control
  4906. systems, including @sc{rcs} and @sc{sccs}. Currently
  4907. the usual way to get reserved checkouts with @sc{cvs}
  4908. is the @code{cvs admin -l} command (@pxref{admin
  4909. options}). This is not as nicely integrated into
  4910. @sc{cvs} as the watch features, described below, but it
  4911. seems that most people with a need for reserved
  4912. checkouts find it adequate.
  4913. @c Or "find it better than worrying about implementing
  4914. @c nicely integrated reserved checkouts" or ...?
  4915. It also may be possible to use the watches
  4916. features described below, together with suitable
  4917. procedures (not enforced by software), to avoid having
  4918. two people edit at the same time.
  4919. @c Our unreserved checkout model might not
  4920. @c be quite the same as others. For example, I
  4921. @c think that some systems will tend to create a branch
  4922. @c in the case where CVS prints "up-to-date check failed".
  4923. @c It isn't clear to me whether we should try to
  4924. @c explore these subtleties; it could easily just
  4925. @c confuse people.
  4926. The default model with @sc{cvs} is known as
  4927. @dfn{unreserved checkouts}. In this model, developers
  4928. can edit their own @dfn{working copy} of a file
  4929. simultaneously. The first person that commits his
  4930. changes has no automatic way of knowing that another
  4931. has started to edit it. Others will get an error
  4932. message when they try to commit the file. They must
  4933. then use @sc{cvs} commands to bring their working copy
  4934. up to date with the repository revision. This process
  4935. is almost automatic.
  4936. @c FIXME? should probably use the word "watch" here, to
  4937. @c tie this into the text below and above.
  4938. @sc{cvs} also supports mechanisms which facilitate
  4939. various kinds of communication, without actually
  4940. enforcing rules like reserved checkouts do.
  4941. The rest of this chapter describes how these various
  4942. models work, and some of the issues involved in
  4943. choosing between them.
  4944. @ignore
  4945. Here is a draft reserved checkout design or discussion
  4946. of the issues. This seems like as good a place as any
  4947. for this.
  4948. Might want a cvs lock/cvs unlock--in which the names
  4949. differ from edit/unedit because the network must be up
  4950. for these to work. unedit gives an error if there is a
  4951. reserved checkout in place (so that people don't
  4952. accidentally leave locks around); unlock gives an error
  4953. if one is not in place (this is more arguable; perhaps
  4954. it should act like unedit in that case).
  4955. On the other hand, might want it so that emacs,
  4956. scripts, etc., can get ready to edit a file without
  4957. having to know which model is in use. In that case we
  4958. would have a "cvs watch lock" (or .cvsrc?) (that is,
  4959. three settings, "on", "off", and "lock"). Having cvs
  4960. watch lock set would cause a get to record in the CVS
  4961. directory which model is in use, and cause "cvs edit"
  4962. to change behaviors. We'd want a way to query which
  4963. setting is in effect (this would be handy even if it is
  4964. only "on" or "off" as presently). If lock is in
  4965. effect, then commit would require a lock before
  4966. allowing a checkin; chmod wouldn't suffice (might be
  4967. debatable--see chmod comment below, in watches--but it
  4968. is the way people expect RCS to work and I can't think
  4969. of any significant downside. On the other hand, maybe
  4970. it isn't worth bothering, because people who are used
  4971. to RCS wouldn't think to use chmod anyway).
  4972. Implementation: use file attributes or use RCS
  4973. locking. The former avoids more dependence on RCS
  4974. behaviors we will need to re-implement as we librarify
  4975. RCS, and makes it easier to import/export RCS files (in
  4976. that context, want to ignore the locker field). But
  4977. note that RCS locks are per-branch, which is the
  4978. correct behavior (this is also an issue for the "watch
  4979. on" features; they should be per-branch too).
  4980. Here are a few more random notes about implementation
  4981. details, assuming "cvs watch lock" and
  4982. CVS/Watched file? Or try to fit this into CVS/Entries somehow?
  4983. Cases: (1) file is checked out (unreserved or with watch on) by old
  4984. version of @sc{cvs}, now we do something with new one, (2) file is checked
  4985. out by new version, now we do something with old one.
  4986. Remote protocol would have a "Watched" analogous to "Mode". Of course
  4987. it would apply to all Updated-like requests. How do we keep this
  4988. setting up to date? I guess that there wants to be a Watched request,
  4989. and the server would send a new one if it isn't up to date? (Ugh--hard
  4990. to implement and slows down "cvs -q update"--is there an easier way?)
  4991. "cvs edit"--checks CVS/Watched, and if watch lock, then sends
  4992. "edit-lock" request. Which comes back with a Checked-in with
  4993. appropriate Watched (off, on, lock, locked, or some such?), or error
  4994. message if already locked.
  4995. "cvs commit"--only will commit if off/on/locked. lock is not OK.
  4996. Doc:
  4997. note that "cvs edit" must be connected to network if watch lock is in
  4998. effect.
  4999. Talk about what to do if someone has locked a file and you want to
  5000. edit that file. (breaking locks, or lack thereof).
  5001. One other idea (which could work along with the
  5002. existing "cvs admin -l" reserved checkouts, as well as
  5003. the above):
  5004. "cvs editors" could show who has the file locked, if
  5005. someone does.
  5006. @end ignore
  5007. @menu
  5008. * File status:: A file can be in several states
  5009. * Updating a file:: Bringing a file up-to-date
  5010. * Conflicts example:: An informative example
  5011. * Informing others:: To cooperate you must inform
  5012. * Concurrency:: Simultaneous repository access
  5013. * Watches:: Mechanisms to track who is editing files
  5014. * Choosing a model:: Reserved or unreserved checkouts?
  5015. @end menu
  5016. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5017. @node File status
  5018. @section File status
  5019. @cindex File status
  5020. @cindex Status of a file
  5021. @c Shouldn't this start with an example or something,
  5022. @c introducing the unreserved checkout model? Before we
  5023. @c dive into listing states?
  5024. Based on what operations you have performed on a
  5025. checked out file, and what operations others have
  5026. performed to that file in the repository, one can
  5027. classify a file in a number of states. The states, as
  5028. reported by the @code{status} command, are:
  5029. @c The order of items is chosen to group logically
  5030. @c similar outputs together.
  5031. @c People who want alphabetical can use the index...
  5032. @table @asis
  5033. @cindex Up-to-date
  5034. @item Up-to-date
  5035. The file is identical with the latest revision in the
  5036. repository for the branch in use.
  5037. @c FIXME: should we clarify "in use"? The answer is
  5038. @c sticky tags, and trying to distinguish branch sticky
  5039. @c tags from non-branch sticky tags seems rather awkward
  5040. @c here.
  5041. @c FIXME: What happens with non-branch sticky tags? Is
  5042. @c a stuck file "Up-to-date" or "Needs checkout" or what?
  5043. @item Locally Modified
  5044. @cindex Locally Modified
  5045. You have edited the file, and not yet committed your changes.
  5046. @item Locally Added
  5047. @cindex Locally Added
  5048. You have added the file with @code{add}, and not yet
  5049. committed your changes.
  5050. @c There are many cases involving the file being
  5051. @c added/removed/modified in the working directory, and
  5052. @c added/removed/modified in the repository, which we
  5053. @c don't try to describe here. I'm not sure that "cvs
  5054. @c status" produces a non-confusing output in most of
  5055. @c those cases.
  5056. @item Locally Removed
  5057. @cindex Locally Removed
  5058. You have removed the file with @code{remove}, and not yet
  5059. committed your changes.
  5060. @item Needs Checkout
  5061. @cindex Needs Checkout
  5062. Someone else has committed a newer revision to the
  5063. repository. The name is slightly misleading; you will
  5064. ordinarily use @code{update} rather than
  5065. @code{checkout} to get that newer revision.
  5066. @item Needs Patch
  5067. @cindex Needs Patch
  5068. @c See also newb-123j0 in sanity.sh (although that case
  5069. @c should probably be changed rather than documented).
  5070. Like Needs Checkout, but the @sc{cvs} server will send
  5071. a patch rather than the entire file. Sending a patch or
  5072. sending an entire file accomplishes the same thing.
  5073. @item Needs Merge
  5074. @cindex Needs Merge
  5075. Someone else has committed a newer revision to the repository, and you
  5076. have also made modifications to the file.
  5077. @item Unresolved Conflict
  5078. @cindex Unresolved Conflict
  5079. @c FIXCVS - This file status needs to be changed to some more informative
  5080. @c text that distinguishes it more clearly from each of the Locally Added,
  5081. @c File had conflicts on merge, and Unknown status types, but an exact and
  5082. @c succinct wording escapes me at the moment.
  5083. A file with the same name as this new file has been added to the repository
  5084. from a second workspace. This file will need to be moved out of the way
  5085. to allow an @code{update} to complete.
  5086. @item File had conflicts on merge
  5087. @cindex File had conflicts on merge
  5088. @c is it worth saying that this message was "Unresolved
  5089. @c Conflict" in CVS 1.9 and earlier? I'm inclined to
  5090. @c think that is unnecessarily confusing to new users.
  5091. This is like Locally Modified, except that a previous
  5092. @code{update} command gave a conflict. If you have not
  5093. already done so, you need to
  5094. resolve the conflict as described in @ref{Conflicts example}.
  5095. @item Unknown
  5096. @cindex Unknown
  5097. @sc{cvs} doesn't know anything about this file. For
  5098. example, you have created a new file and have not run
  5099. @code{add}.
  5100. @c
  5101. @c "Entry Invalid" and "Classify Error" are also in the
  5102. @c status.c. The latter definitely indicates a CVS bug
  5103. @c (should it be worded more like "internal error" so
  5104. @c people submit bug reports if they see it?). The former
  5105. @c I'm not as sure; I haven't tracked down whether/when it
  5106. @c appears in "cvs status" output.
  5107. @end table
  5108. To help clarify the file status, @code{status} also
  5109. reports the @code{Working revision} which is the
  5110. revision that the file in the working directory derives
  5111. from, and the @code{Repository revision} which is the
  5112. latest revision in the repository for the branch in
  5113. use.
  5114. @c FIXME: should we clarify "in use"? The answer is
  5115. @c sticky tags, and trying to distinguish branch sticky
  5116. @c tags from non-branch sticky tags seems rather awkward
  5117. @c here.
  5118. @c FIXME: What happens with non-branch sticky tags?
  5119. @c What is the Repository Revision there? See the
  5120. @c comment at vn_rcs in cvs.h, which is kind of
  5121. @c confused--we really need to document better what this
  5122. @c field contains.
  5123. @c Q: Should we document "New file!" and other such
  5124. @c outputs or are they self-explanatory?
  5125. @c FIXME: what about the date to the right of "Working
  5126. @c revision"? It doesn't appear with client/server and
  5127. @c seems unnecessary (redundant with "ls -l") so
  5128. @c perhaps it should be removed for non-client/server too?
  5129. @c FIXME: Need some examples.
  5130. @c FIXME: Working revision can also be something like
  5131. @c "-1.3" for a locally removed file. Not at all
  5132. @c self-explanatory (and it is possible that CVS should
  5133. @c be changed rather than documenting this).
  5134. @c Would be nice to have an @example showing output
  5135. @c from cvs status, with comments showing the xref
  5136. @c where each part of the output is described. This
  5137. @c might fit in nicely if it is desirable to split this
  5138. @c node in two; one to introduce "cvs status" and one
  5139. @c to list each of the states.
  5140. The options to @code{status} are listed in
  5141. @ref{Invoking CVS}. For information on its @code{Sticky tag}
  5142. and @code{Sticky date} output, see @ref{Sticky tags}.
  5143. For information on its @code{Sticky options} output,
  5144. see the @samp{-k} option in @ref{update options}.
  5145. You can think of the @code{status} and @code{update}
  5146. commands as somewhat complementary. You use
  5147. @code{update} to bring your files up to date, and you
  5148. can use @code{status} to give you some idea of what an
  5149. @code{update} would do (of course, the state of the
  5150. repository might change before you actually run
  5151. @code{update}). In fact, if you want a command to
  5152. display file status in a more brief format than is
  5153. displayed by the @code{status} command, you can invoke
  5154. @cindex update, to display file status
  5155. @example
  5156. $ cvs -n -q update
  5157. @end example
  5158. The @samp{-n} option means to not actually do the
  5159. update, but merely to display statuses; the @samp{-q}
  5160. option avoids printing the name of each directory. For
  5161. more information on the @code{update} command, and
  5162. these options, see @ref{Invoking CVS}.
  5163. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5164. @node Updating a file
  5165. @section Bringing a file up to date
  5166. @cindex Bringing a file up to date
  5167. @cindex Updating a file
  5168. @cindex Merging a file
  5169. @cindex Update, introduction
  5170. When you want to update or merge a file, use the @code{cvs update -d}
  5171. command. For files that are not up to date this is roughly equivalent
  5172. to a @code{checkout} command: the newest revision of the file is
  5173. extracted from the repository and put in your working directory. The
  5174. @code{-d} option, not necessary with @code{checkout}, tells @sc{cvs}
  5175. that you wish it to create directories added by other developers.
  5176. Your modifications to a file are never lost when you
  5177. use @code{update}. If no newer revision exists,
  5178. running @code{update} has no effect. If you have
  5179. edited the file, and a newer revision is available,
  5180. @sc{cvs} will merge all changes into your working copy.
  5181. For instance, imagine that you checked out revision 1.4 and started
  5182. editing it. In the meantime someone else committed revision 1.5, and
  5183. shortly after that revision 1.6. If you run @code{update} on the file
  5184. now, @sc{cvs} will incorporate all changes between revision 1.4 and 1.6 into
  5185. your file.
  5186. @cindex Overlap
  5187. If any of the changes between 1.4 and 1.6 were made too
  5188. close to any of the changes you have made, an
  5189. @dfn{overlap} occurs. In such cases a warning is
  5190. printed, and the resulting file includes both
  5191. versions of the lines that overlap, delimited by
  5192. special markers.
  5193. @xref{update}, for a complete description of the
  5194. @code{update} command.
  5195. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5196. @node Conflicts example
  5197. @section Conflicts example
  5198. @cindex Merge, an example
  5199. @cindex Example of merge
  5200. @cindex driver.c (merge example)
  5201. Suppose revision 1.4 of @file{driver.c} contains this:
  5202. @example
  5203. #include <stdio.h>
  5204. void main()
  5205. @{
  5206. parse();
  5207. if (nerr == 0)
  5208. gencode();
  5209. else
  5210. fprintf(stderr, "No code generated.\n");
  5211. exit(nerr == 0 ? 0 : 1);
  5212. @}
  5213. @end example
  5214. @noindent
  5215. Revision 1.6 of @file{driver.c} contains this:
  5216. @example
  5217. #include <stdio.h>
  5218. int main(int argc,
  5219. char **argv)
  5220. @{
  5221. parse();
  5222. if (argc != 1)
  5223. @{
  5224. fprintf(stderr, "tc: No args expected.\n");
  5225. exit(1);
  5226. @}
  5227. if (nerr == 0)
  5228. gencode();
  5229. else
  5230. fprintf(stderr, "No code generated.\n");
  5231. exit(!!nerr);
  5232. @}
  5233. @end example
  5234. @noindent
  5235. Your working copy of @file{driver.c}, based on revision
  5236. 1.4, contains this before you run @samp{cvs update}:
  5237. @c -- Really include "cvs"?
  5238. @example
  5239. #include <stdlib.h>
  5240. #include <stdio.h>
  5241. void main()
  5242. @{
  5243. init_scanner();
  5244. parse();
  5245. if (nerr == 0)
  5246. gencode();
  5247. else
  5248. fprintf(stderr, "No code generated.\n");
  5249. exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
  5250. @}
  5251. @end example
  5252. @noindent
  5253. You run @samp{cvs update}:
  5254. @c -- Really include "cvs"?
  5255. @example
  5256. $ cvs update driver.c
  5257. RCS file: /usr/local/cvsroot/yoyodyne/tc/driver.c,v
  5258. retrieving revision 1.4
  5259. retrieving revision 1.6
  5260. Merging differences between 1.4 and 1.6 into driver.c
  5261. rcsmerge warning: overlaps during merge
  5262. cvs update: conflicts found in driver.c
  5263. C driver.c
  5264. @end example
  5265. @noindent
  5266. @cindex Conflicts (merge example)
  5267. @sc{cvs} tells you that there were some conflicts.
  5268. Your original working file is saved unmodified in
  5269. @file{.#driver.c.1.4}. The new version of
  5270. @file{driver.c} contains this:
  5271. @example
  5272. #include <stdlib.h>
  5273. #include <stdio.h>
  5274. int main(int argc,
  5275. char **argv)
  5276. @{
  5277. init_scanner();
  5278. parse();
  5279. if (argc != 1)
  5280. @{
  5281. fprintf(stderr, "tc: No args expected.\n");
  5282. exit(1);
  5283. @}
  5284. if (nerr == 0)
  5285. gencode();
  5286. else
  5287. fprintf(stderr, "No code generated.\n");
  5288. @asis{}<<<<<<< driver.c
  5289. exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
  5290. @asis{}=======
  5291. exit(!!nerr);
  5292. @asis{}>>>>>>> 1.6
  5293. @}
  5294. @end example
  5295. @noindent
  5296. @cindex Markers, conflict
  5297. @cindex Conflict markers
  5298. @cindex <<<<<<<
  5299. @cindex >>>>>>>
  5300. @cindex =======
  5301. Note how all non-overlapping modifications are incorporated in your working
  5302. copy, and that the overlapping section is clearly marked with
  5303. @samp{<<<<<<<}, @samp{=======} and @samp{>>>>>>>}.
  5304. @cindex Resolving a conflict
  5305. @cindex Conflict resolution
  5306. You resolve the conflict by editing the file, removing the markers and
  5307. the erroneous line. Suppose you end up with this file:
  5308. @c -- Add xref to the pcl-cvs manual when it talks
  5309. @c -- about this.
  5310. @example
  5311. #include <stdlib.h>
  5312. #include <stdio.h>
  5313. int main(int argc,
  5314. char **argv)
  5315. @{
  5316. init_scanner();
  5317. parse();
  5318. if (argc != 1)
  5319. @{
  5320. fprintf(stderr, "tc: No args expected.\n");
  5321. exit(1);
  5322. @}
  5323. if (nerr == 0)
  5324. gencode();
  5325. else
  5326. fprintf(stderr, "No code generated.\n");
  5327. exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
  5328. @}
  5329. @end example
  5330. @noindent
  5331. You can now go ahead and commit this as revision 1.7.
  5332. @example
  5333. $ cvs commit -m "Initialize scanner. Use symbolic exit values." driver.c
  5334. Checking in driver.c;
  5335. /usr/local/cvsroot/yoyodyne/tc/driver.c,v <-- driver.c
  5336. new revision: 1.7; previous revision: 1.6
  5337. done
  5338. @end example
  5339. For your protection, @sc{cvs} will refuse to check in a
  5340. file if a conflict occurred and you have not resolved
  5341. the conflict. Currently to resolve a conflict, you
  5342. must change the timestamp on the file. In previous
  5343. versions of @sc{cvs}, you also needed to
  5344. insure that the file contains no conflict markers.
  5345. Because
  5346. your file may legitimately contain conflict markers (that
  5347. is, occurrences of @samp{>>>>>>> } at the start of a
  5348. line that don't mark a conflict), the current
  5349. version of @sc{cvs} will print a warning and proceed to
  5350. check in the file.
  5351. @c The old behavior was really icky; the only way out
  5352. @c was to start hacking on
  5353. @c the @code{CVS/Entries} file or other such workarounds.
  5354. @c
  5355. @c If the timestamp thing isn't considered nice enough,
  5356. @c maybe there should be a "cvs resolved" command
  5357. @c which clears the conflict indication. For a nice user
  5358. @c interface, this should be invoked by an interactive
  5359. @c merge tool like emerge rather than by the user
  5360. @c directly--such a tool can verify that the user has
  5361. @c really dealt with each conflict.
  5362. @cindex emerge
  5363. If you use release 1.04 or later of pcl-cvs (a @sc{gnu}
  5364. Emacs front-end for @sc{cvs}) you can use an Emacs
  5365. package called emerge to help you resolve conflicts.
  5366. See the documentation for pcl-cvs.
  5367. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5368. @node Informing others
  5369. @section Informing others about commits
  5370. @cindex Informing others
  5371. @cindex Spreading information
  5372. @cindex Mail, automatic mail on commit
  5373. It is often useful to inform others when you commit a
  5374. new revision of a file. The @file{loginfo} file can be
  5375. used to automate this process.
  5376. @xref{loginfo}. You can use these features of @sc{cvs}
  5377. to, for instance, instruct @sc{cvs} to mail a
  5378. message to all developers, or post a message to a local
  5379. newsgroup.
  5380. @c -- More text would be nice here.
  5381. @node Concurrency
  5382. @section Several developers simultaneously attempting to run CVS
  5383. @cindex Locks, cvs, introduction
  5384. @c For a discussion of *why* CVS creates locks, see
  5385. @c the comment at the start of src/lock.c
  5386. If several developers try to run @sc{cvs} at the same
  5387. time, one may get the following message:
  5388. @example
  5389. [11:43:23] waiting for bach's lock in /usr/local/cvsroot/foo
  5390. @end example
  5391. @cindex #cvs.rfl, removing
  5392. @cindex #cvs.wfl, removing
  5393. @cindex #cvs.lock, removing
  5394. @sc{cvs} will try again every 30 seconds, and either
  5395. continue with the operation or print the message again,
  5396. if it still needs to wait. If a lock seems to stick
  5397. around for an undue amount of time, find the person
  5398. holding the lock and ask them about the cvs command
  5399. they are running. If they aren't running a cvs
  5400. command, look in the repository directory mentioned in
  5401. the message and remove files which they own whose names
  5402. start with @file{#cvs.rfl},
  5403. @file{#cvs.wfl}, or @file{#cvs.lock}.
  5404. Note that these locks are to protect @sc{cvs}'s
  5405. internal data structures and have no relationship to
  5406. the word @dfn{lock} in the sense used by
  5407. @sc{rcs}---which refers to reserved checkouts
  5408. (@pxref{Multiple developers}).
  5409. Any number of people can be reading from a given
  5410. repository at a time; only when someone is writing do
  5411. the locks prevent other people from reading or writing.
  5412. @cindex Atomic transactions, lack of
  5413. @cindex Transactions, atomic, lack of
  5414. @c the following talks about what one might call commit/update
  5415. @c atomicity.
  5416. @c Probably also should say something about
  5417. @c commit/commit atomicity, that is, "An update will
  5418. @c not get partial versions of more than one commit".
  5419. @c CVS currently has this property and I guess we can
  5420. @c make it a documented feature.
  5421. @c For example one person commits
  5422. @c a/one.c and b/four.c and another commits a/two.c and
  5423. @c b/three.c. Then an update cannot get the new a/one.c
  5424. @c and a/two.c and the old b/four.c and b/three.c.
  5425. One might hope for the following property:
  5426. @quotation
  5427. If someone commits some changes in one cvs command,
  5428. then an update by someone else will either get all the
  5429. changes, or none of them.
  5430. @end quotation
  5431. @noindent
  5432. but @sc{cvs} does @emph{not} have this property. For
  5433. example, given the files
  5434. @example
  5435. a/one.c
  5436. a/two.c
  5437. b/three.c
  5438. b/four.c
  5439. @end example
  5440. @noindent
  5441. if someone runs
  5442. @example
  5443. cvs ci a/two.c b/three.c
  5444. @end example
  5445. @noindent
  5446. and someone else runs @code{cvs update} at the same
  5447. time, the person running @code{update} might get only
  5448. the change to @file{b/three.c} and not the change to
  5449. @file{a/two.c}.
  5450. @node Watches
  5451. @section Mechanisms to track who is editing files
  5452. @cindex Watches
  5453. For many groups, use of @sc{cvs} in its default mode is
  5454. perfectly satisfactory. Users may sometimes go to
  5455. check in a modification only to find that another
  5456. modification has intervened, but they deal with it and
  5457. proceed with their check in. Other groups prefer to be
  5458. able to know who is editing what files, so that if two
  5459. people try to edit the same file they can choose to
  5460. talk about who is doing what when rather than be
  5461. surprised at check in time. The features in this
  5462. section allow such coordination, while retaining the
  5463. ability of two developers to edit the same file at the
  5464. same time.
  5465. @c Some people might ask why CVS does not enforce the
  5466. @c rule on chmod, by requiring a cvs edit before a cvs
  5467. @c commit. The main reason is that it could always be
  5468. @c circumvented--one could edit the file, and
  5469. @c then when ready to check it in, do the cvs edit and put
  5470. @c in the new contents and do the cvs commit. One
  5471. @c implementation note: if we _do_ want to have cvs commit
  5472. @c require a cvs edit, we should store the state on
  5473. @c whether the cvs edit has occurred in the working
  5474. @c directory, rather than having the server try to keep
  5475. @c track of what working directories exist.
  5476. @c FIXME: should the above discussion be part of the
  5477. @c manual proper, somewhere, not just in a comment?
  5478. For maximum benefit developers should use @code{cvs
  5479. edit} (not @code{chmod}) to make files read-write to
  5480. edit them, and @code{cvs release} (not @code{rm}) to
  5481. discard a working directory which is no longer in use,
  5482. but @sc{cvs} is not able to enforce this behavior.
  5483. @c I'm a little dissatisfied with this presentation,
  5484. @c because "watch on"/"edit"/"editors" are one set of
  5485. @c functionality, and "watch add"/"watchers" is another
  5486. @c which is somewhat orthogonal even though they interact in
  5487. @c various ways. But I think it might be
  5488. @c confusing to describe them separately (e.g. "watch
  5489. @c add" with loginfo). I don't know.
  5490. @menu
  5491. * Setting a watch:: Telling CVS to watch certain files
  5492. * Getting Notified:: Telling CVS to notify you
  5493. * Editing files:: How to edit a file which is being watched
  5494. * Watch information:: Information about who is watching and editing
  5495. * Watches Compatibility:: Watches interact poorly with CVS 1.6 or earlier
  5496. @end menu
  5497. @node Setting a watch
  5498. @subsection Telling CVS to watch certain files
  5499. To enable the watch features, you first specify that
  5500. certain files are to be watched.
  5501. @cindex watch on (subcommand)
  5502. @deffn Command {cvs watch on} [@code{-lR}] [@var{files}]@dots{}
  5503. @cindex Read-only files, and watches
  5504. Specify that developers should run @code{cvs edit}
  5505. before editing @var{files}. @sc{cvs} will create working
  5506. copies of @var{files} read-only, to remind developers
  5507. to run the @code{cvs edit} command before working on
  5508. them.
  5509. If @var{files} includes the name of a directory, @sc{cvs}
  5510. arranges to watch all files added to the corresponding
  5511. repository directory, and sets a default for files
  5512. added in the future; this allows the user to set
  5513. notification policies on a per-directory basis. The
  5514. contents of the directory are processed recursively,
  5515. unless the @code{-l} option is given.
  5516. The @code{-R} option can be used to force recursion if the @code{-l}
  5517. option is set in @file{~/.cvsrc} (@pxref{~/.cvsrc}).
  5518. If @var{files} is omitted, it defaults to the current directory.
  5519. @cindex watch off (subcommand)
  5520. @end deffn
  5521. @deffn Command {cvs watch off} [@code{-lR}] [@var{files}]@dots{}
  5522. Do not create @var{files} read-only on checkout; thus,
  5523. developers will not be reminded to use @code{cvs edit}
  5524. and @code{cvs unedit}.
  5525. @ignore
  5526. @sc{cvs} will check out @var{files}
  5527. read-write as usual, unless other permissions override
  5528. due to the @code{PreservePermissions} option being
  5529. enabled in the @file{config} administrative file
  5530. (@pxref{Special Files}, @pxref{config})
  5531. @end ignore
  5532. The @var{files} and options are processed as for @code{cvs
  5533. watch on}.
  5534. @end deffn
  5535. @node Getting Notified
  5536. @subsection Telling CVS to notify you
  5537. You can tell @sc{cvs} that you want to receive
  5538. notifications about various actions taken on a file.
  5539. You can do this without using @code{cvs watch on} for
  5540. the file, but generally you will want to use @code{cvs
  5541. watch on}, to remind developers to use the @code{cvs edit}
  5542. command.
  5543. @cindex watch add (subcommand)
  5544. @deffn Command {cvs watch add} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
  5545. Add the current user to the list of people to receive notification of
  5546. work done on @var{files}.
  5547. The @code{-a} option specifies what kinds of events @sc{cvs} should notify
  5548. the user about. @var{action} is one of the following:
  5549. @table @code
  5550. @item edit
  5551. Another user has applied the @code{cvs edit} command (described
  5552. below) to a watched file.
  5553. @item commit
  5554. Another user has committed changes to one of the named @var{files}.
  5555. @item unedit
  5556. Another user has abandoned editing a file (other than by committing changes).
  5557. They can do this in several ways, by:
  5558. @itemize @bullet
  5559. @item
  5560. applying the @code{cvs unedit} command (described below) to the file
  5561. @item
  5562. applying the @code{cvs release} command (@pxref{release}) to the file's parent directory
  5563. (or recursively to a directory more than one level up)
  5564. @item
  5565. deleting the file and allowing @code{cvs update} to recreate it
  5566. @end itemize
  5567. @item all
  5568. All of the above.
  5569. @item none
  5570. None of the above. (This is useful with @code{cvs edit},
  5571. described below.)
  5572. @end table
  5573. The @code{-a} option may appear more than once, or not at all. If
  5574. omitted, the action defaults to @code{all}.
  5575. The @var{files} and options are processed as for
  5576. @code{cvs watch on}.
  5577. @end deffn
  5578. @cindex watch remove (subcommand)
  5579. @deffn Command {cvs watch remove} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
  5580. Remove a notification request established using @code{cvs watch add};
  5581. the arguments are the same. If the @code{-a} option is present, only
  5582. watches for the specified actions are removed.
  5583. @end deffn
  5584. @cindex notify (admin file)
  5585. When the conditions exist for notification, @sc{cvs}
  5586. calls the @file{notify} administrative file. Edit
  5587. @file{notify} as one edits the other administrative
  5588. files (@pxref{Intro administrative files}). This
  5589. file follows the usual conventions for administrative
  5590. files (@pxref{syntax}), where each line is a regular
  5591. expression followed by a command to execute. The
  5592. command should contain a single occurrence of @samp{%s}
  5593. which will be replaced by the user to notify; the rest
  5594. of the information regarding the notification will be
  5595. supplied to the command on standard input. The
  5596. standard thing to put in the @code{notify} file is the
  5597. single line:
  5598. @example
  5599. ALL mail %s -s "CVS notification"
  5600. @end example
  5601. @noindent
  5602. This causes users to be notified by electronic mail.
  5603. @c FIXME: should it be this hard to set up this
  5604. @c behavior (and the result when one fails to do so,
  5605. @c silent failure to notify, so non-obvious)? Should
  5606. @c CVS give a warning if no line in notify matches (and
  5607. @c document the use of "DEFAULT :" for the case where
  5608. @c skipping the notification is indeed desired)?
  5609. @cindex users (admin file)
  5610. Note that if you set this up in the straightforward
  5611. way, users receive notifications on the server machine.
  5612. One could of course write a @file{notify} script which
  5613. directed notifications elsewhere, but to make this
  5614. easy, @sc{cvs} allows you to associate a notification
  5615. address for each user. To do so create a file
  5616. @file{users} in @file{CVSROOT} with a line for each
  5617. user in the format @var{user}:@var{value}. Then
  5618. instead of passing the name of the user to be notified
  5619. to @file{notify}, @sc{cvs} will pass the @var{value}
  5620. (normally an email address on some other machine).
  5621. @sc{cvs} does not notify you for your own changes.
  5622. Currently this check is done based on whether the user
  5623. name of the person taking the action which triggers
  5624. notification matches the user name of the person
  5625. getting notification. In fact, in general, the watches
  5626. features only track one edit by each user. It probably
  5627. would be more useful if watches tracked each working
  5628. directory separately, so this behavior might be worth
  5629. changing.
  5630. @c "behavior might be worth changing" is an effort to
  5631. @c point to future directions while also not promising
  5632. @c that "they" (as in "why don't they fix CVS to....")
  5633. @c will do this.
  5634. @c one implementation issue is identifying whether a
  5635. @c working directory is same or different. Comparing
  5636. @c pathnames/hostnames is hopeless, but having the server
  5637. @c supply a serial number which the client stores in the
  5638. @c CVS directory as a magic cookie should work.
  5639. @node Editing files
  5640. @subsection How to edit a file which is being watched
  5641. @cindex Checkout, as term for getting ready to edit
  5642. Since a file which is being watched is checked out
  5643. read-only, you cannot simply edit it. To make it
  5644. read-write, and inform others that you are planning to
  5645. edit it, use the @code{cvs edit} command. Some systems
  5646. call this a @dfn{checkout}, but @sc{cvs} uses that term
  5647. for obtaining a copy of the sources (@pxref{Getting the
  5648. source}), an operation which those systems call a
  5649. @dfn{get} or a @dfn{fetch}.
  5650. @c Issue to think about: should we transition CVS
  5651. @c towards the "get" terminology? "cvs get" is already a
  5652. @c synonym for "cvs checkout" and that section of the
  5653. @c manual refers to "Getting the source". If this is
  5654. @c done, needs to be done gingerly (for example, we should
  5655. @c still accept "checkout" in .cvsrc files indefinitely
  5656. @c even if the CVS's messages are changed from "cvs checkout: "
  5657. @c to "cvs get: ").
  5658. @c There is a concern about whether "get" is not as
  5659. @c good for novices because it is a more general term
  5660. @c than "checkout" (and thus arguably harder to assign
  5661. @c a technical meaning for).
  5662. @cindex edit (subcommand)
  5663. @deffn Command {cvs edit} [@code{-lR}] [@code{-a} @var{action}]@dots{} [@var{files}]@dots{}
  5664. Prepare to edit the working files @var{files}. @sc{cvs} makes the
  5665. @var{files} read-write, and notifies users who have requested
  5666. @code{edit} notification for any of @var{files}.
  5667. The @code{cvs edit} command accepts the same options as the
  5668. @code{cvs watch add} command, and establishes a temporary watch for the
  5669. user on @var{files}; @sc{cvs} will remove the watch when @var{files} are
  5670. @code{unedit}ed or @code{commit}ted. If the user does not wish to
  5671. receive notifications, she should specify @code{-a none}.
  5672. The @var{files} and the options are processed as for the @code{cvs
  5673. watch} commands.
  5674. @ignore
  5675. @strong{Caution: If the @code{PreservePermissions}
  5676. option is enabled in the repository (@pxref{config}),
  5677. @sc{cvs} will not change the permissions on any of the
  5678. @var{files}. The reason for this change is to ensure
  5679. that using @samp{cvs edit} does not interfere with the
  5680. ability to store file permissions in the @sc{cvs}
  5681. repository.}
  5682. @end ignore
  5683. @end deffn
  5684. Normally when you are done with a set of changes, you
  5685. use the @code{cvs commit} command, which checks in your
  5686. changes and returns the watched files to their usual
  5687. read-only state. But if you instead decide to abandon
  5688. your changes, or not to make any changes, you can use
  5689. the @code{cvs unedit} command.
  5690. @cindex unedit (subcommand)
  5691. @cindex Abandoning work
  5692. @cindex Reverting to repository version
  5693. @deffn Command {cvs unedit} [@code{-lR}] [@var{files}]@dots{}
  5694. Abandon work on the working files @var{files}, and revert them to the
  5695. repository versions on which they are based. @sc{cvs} makes those
  5696. @var{files} read-only for which users have requested notification using
  5697. @code{cvs watch on}. @sc{cvs} notifies users who have requested @code{unedit}
  5698. notification for any of @var{files}.
  5699. The @var{files} and options are processed as for the
  5700. @code{cvs watch} commands.
  5701. If watches are not in use, the @code{unedit} command
  5702. probably does not work, and the way to revert to the
  5703. repository version is with the command @code{cvs update -C file}
  5704. (@pxref{update}).
  5705. The meaning is
  5706. not precisely the same; the latter may also
  5707. bring in some changes which have been made in the
  5708. repository since the last time you updated.
  5709. @c It would be a useful enhancement to CVS to make
  5710. @c unedit work in the non-watch case as well.
  5711. @end deffn
  5712. When using client/server @sc{cvs}, you can use the
  5713. @code{cvs edit} and @code{cvs unedit} commands even if
  5714. @sc{cvs} is unable to successfully communicate with the
  5715. server; the notifications will be sent upon the next
  5716. successful @sc{cvs} command.
  5717. @node Watch information
  5718. @subsection Information about who is watching and editing
  5719. @cindex watchers (subcommand)
  5720. @deffn Command {cvs watchers} [@code{-lR}] [@var{files}]@dots{}
  5721. List the users currently watching changes to @var{files}. The report
  5722. includes the files being watched, and the mail address of each watcher.
  5723. The @var{files} and options are processed as for the
  5724. @code{cvs watch} commands.
  5725. @end deffn
  5726. @cindex editors (subcommand)
  5727. @deffn Command {cvs editors} [@code{-lR}] [@var{files}]@dots{}
  5728. List the users currently working on @var{files}. The report
  5729. includes the mail address of each user, the time when the user began
  5730. working with the file, and the host and path of the working directory
  5731. containing the file.
  5732. The @var{files} and options are processed as for the
  5733. @code{cvs watch} commands.
  5734. @end deffn
  5735. @node Watches Compatibility
  5736. @subsection Using watches with old versions of CVS
  5737. @cindex CVS 1.6, and watches
  5738. If you use the watch features on a repository, it
  5739. creates @file{CVS} directories in the repository and
  5740. stores the information about watches in that directory.
  5741. If you attempt to use @sc{cvs} 1.6 or earlier with the
  5742. repository, you get an error message such as the
  5743. following (all on one line):
  5744. @example
  5745. cvs update: cannot open CVS/Entries for reading:
  5746. No such file or directory
  5747. @end example
  5748. @noindent
  5749. and your operation will likely be aborted. To use the
  5750. watch features, you must upgrade all copies of @sc{cvs}
  5751. which use that repository in local or server mode. If
  5752. you cannot upgrade, use the @code{watch off} and
  5753. @code{watch remove} commands to remove all watches, and
  5754. that will restore the repository to a state which
  5755. @sc{cvs} 1.6 can cope with.
  5756. @node Choosing a model
  5757. @section Choosing between reserved or unreserved checkouts
  5758. @cindex Choosing, reserved or unreserved checkouts
  5759. Reserved and unreserved checkouts each have pros and
  5760. cons. Let it be said that a lot of this is a matter of
  5761. opinion or what works given different groups' working
  5762. styles, but here is a brief description of some of the
  5763. issues. There are many ways to organize a team of
  5764. developers. @sc{cvs} does not try to enforce a certain
  5765. organization. It is a tool that can be used in several
  5766. ways.
  5767. Reserved checkouts can be very counter-productive. If
  5768. two persons want to edit different parts of a file,
  5769. there may be no reason to prevent either of them from
  5770. doing so. Also, it is common for someone to take out a
  5771. lock on a file, because they are planning to edit it,
  5772. but then forget to release the lock.
  5773. @c "many groups"? specifics? cites to papers on this?
  5774. @c some way to weasel-word it a bit more so we don't
  5775. @c need facts :-)?
  5776. People, especially people who are familiar with
  5777. reserved checkouts, often wonder how often conflicts
  5778. occur if unreserved checkouts are used, and how
  5779. difficult they are to resolve. The experience with
  5780. many groups is that they occur rarely and usually are
  5781. relatively straightforward to resolve.
  5782. The rarity of serious conflicts may be surprising, until one realizes
  5783. that they occur only when two developers disagree on the proper design
  5784. for a given section of code; such a disagreement suggests that the
  5785. team has not been communicating properly in the first place. In order
  5786. to collaborate under @emph{any} source management regimen, developers
  5787. must agree on the general design of the system; given this agreement,
  5788. overlapping changes are usually straightforward to merge.
  5789. In some cases unreserved checkouts are clearly
  5790. inappropriate. If no merge tool exists for the kind of
  5791. file you are managing (for example word processor files
  5792. or files edited by Computer Aided Design programs), and
  5793. it is not desirable to change to a program which uses a
  5794. mergeable data format, then resolving conflicts is
  5795. going to be unpleasant enough that you generally will
  5796. be better off to simply avoid the conflicts instead, by
  5797. using reserved checkouts.
  5798. The watches features described above in @ref{Watches}
  5799. can be considered to be an intermediate model between
  5800. reserved checkouts and unreserved checkouts. When you
  5801. go to edit a file, it is possible to find out who else
  5802. is editing it. And rather than having the system
  5803. simply forbid both people editing the file, it can tell
  5804. you what the situation is and let you figure out
  5805. whether it is a problem in that particular case or not.
  5806. Therefore, for some groups it can be considered the
  5807. best of both the reserved checkout and unreserved
  5808. checkout worlds.
  5809. @c ---------------------------------------------------------------------
  5810. @node Revision management
  5811. @chapter Revision management
  5812. @cindex Revision management
  5813. @c -- This chapter could be expanded a lot.
  5814. @c -- Experiences are very welcome!
  5815. If you have read this far, you probably have a pretty
  5816. good grasp on what @sc{cvs} can do for you. This
  5817. chapter talks a little about things that you still have
  5818. to decide.
  5819. If you are doing development on your own using @sc{cvs}
  5820. you could probably skip this chapter. The questions
  5821. this chapter takes up become more important when more
  5822. than one person is working in a repository.
  5823. @menu
  5824. * When to commit:: Some discussion on the subject
  5825. @end menu
  5826. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5827. @node When to commit
  5828. @section When to commit?
  5829. @cindex When to commit
  5830. @cindex Committing, when to
  5831. @cindex Policy
  5832. Your group should decide which policy to use regarding
  5833. commits. Several policies are possible, and as your
  5834. experience with @sc{cvs} grows you will probably find
  5835. out what works for you.
  5836. If you commit files too quickly you might commit files
  5837. that do not even compile. If your partner updates his
  5838. working sources to include your buggy file, he will be
  5839. unable to compile the code. On the other hand, other
  5840. persons will not be able to benefit from the
  5841. improvements you make to the code if you commit very
  5842. seldom, and conflicts will probably be more common.
  5843. It is common to only commit files after making sure
  5844. that they can be compiled. Some sites require that the
  5845. files pass a test suite. Policies like this can be
  5846. enforced using the commitinfo file
  5847. (@pxref{commitinfo}), but you should think twice before
  5848. you enforce such a convention. By making the
  5849. development environment too controlled it might become
  5850. too regimented and thus counter-productive to the real
  5851. goal, which is to get software written.
  5852. @c ---------------------------------------------------------------------
  5853. @node Keyword substitution
  5854. @chapter Keyword substitution
  5855. @cindex Keyword substitution
  5856. @cindex Keyword expansion
  5857. @cindex Identifying files
  5858. @comment Be careful when editing this chapter.
  5859. @comment Remember that this file is kept under
  5860. @comment version control, so we must not accidentally
  5861. @comment include a valid keyword in the running text.
  5862. As long as you edit source files inside a working
  5863. directory you can always find out the state of
  5864. your files via @samp{cvs status} and @samp{cvs log}.
  5865. But as soon as you export the files from your
  5866. development environment it becomes harder to identify
  5867. which revisions they are.
  5868. @sc{cvs} can use a mechanism known as @dfn{keyword
  5869. substitution} (or @dfn{keyword expansion}) to help
  5870. identifying the files. Embedded strings of the form
  5871. @code{$@var{keyword}$} and
  5872. @code{$@var{keyword}:@dots{}$} in a file are replaced
  5873. with strings of the form
  5874. @code{$@var{keyword}:@var{value}$} whenever you obtain
  5875. a new revision of the file.
  5876. @menu
  5877. * Keyword list:: Keywords
  5878. * Using keywords:: Using keywords
  5879. * Avoiding substitution:: Avoiding substitution
  5880. * Substitution modes:: Substitution modes
  5881. * Log keyword:: Problems with the $@splitrcskeyword{Log}$ keyword.
  5882. @end menu
  5883. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5884. @node Keyword list
  5885. @section Keyword List
  5886. @cindex Keyword List
  5887. @c FIXME: need some kind of example here I think,
  5888. @c perhaps in a
  5889. @c "Keyword intro" node. The intro in the "Keyword
  5890. @c substitution" node itself seems OK, but to launch
  5891. @c into a list of the keywords somehow seems too abrupt.
  5892. This is a list of the keywords:
  5893. @table @code
  5894. @cindex Author keyword
  5895. @item $@splitrcskeyword{Author}$
  5896. The login name of the user who checked in the revision.
  5897. @cindex Date keyword
  5898. @item $@splitrcskeyword{Date}$
  5899. The date and time (UTC) the revision was checked in.
  5900. @cindex Header keyword
  5901. @item $@splitrcskeyword{Header}$
  5902. A standard header containing the full pathname of the
  5903. @sc{rcs} file, the revision number, the date (UTC), the
  5904. author, the state, and the locker (if locked). Files
  5905. will normally never be locked when you use @sc{cvs}.
  5906. @cindex Id keyword
  5907. @item $@splitrcskeyword{Id}$
  5908. Same as @code{$@splitrcskeyword{Header}$}, except that the @sc{rcs}
  5909. filename is without a path.
  5910. @cindex Name keyword
  5911. @item $@splitrcskeyword{Name}$
  5912. Tag name used to check out this file. The keyword is
  5913. expanded only if one checks out with an explicit tag
  5914. name. For example, when running the command @code{cvs
  5915. co -r first}, the keyword expands to @samp{Name: first}.
  5916. @cindex Locker keyword
  5917. @item $@splitrcskeyword{Locker}$
  5918. The login name of the user who locked the revision
  5919. (empty if not locked, which is the normal case unless
  5920. @code{cvs admin -l} is in use).
  5921. @cindex Log keyword
  5922. @item $@splitrcskeyword{Log}$
  5923. The log message supplied during commit, preceded by a
  5924. header containing the @sc{rcs} filename, the revision
  5925. number, the author, and the date (UTC). Existing log
  5926. messages are @emph{not} replaced. Instead, the new log
  5927. message is inserted after @code{$@splitrcskeyword{Log}:@dots{}$}.
  5928. Each new line is prefixed with the same string which
  5929. precedes the @code{$Log} keyword. For example, if the
  5930. file contains:
  5931. @example
  5932. /* Here is what people have been up to:
  5933. *
  5934. * $@splitrcskeyword{Log}: frob.c,v $
  5935. * Revision 1.1 1997/01/03 14:23:51 joe
  5936. * Add the superfrobnicate option
  5937. *
  5938. */
  5939. @end example
  5940. @noindent
  5941. then additional lines which are added when expanding
  5942. the @code{$Log} keyword will be preceded by @samp{ * }.
  5943. Unlike previous versions of @sc{cvs} and @sc{rcs}, the
  5944. @dfn{comment leader} from the @sc{rcs} file is not used.
  5945. The @code{$Log} keyword is useful for
  5946. accumulating a complete change log in a source file,
  5947. but for several reasons it can be problematic.
  5948. @xref{Log keyword}.
  5949. @cindex RCSfile keyword
  5950. @item $@splitrcskeyword{RCSfile}$
  5951. The name of the RCS file without a path.
  5952. @cindex Revision keyword
  5953. @item $@splitrcskeyword{Revision}$
  5954. The revision number assigned to the revision.
  5955. @cindex Source keyword
  5956. @item $@splitrcskeyword{Source}$
  5957. The full pathname of the RCS file.
  5958. @cindex State keyword
  5959. @item $@splitrcskeyword{State}$
  5960. The state assigned to the revision. States can be
  5961. assigned with @code{cvs admin -s}---see @ref{admin options}.
  5962. @end table
  5963. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5964. @node Using keywords
  5965. @section Using keywords
  5966. To include a keyword string you simply include the
  5967. relevant text string, such as @code{$@splitrcskeyword{Id}$}, inside the
  5968. file, and commit the file. @sc{cvs} will automatically (Or,
  5969. more accurately, as part of the update run that
  5970. automatically happens after a commit.)
  5971. expand the string as part of the commit operation.
  5972. It is common to embed the @code{$@splitrcskeyword{Id}$} string in
  5973. the source files so that it gets passed through to
  5974. generated files. For example, if you are managing
  5975. computer program source code, you might include a
  5976. variable which is initialized to contain that string.
  5977. Or some C compilers may provide a @code{#pragma ident}
  5978. directive. Or a document management system might
  5979. provide a way to pass a string through to generated
  5980. files.
  5981. @c Would be nice to give an example, but doing this in
  5982. @c portable C is not possible and the problem with
  5983. @c picking any one language (VMS HELP files, Ada,
  5984. @c troff, whatever) is that people use CVS for all
  5985. @c kinds of files.
  5986. @cindex Ident (shell command)
  5987. The @code{ident} command (which is part of the @sc{rcs}
  5988. package) can be used to extract keywords and their
  5989. values from a file. This can be handy for text files,
  5990. but it is even more useful for extracting keywords from
  5991. binary files.
  5992. @example
  5993. $ ident samp.c
  5994. samp.c:
  5995. $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  5996. $ gcc samp.c
  5997. $ ident a.out
  5998. a.out:
  5999. $@splitrcskeyword{Id}: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  6000. @end example
  6001. @cindex What (shell command)
  6002. S@sc{ccs} is another popular revision control system.
  6003. It has a command, @code{what}, which is very similar to
  6004. @code{ident} and used for the same purpose. Many sites
  6005. without @sc{rcs} have @sc{sccs}. Since @code{what}
  6006. looks for the character sequence @code{@@(#)} it is
  6007. easy to include keywords that are detected by either
  6008. command. Simply prefix the keyword with the
  6009. magic @sc{sccs} phrase, like this:
  6010. @example
  6011. static char *id="@@(#) $@splitrcskeyword{Id}: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
  6012. @end example
  6013. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6014. @node Avoiding substitution
  6015. @section Avoiding substitution
  6016. Keyword substitution has its disadvantages. Sometimes
  6017. you might want the literal text string
  6018. @samp{$@splitrcskeyword{Author}$} to appear inside a file without
  6019. @sc{cvs} interpreting it as a keyword and expanding it
  6020. into something like @samp{$@splitrcskeyword{Author}: ceder $}.
  6021. There is unfortunately no way to selectively turn off
  6022. keyword substitution. You can use @samp{-ko}
  6023. (@pxref{Substitution modes}) to turn off keyword
  6024. substitution entirely.
  6025. In many cases you can avoid using keywords in
  6026. the source, even though they appear in the final
  6027. product. For example, the source for this manual
  6028. contains @samp{$@@asis@{@}Author$} whenever the text
  6029. @samp{$@splitrcskeyword{Author}$} should appear. In @code{nroff}
  6030. and @code{troff} you can embed the null-character
  6031. @code{\&} inside the keyword for a similar effect.
  6032. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6033. @node Substitution modes
  6034. @section Substitution modes
  6035. @cindex Keyword substitution, changing modes
  6036. @cindex -k (keyword substitution)
  6037. @cindex Kflag
  6038. @c FIXME: This could be made more coherent, by expanding it
  6039. @c with more examples or something.
  6040. Each file has a stored default substitution mode, and
  6041. each working directory copy of a file also has a
  6042. substitution mode. The former is set by the @samp{-k}
  6043. option to @code{cvs add} and @code{cvs admin}; the
  6044. latter is set by the @samp{-k} or @samp{-A} options to @code{cvs
  6045. checkout} or @code{cvs update}.
  6046. @code{cvs diff} and @code{cvs rdiff} also
  6047. have @samp{-k} options.
  6048. For some examples,
  6049. see @ref{Binary files}, and @ref{Merging and keywords}.
  6050. @c The fact that -A is overloaded to mean both reset
  6051. @c sticky options and reset sticky tags/dates is
  6052. @c somewhat questionable. Perhaps there should be
  6053. @c separate options to reset sticky options (e.g. -k
  6054. @c A") and tags/dates (someone suggested -r HEAD could
  6055. @c do this instead of setting a sticky tag of "HEAD"
  6056. @c as in the status quo but I haven't thought much
  6057. @c about that idea. Of course -r .reset or something
  6058. @c could be coined if this needs to be a new option).
  6059. @c On the other hand, having -A mean "get things back
  6060. @c into the state after a fresh checkout" has a certain
  6061. @c appeal, and maybe there is no sufficient reason for
  6062. @c creeping featurism in this area.
  6063. The modes available are:
  6064. @table @samp
  6065. @item -kkv
  6066. Generate keyword strings using the default form, e.g.
  6067. @code{$@splitrcskeyword{Revision}: 5.7 $} for the @code{Revision}
  6068. keyword.
  6069. @item -kkvl
  6070. Like @samp{-kkv}, except that a locker's name is always
  6071. inserted if the given revision is currently locked.
  6072. The locker's name is only relevant if @code{cvs admin
  6073. -l} is in use.
  6074. @item -kk
  6075. Generate only keyword names in keyword strings; omit
  6076. their values. For example, for the @code{Revision}
  6077. keyword, generate the string @code{$@splitrcskeyword{Revision}$}
  6078. instead of @code{$@splitrcskeyword{Revision}: 5.7 $}. This option
  6079. is useful to ignore differences due to keyword
  6080. substitution when comparing different revisions of a
  6081. file (@pxref{Merging and keywords}).
  6082. @item -ko
  6083. Generate the old keyword string, present in the working
  6084. file just before it was checked in. For example, for
  6085. the @code{Revision} keyword, generate the string
  6086. @code{$@splitrcskeyword{Revision}: 1.1 $} instead of
  6087. @code{$@splitrcskeyword{Revision}: 5.7 $} if that is how the
  6088. string appeared when the file was checked in.
  6089. @item -kb
  6090. Like @samp{-ko}, but also inhibit conversion of line
  6091. endings between the canonical form in which they are
  6092. stored in the repository (linefeed only), and the form
  6093. appropriate to the operating system in use on the
  6094. client. For systems, like unix, which use linefeed
  6095. only to terminate lines, this is the same as
  6096. @samp{-ko}. For more information on binary files, see
  6097. @ref{Binary files}.
  6098. @item -kv
  6099. Generate only keyword values for keyword strings. For
  6100. example, for the @code{Revision} keyword, generate the string
  6101. @code{5.7} instead of @code{$@splitrcskeyword{Revision}: 5.7 $}.
  6102. This can help generate files in programming languages
  6103. where it is hard to strip keyword delimiters like
  6104. @code{$@splitrcskeyword{Revision}: $} from a string. However,
  6105. further keyword substitution cannot be performed once
  6106. the keyword names are removed, so this option should be
  6107. used with care.
  6108. One often would like to use @samp{-kv} with @code{cvs
  6109. export}---@pxref{export}. But be aware that doesn't
  6110. handle an export containing binary files correctly.
  6111. @end table
  6112. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6113. @node Log keyword
  6114. @section Problems with the $@splitrcskeyword{Log}$ keyword.
  6115. The @code{$@splitrcskeyword{Log}$} keyword is somewhat
  6116. controversial. As long as you are working on your
  6117. development system the information is easily accessible
  6118. even if you do not use the @code{$@splitrcskeyword{Log}$}
  6119. keyword---just do a @code{cvs log}. Once you export
  6120. the file the history information might be useless
  6121. anyhow.
  6122. A more serious concern is that @sc{cvs} is not good at
  6123. handling @code{$@splitrcskeyword{Log}$} entries when a branch is
  6124. merged onto the main trunk. Conflicts often result
  6125. from the merging operation.
  6126. @c Might want to check whether the CVS implementation
  6127. @c of RCS_merge has this problem the same way rcsmerge
  6128. @c does. I would assume so....
  6129. People also tend to "fix" the log entries in the file
  6130. (correcting spelling mistakes and maybe even factual
  6131. errors). If that is done the information from
  6132. @code{cvs log} will not be consistent with the
  6133. information inside the file. This may or may not be a
  6134. problem in real life.
  6135. It has been suggested that the @code{$@splitrcskeyword{Log}$}
  6136. keyword should be inserted @emph{last} in the file, and
  6137. not in the files header, if it is to be used at all.
  6138. That way the long list of change messages will not
  6139. interfere with everyday source file browsing.
  6140. @c ---------------------------------------------------------------------
  6141. @node Tracking sources
  6142. @chapter Tracking third-party sources
  6143. @cindex Third-party sources
  6144. @cindex Tracking sources
  6145. @c FIXME: Need discussion of added and removed files.
  6146. @c FIXME: This doesn't really adequately introduce the
  6147. @c concepts of "vendor" and "you". They don't *have*
  6148. @c to be separate organizations or separate people.
  6149. @c We want a description which is somewhat more based on
  6150. @c the technical issues of which sources go where, but
  6151. @c also with enough examples of how this relates to
  6152. @c relationships like customer-supplier, developer-QA,
  6153. @c maintainer-contributor, or whatever, to make it
  6154. @c seem concrete.
  6155. If you modify a program to better fit your site, you
  6156. probably want to include your modifications when the next
  6157. release of the program arrives. @sc{cvs} can help you with
  6158. this task.
  6159. @cindex Vendor
  6160. @cindex Vendor branch
  6161. @cindex Branch, vendor-
  6162. In the terminology used in @sc{cvs}, the supplier of the
  6163. program is called a @dfn{vendor}. The unmodified
  6164. distribution from the vendor is checked in on its own
  6165. branch, the @dfn{vendor branch}. @sc{cvs} reserves branch
  6166. 1.1.1 for this use.
  6167. When you modify the source and commit it, your revision
  6168. will end up on the main trunk. When a new release is
  6169. made by the vendor, you commit it on the vendor branch
  6170. and copy the modifications onto the main trunk.
  6171. Use the @code{import} command to create and update
  6172. the vendor branch. When you import a new file,
  6173. the vendor branch is made the `head' revision, so
  6174. anyone that checks out a copy of the file gets that
  6175. revision. When a local modification is committed it is
  6176. placed on the main trunk, and made the `head'
  6177. revision.
  6178. @menu
  6179. * First import:: Importing for the first time
  6180. * Update imports:: Updating with the import command
  6181. * Reverting local changes:: Reverting to the latest vendor release
  6182. * Binary files in imports:: Binary files require special handling
  6183. * Keywords in imports:: Keyword substitution might be undesirable
  6184. * Multiple vendor branches:: What if you get sources from several places?
  6185. @end menu
  6186. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6187. @node First import
  6188. @section Importing for the first time
  6189. @cindex Importing modules
  6190. @c Should mention naming conventions for vendor tags,
  6191. @c release tags, and perhaps directory names.
  6192. Use the @code{import} command to check in the sources
  6193. for the first time. When you use the @code{import}
  6194. command to track third-party sources, the @dfn{vendor
  6195. tag} and @dfn{release tags} are useful. The
  6196. @dfn{vendor tag} is a symbolic name for the branch
  6197. (which is always 1.1.1, unless you use the @samp{-b
  6198. @var{branch}} flag---see @ref{Multiple vendor branches}.). The
  6199. @dfn{release tags} are symbolic names for a particular
  6200. release, such as @samp{FSF_0_04}.
  6201. @c I'm not completely sure this belongs here. But
  6202. @c we need to say it _somewhere_ reasonably obvious; it
  6203. @c is a common misconception among people first learning CVS
  6204. Note that @code{import} does @emph{not} change the
  6205. directory in which you invoke it. In particular, it
  6206. does not set up that directory as a @sc{cvs} working
  6207. directory; if you want to work with the sources import
  6208. them first and then check them out into a different
  6209. directory (@pxref{Getting the source}).
  6210. @cindex wdiff (import example)
  6211. Suppose you have the sources to a program called
  6212. @code{wdiff} in a directory @file{wdiff-0.04},
  6213. and are going to make private modifications that you
  6214. want to be able to use even when new releases are made
  6215. in the future. You start by importing the source to
  6216. your repository:
  6217. @example
  6218. $ cd wdiff-0.04
  6219. $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
  6220. @end example
  6221. The vendor tag is named @samp{FSF_DIST} in the above
  6222. example, and the only release tag assigned is
  6223. @samp{WDIFF_0_04}.
  6224. @c FIXME: Need to say where fsf/wdiff comes from.
  6225. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6226. @node Update imports
  6227. @section Updating with the import command
  6228. When a new release of the source arrives, you import it into the
  6229. repository with the same @code{import} command that you used to set up
  6230. the repository in the first place. The only difference is that you
  6231. specify a different release tag this time:
  6232. @example
  6233. $ tar xfz wdiff-0.05.tar.gz
  6234. $ cd wdiff-0.05
  6235. $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
  6236. @end example
  6237. @strong{WARNING: If you use a release tag that already exists in one of the
  6238. repository archives, files removed by an import may not be detected.}
  6239. For files that have not been modified locally, the newly created
  6240. revision becomes the head revision. If you have made local
  6241. changes, @code{import} will warn you that you must merge the changes
  6242. into the main trunk, and tell you to use @samp{checkout -j} to do so:
  6243. @c FIXME: why "wdiff" here and "fsf/wdiff" in the
  6244. @c "import"? I think the assumption is that one has
  6245. @c "wdiff fsf/wdiff" or some such in modules, but it
  6246. @c would be better to not use modules in this example.
  6247. @example
  6248. $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
  6249. @end example
  6250. @noindent
  6251. The above command will check out the latest revision of
  6252. @samp{wdiff}, merging the changes made on the vendor branch @samp{FSF_DIST}
  6253. since yesterday into the working copy. If any conflicts arise during
  6254. the merge they should be resolved in the normal way (@pxref{Conflicts
  6255. example}). Then, the modified files may be committed.
  6256. However, it is much better to use the two release tags rather than using
  6257. a date on the branch as suggested above:
  6258. @example
  6259. $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
  6260. @end example
  6261. @noindent
  6262. The reason this is better is that
  6263. using a date, as suggested above, assumes that you do
  6264. not import more than one release of a product per day.
  6265. More importantly, using the release tags allows @sc{cvs} to detect files
  6266. that were removed between the two vendor releases and mark them for
  6267. removal. Since @code{import} has no way to detect removed files, you
  6268. should do a merge like this even if @code{import} doesn't tell you to.
  6269. @node Reverting local changes
  6270. @section Reverting to the latest vendor release
  6271. You can also revert local changes completely and return
  6272. to the latest vendor release by changing the `head'
  6273. revision back to the vendor branch on all files. For
  6274. example, if you have a checked-out copy of the sources
  6275. in @file{~/work.d/wdiff}, and you want to revert to the
  6276. vendor's version for all the files in that directory,
  6277. you would type:
  6278. @example
  6279. $ cd ~/work.d/wdiff
  6280. $ cvs admin -bFSF_DIST .
  6281. @end example
  6282. @noindent
  6283. You must specify the @samp{-bFSF_DIST} without any space
  6284. after the @samp{-b}. @xref{admin options}.
  6285. @node Binary files in imports
  6286. @section How to handle binary files with cvs import
  6287. Use the @samp{-k} wrapper option to tell import which
  6288. files are binary. @xref{Wrappers}.
  6289. @node Keywords in imports
  6290. @section How to handle keyword substitution with cvs import
  6291. The sources which you are importing may contain
  6292. keywords (@pxref{Keyword substitution}). For example,
  6293. the vendor may use @sc{cvs} or some other system
  6294. which uses similar keyword expansion syntax. If you
  6295. just import the files in the default fashion, then
  6296. the keyword expansions supplied by the vendor will
  6297. be replaced by keyword expansions supplied by your
  6298. own copy of @sc{cvs}. It may be more convenient to
  6299. maintain the expansions supplied by the vendor, so
  6300. that this information can supply information about
  6301. the sources that you imported from the vendor.
  6302. To maintain the keyword expansions supplied by the
  6303. vendor, supply the @samp{-ko} option to @code{cvs
  6304. import} the first time you import the file.
  6305. This will turn off keyword expansion
  6306. for that file entirely, so if you want to be more
  6307. selective you'll have to think about what you want
  6308. and use the @samp{-k} option to @code{cvs update} or
  6309. @code{cvs admin} as appropriate.
  6310. @c Supplying -ko to import if the file already existed
  6311. @c has no effect. Not clear to me whether it should
  6312. @c or not.
  6313. @node Multiple vendor branches
  6314. @section Multiple vendor branches
  6315. All the examples so far assume that there is only one
  6316. vendor from which you are getting sources. In some
  6317. situations you might get sources from a variety of
  6318. places. For example, suppose that you are dealing with
  6319. a project where many different people and teams are
  6320. modifying the software. There are a variety of ways to
  6321. handle this, but in some cases you have a bunch of
  6322. source trees lying around and what you want to do more
  6323. than anything else is just to all put them in @sc{cvs} so
  6324. that you at least have them in one place.
  6325. For handling situations in which there may be more than
  6326. one vendor, you may specify the @samp{-b} option to
  6327. @code{cvs import}. It takes as an argument the vendor
  6328. branch to import to. The default is @samp{-b 1.1.1}.
  6329. For example, suppose that there are two teams, the red
  6330. team and the blue team, that are sending you sources.
  6331. You want to import the red team's efforts to branch
  6332. 1.1.1 and use the vendor tag RED. You want to import
  6333. the blue team's efforts to branch 1.1.3 and use the
  6334. vendor tag BLUE. So the commands you might use are:
  6335. @example
  6336. $ cvs import dir RED RED_1-0
  6337. $ cvs import -b 1.1.3 dir BLUE BLUE_1-5
  6338. @end example
  6339. Note that if your vendor tag does not match your
  6340. @samp{-b} option, @sc{cvs} will not detect this case! For
  6341. example,
  6342. @example
  6343. $ cvs import -b 1.1.3 dir RED RED_1-0
  6344. @end example
  6345. @noindent
  6346. Be careful; this kind of mismatch is sure to sow
  6347. confusion or worse. I can't think of a useful purpose
  6348. for the ability to specify a mismatch here, but if you
  6349. discover such a use, don't. @sc{cvs} is likely to make this
  6350. an error in some future release.
  6351. @c Probably should say more about the semantics of
  6352. @c multiple branches. What about the default branch?
  6353. @c What about joining (perhaps not as useful with
  6354. @c multiple branches, or perhaps it is. Either way
  6355. @c should be mentioned).
  6356. @c I'm not sure about the best location for this. In
  6357. @c one sense, it might belong right after we've introduced
  6358. @c CVS's basic version control model, because people need
  6359. @c to figure out builds right away. The current location
  6360. @c is based on the theory that it kind of akin to the
  6361. @c "Revision management" section.
  6362. @node Builds
  6363. @chapter How your build system interacts with CVS
  6364. @cindex Builds
  6365. @cindex make
  6366. As mentioned in the introduction, @sc{cvs} does not
  6367. contain software for building your software from source
  6368. code. This section describes how various aspects of
  6369. your build system might interact with @sc{cvs}.
  6370. @c Is there a way to discuss this without reference to
  6371. @c tools other than CVS? I'm not sure there is; I
  6372. @c wouldn't think that people who learn CVS first would
  6373. @c even have this concern.
  6374. One common question, especially from people who are
  6375. accustomed to @sc{rcs}, is how to make their build get
  6376. an up to date copy of the sources. The answer to this
  6377. with @sc{cvs} is two-fold. First of all, since
  6378. @sc{cvs} itself can recurse through directories, there
  6379. is no need to modify your @file{Makefile} (or whatever
  6380. configuration file your build tool uses) to make sure
  6381. each file is up to date. Instead, just use two
  6382. commands, first @code{cvs -q update} and then
  6383. @code{make} or whatever the command is to invoke your
  6384. build tool. Secondly, you do not necessarily
  6385. @emph{want} to get a copy of a change someone else made
  6386. until you have finished your own work. One suggested
  6387. approach is to first update your sources, then
  6388. implement, build and
  6389. test the change you were thinking of, and then commit
  6390. your sources (updating first if necessary). By
  6391. periodically (in between changes, using the approach
  6392. just described) updating your entire tree, you ensure
  6393. that your sources are sufficiently up to date.
  6394. @cindex Bill of materials
  6395. One common need is to record which versions of which
  6396. source files went into a particular build. This kind
  6397. of functionality is sometimes called @dfn{bill of
  6398. materials} or something similar. The best way to do
  6399. this with @sc{cvs} is to use the @code{tag} command to
  6400. record which versions went into a given build
  6401. (@pxref{Tags}).
  6402. Using @sc{cvs} in the most straightforward manner
  6403. possible, each developer will have a copy of the entire
  6404. source tree which is used in a particular build. If
  6405. the source tree is small, or if developers are
  6406. geographically dispersed, this is the preferred
  6407. solution. In fact one approach for larger projects is
  6408. to break a project down into smaller
  6409. @c I say subsystem instead of module because they may or
  6410. @c may not use the modules file.
  6411. separately-compiled subsystems, and arrange a way of
  6412. releasing them internally so that each developer need
  6413. check out only those subsystems which they are
  6414. actively working on.
  6415. Another approach is to set up a structure which allows
  6416. developers to have their own copies of some files, and
  6417. for other files to access source files from a central
  6418. location. Many people have come up with some such a
  6419. @c two such people are paul@sander.cupertino.ca.us (for
  6420. @c a previous employer)
  6421. @c and gunnar.tornblom@se.abb.com (spicm and related tools),
  6422. @c but as far as I know
  6423. @c no one has nicely packaged or released such a system (or
  6424. @c instructions for constructing one).
  6425. system using features such as the symbolic link feature
  6426. found in many operating systems, or the @code{VPATH}
  6427. feature found in many versions of @code{make}. One build
  6428. tool which is designed to help with this kind of thing
  6429. is Odin (see
  6430. @code{ftp://ftp.cs.colorado.edu/pub/distribs/odin}).
  6431. @c Should we be saying more about Odin? Or how you use
  6432. @c it with CVS? Also, the Prime Time Freeware for Unix
  6433. @c disk (see http://www.ptf.com/) has Odin (with a nice
  6434. @c paragraph summarizing it on the web), so that might be a
  6435. @c semi-"official" place to point people.
  6436. @c
  6437. @c Of course, many non-CVS systems have this kind of
  6438. @c functionality, for example OSF's ODE
  6439. @c (http://www.osf.org/ode/) or mk
  6440. @c (http://www.grin.net/~pzi/mk-3.18.4.docs/mk_toc.html
  6441. @c He has changed providers in the past; a search engine search
  6442. @c for "Peter Ziobrzynski" probably won't get too many
  6443. @c spurious hits :-). A more stable URL might be
  6444. @c ftp://ftp.uu.net/pub/cmvc/mk). But I'm not sure
  6445. @c there is any point in mentioning them here unless they
  6446. @c can work with CVS.
  6447. @c ---------------------------------------------------------------------
  6448. @node Special Files
  6449. @chapter Special Files
  6450. @cindex Special files
  6451. @cindex Device nodes
  6452. @cindex Ownership, saving in CVS
  6453. @cindex Permissions, saving in CVS
  6454. @cindex Hard links
  6455. @cindex Symbolic links
  6456. In normal circumstances, @sc{cvs} works only with regular
  6457. files. Every file in a project is assumed to be
  6458. persistent; it must be possible to open, read and close
  6459. them; and so on. @sc{cvs} also ignores file permissions and
  6460. ownerships, leaving such issues to be resolved by the
  6461. developer at installation time. In other words, it is
  6462. not possible to "check in" a device into a repository;
  6463. if the device file cannot be opened, @sc{cvs} will refuse to
  6464. handle it. Files also lose their ownerships and
  6465. permissions during repository transactions.
  6466. @ignore
  6467. If the configuration variable @code{PreservePermissions}
  6468. (@pxref{config}) is set in the repository, @sc{cvs} will
  6469. save the following file characteristics in the
  6470. repository:
  6471. @itemize @bullet
  6472. @item user and group ownership
  6473. @item permissions
  6474. @item major and minor device numbers
  6475. @item symbolic links
  6476. @item hard link structure
  6477. @end itemize
  6478. Using the @code{PreservePermissions} option affects the
  6479. behavior of @sc{cvs} in several ways. First, some of the
  6480. new operations supported by @sc{cvs} are not accessible to
  6481. all users. In particular, file ownership and special
  6482. file characteristics may only be changed by the
  6483. superuser. When the @code{PreservePermissions}
  6484. configuration variable is set, therefore, users will
  6485. have to be `root' in order to perform @sc{cvs} operations.
  6486. When @code{PreservePermissions} is in use, some @sc{cvs}
  6487. operations (such as @samp{cvs status}) will not
  6488. recognize a file's hard link structure, and so will
  6489. emit spurious warnings about mismatching hard links.
  6490. The reason is that @sc{cvs}'s internal structure does not
  6491. make it easy for these operations to collect all the
  6492. necessary data about hard links, so they check for file
  6493. conflicts with inaccurate data.
  6494. A more subtle difference is that @sc{cvs} considers a file
  6495. to have changed only if its contents have changed
  6496. (specifically, if the modification time of the working
  6497. file does not match that of the repository's file).
  6498. Therefore, if only the permissions, ownership or hard
  6499. linkage have changed, or if a device's major or minor
  6500. numbers have changed, @sc{cvs} will not notice. In order to
  6501. commit such a change to the repository, you must force
  6502. the commit with @samp{cvs commit -f}. This also means
  6503. that if a file's permissions have changed and the
  6504. repository file is newer than the working copy,
  6505. performing @samp{cvs update} will silently change the
  6506. permissions on the working copy.
  6507. Changing hard links in a @sc{cvs} repository is particularly
  6508. delicate. Suppose that file @file{foo} is linked to
  6509. file @file{old}, but is later relinked to file
  6510. @file{new}. You can wind up in the unusual situation
  6511. where, although @file{foo}, @file{old} and @file{new}
  6512. have all had their underlying link patterns changed,
  6513. only @file{foo} and @file{new} have been modified, so
  6514. @file{old} is not considered a candidate for checking
  6515. in. It can be very easy to produce inconsistent
  6516. results this way. Therefore, we recommend that when it
  6517. is important to save hard links in a repository, the
  6518. prudent course of action is to @code{touch} any file
  6519. whose linkage or status has changed since the last
  6520. checkin. Indeed, it may be wise to @code{touch *}
  6521. before each commit in a directory with complex hard
  6522. link structures.
  6523. It is worth noting that only regular files may
  6524. be merged, for reasons that hopefully are obvious. If
  6525. @samp{cvs update} or @samp{cvs checkout -j} attempts to
  6526. merge a symbolic link with a regular file, or two
  6527. device files for different kinds of devices, @sc{cvs} will
  6528. report a conflict and refuse to perform the merge. At
  6529. the same time, @samp{cvs diff} will not report any
  6530. differences between these files, since no meaningful
  6531. textual comparisons can be made on files which contain
  6532. no text.
  6533. The @code{PreservePermissions} features do not work
  6534. with client/server @sc{cvs}. Another limitation is
  6535. that hard links must be to other files within the same
  6536. directory; hard links across directories are not
  6537. supported.
  6538. @end ignore
  6539. @c ---------------------------------------------------------------------
  6540. @c ----- START MAN 1 -----
  6541. @node CVS commands
  6542. @appendix Guide to CVS commands
  6543. This appendix describes the overall structure of
  6544. @sc{cvs} commands, and describes some commands in
  6545. detail (others are described elsewhere; for a quick
  6546. reference to @sc{cvs} commands, @pxref{Invoking CVS}).
  6547. @c The idea is that we want to move the commands which
  6548. @c are described here into the main body of the manual,
  6549. @c in the process reorganizing the manual to be
  6550. @c organized around what the user wants to do, not
  6551. @c organized around CVS commands.
  6552. @c
  6553. @c Note that many users do expect a manual which is
  6554. @c organized by command. At least some users do.
  6555. @c One good addition to the "organized by command"
  6556. @c section (if any) would be "see also" links.
  6557. @c The awk manual might be a good example; it has a
  6558. @c reference manual which is more verbose than Invoking
  6559. @c CVS but probably somewhat less verbose than CVS
  6560. @c Commands.
  6561. @menu
  6562. * Structure:: Overall structure of CVS commands
  6563. * Exit status:: Indicating CVS's success or failure
  6564. * ~/.cvsrc:: Default options with the ~/.cvsrc file
  6565. * Global options:: Options you give to the left of cvs_command
  6566. * Common options:: Options you give to the right of cvs_command
  6567. * add:: Add files and directories to the repository
  6568. * admin:: Administration
  6569. * annotate:: What revision modified each line of a file?
  6570. * checkout:: Checkout sources for editing
  6571. * commit:: Check files into the repository
  6572. * diff:: Show differences between revisions
  6573. * export:: Export sources from CVS, similar to checkout
  6574. * history:: Show status of files and users
  6575. * import:: Import sources into CVS, using vendor branches
  6576. * log:: Show log messages for files
  6577. * rdiff:: 'patch' format diffs between releases
  6578. * release:: Indicate that a directory is no longer in use
  6579. * remove:: Remove files from active development
  6580. * update:: Bring work tree in sync with repository
  6581. @end menu
  6582. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6583. @node Structure
  6584. @appendixsec Overall structure of CVS commands
  6585. @cindex Structure
  6586. @cindex CVS command structure
  6587. @cindex Command structure
  6588. @cindex Format of CVS commands
  6589. The overall format of all @sc{cvs} commands is:
  6590. @example
  6591. cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
  6592. @end example
  6593. @table @code
  6594. @item cvs
  6595. The name of the @sc{cvs} program.
  6596. @item cvs_options
  6597. Some options that affect all sub-commands of @sc{cvs}. These are
  6598. described below.
  6599. @item cvs_command
  6600. One of several different sub-commands. Some of the commands have
  6601. aliases that can be used instead; those aliases are noted in the
  6602. reference manual for that command. There are only two situations
  6603. where you may omit @samp{cvs_command}: @samp{cvs -H} elicits a
  6604. list of available commands, and @samp{cvs -v} displays version
  6605. information on @sc{cvs} itself.
  6606. @item command_options
  6607. Options that are specific for the command.
  6608. @item command_args
  6609. Arguments to the commands.
  6610. @end table
  6611. There is unfortunately some confusion between
  6612. @code{cvs_options} and @code{command_options}.
  6613. When given as a @code{cvs_option}, some options only
  6614. affect some of the commands. When given as a
  6615. @code{command_option} it may have a different meaning, and
  6616. be accepted by more commands. In other words, do not
  6617. take the above categorization too seriously. Look at
  6618. the documentation instead.
  6619. @node Exit status
  6620. @appendixsec CVS's exit status
  6621. @cindex Exit status, of CVS
  6622. @sc{cvs} can indicate to the calling environment whether it
  6623. succeeded or failed by setting its @dfn{exit status}.
  6624. The exact way of testing the exit status will vary from
  6625. one operating system to another. For example in a unix
  6626. shell script the @samp{$?} variable will be 0 if the
  6627. last command returned a successful exit status, or
  6628. greater than 0 if the exit status indicated failure.
  6629. If @sc{cvs} is successful, it returns a successful status;
  6630. if there is an error, it prints an error message and
  6631. returns a failure status. The one exception to this is
  6632. the @code{cvs diff} command. It will return a
  6633. successful status if it found no differences, or a
  6634. failure status if there were differences or if there
  6635. was an error. Because this behavior provides no good
  6636. way to detect errors, in the future it is possible that
  6637. @code{cvs diff} will be changed to behave like the
  6638. other @sc{cvs} commands.
  6639. @c It might seem like checking whether cvs -q diff
  6640. @c produces empty or non-empty output can tell whether
  6641. @c there were differences or not. But it seems like
  6642. @c there are cases with output but no differences
  6643. @c (testsuite basica-8b). It is not clear to me how
  6644. @c useful it is for a script to be able to check
  6645. @c whether there were differences.
  6646. @c FIXCVS? In previous versions of CVS, cvs diff
  6647. @c returned 0 for no differences, 1 for differences, or
  6648. @c 2 for errors. Is this behavior worth trying to
  6649. @c bring back (but what does it mean for VMS?)?
  6650. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6651. @node ~/.cvsrc
  6652. @appendixsec Default options and the ~/.cvsrc file
  6653. @cindex .cvsrc file
  6654. @cindex Option defaults
  6655. There are some @code{command_options} that are used so
  6656. often that you might have set up an alias or some other
  6657. means to make sure you always specify that option. One
  6658. example (the one that drove the implementation of the
  6659. @file{.cvsrc} support, actually) is that many people find the
  6660. default output of the @samp{diff} command to be very
  6661. hard to read, and that either context diffs or unidiffs
  6662. are much easier to understand.
  6663. The @file{~/.cvsrc} file is a way that you can add
  6664. default options to @code{cvs_commands} within cvs,
  6665. instead of relying on aliases or other shell scripts.
  6666. The format of the @file{~/.cvsrc} file is simple. The
  6667. file is searched for a line that begins with the same
  6668. name as the @code{cvs_command} being executed. If a
  6669. match is found, then the remainder of the line is split
  6670. up (at whitespace characters) into separate options and
  6671. added to the command arguments @emph{before} any
  6672. options from the command line.
  6673. If a command has two names (e.g., @code{checkout} and
  6674. @code{co}), the official name, not necessarily the one
  6675. used on the command line, will be used to match against
  6676. the file. So if this is the contents of the user's
  6677. @file{~/.cvsrc} file:
  6678. @example
  6679. log -N
  6680. diff -uN
  6681. rdiff -u
  6682. update -Pd
  6683. checkout -P
  6684. release -d
  6685. @end example
  6686. @noindent
  6687. the command @samp{cvs checkout foo} would have the
  6688. @samp{-P} option added to the arguments, as well as
  6689. @samp{cvs co foo}.
  6690. With the example file above, the output from @samp{cvs
  6691. diff foobar} will be in unidiff format. @samp{cvs diff
  6692. -c foobar} will provide context diffs, as usual.
  6693. Getting "old" format diffs would be slightly more
  6694. complicated, because @code{diff} doesn't have an option
  6695. to specify use of the "old" format, so you would need
  6696. @samp{cvs -f diff foobar}.
  6697. In place of the command name you can use @code{cvs} to
  6698. specify global options (@pxref{Global options}). For
  6699. example the following line in @file{.cvsrc}
  6700. @example
  6701. cvs -z6
  6702. @end example
  6703. @noindent
  6704. causes @sc{cvs} to use compression level 6.
  6705. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6706. @node Global options
  6707. @appendixsec Global options
  6708. @cindex Options, global
  6709. @cindex Global options
  6710. @cindex Left-hand options
  6711. The available @samp{cvs_options} (that are given to the
  6712. left of @samp{cvs_command}) are:
  6713. @table @code
  6714. @item --allow-root=@var{rootdir}
  6715. Specify legal @sc{cvsroot} directory. See
  6716. @ref{Password authentication server}.
  6717. @cindex Authentication, stream
  6718. @cindex Stream authentication
  6719. @item -a
  6720. Authenticate all communication between the client and
  6721. the server. Only has an effect on the @sc{cvs} client.
  6722. As of this writing, this is only implemented when using
  6723. a GSSAPI connection (@pxref{GSSAPI authenticated}).
  6724. Authentication prevents certain sorts of attacks
  6725. involving hijacking the active @sc{tcp} connection.
  6726. Enabling authentication does not enable encryption.
  6727. @cindex RCSBIN, overriding
  6728. @cindex Overriding RCSBIN
  6729. @item -b @var{bindir}
  6730. In @sc{cvs} 1.9.18 and older, this specified that
  6731. @sc{rcs} programs are in the @var{bindir} directory.
  6732. Current versions of @sc{cvs} do not run @sc{rcs}
  6733. programs; for compatibility this option is accepted,
  6734. but it does nothing.
  6735. @cindex TMPDIR, overriding
  6736. @cindex Overriding TMPDIR
  6737. @item -T @var{tempdir}
  6738. Use @var{tempdir} as the directory where temporary files are
  6739. located. Overrides the setting of the @code{$TMPDIR} environment
  6740. variable and any precompiled directory. This parameter should be
  6741. specified as an absolute pathname.
  6742. (When running client/server, @samp{-T} affects only the local process;
  6743. specifying @samp{-T} for the client has no effect on the server and
  6744. vice versa.)
  6745. @cindex CVSROOT, overriding
  6746. @cindex Overriding CVSROOT
  6747. @item -d @var{cvs_root_directory}
  6748. Use @var{cvs_root_directory} as the root directory
  6749. pathname of the repository. Overrides the setting of
  6750. the @code{$CVSROOT} environment variable. See @ref{Repository}.
  6751. @cindex EDITOR, overriding
  6752. @cindex Overriding EDITOR
  6753. @item -e @var{editor}
  6754. Use @var{editor} to enter revision log information. Overrides the
  6755. setting of the @code{$CVSEDITOR} and @code{$EDITOR}
  6756. environment variables. For more information, see
  6757. @ref{Committing your changes}.
  6758. @item -f
  6759. Do not read the @file{~/.cvsrc} file. This
  6760. option is most often used because of the
  6761. non-orthogonality of the @sc{cvs} option set. For
  6762. example, the @samp{cvs log} option @samp{-N} (turn off
  6763. display of tag names) does not have a corresponding
  6764. option to turn the display on. So if you have
  6765. @samp{-N} in the @file{~/.cvsrc} entry for @samp{log},
  6766. you may need to use @samp{-f} to show the tag names.
  6767. @item -H
  6768. @itemx --help
  6769. Display usage information about the specified @samp{cvs_command}
  6770. (but do not actually execute the command). If you don't specify
  6771. a command name, @samp{cvs -H} displays overall help for
  6772. @sc{cvs}, including a list of other help options.
  6773. @c It seems to me it is better to document it this way
  6774. @c rather than trying to update this documentation
  6775. @c every time that we add a --help-foo option. But
  6776. @c perhaps that is confusing...
  6777. @cindex Read-only mode
  6778. @item -n
  6779. Do not change any files. Attempt to execute the
  6780. @samp{cvs_command}, but only to issue reports; do not remove,
  6781. update, or merge any existing files, or create any new files.
  6782. Note that @sc{cvs} will not necessarily produce exactly
  6783. the same output as without @samp{-n}. In some cases
  6784. the output will be the same, but in other cases
  6785. @sc{cvs} will skip some of the processing that would
  6786. have been required to produce the exact same output.
  6787. @item -Q
  6788. Cause the command to be really quiet; the command will only
  6789. generate output for serious problems.
  6790. @item -q
  6791. Cause the command to be somewhat quiet; informational messages,
  6792. such as reports of recursion through subdirectories, are
  6793. suppressed.
  6794. @cindex Read-only files, and -r
  6795. @item -r
  6796. Make new working files read-only. Same effect
  6797. as if the @code{$CVSREAD} environment variable is set
  6798. (@pxref{Environment variables}). The default is to
  6799. make working files writable, unless watches are on
  6800. (@pxref{Watches}).
  6801. @item -s @var{variable}=@var{value}
  6802. Set a user variable (@pxref{Variables}).
  6803. @cindex Trace
  6804. @item -t
  6805. Trace program execution; display messages showing the steps of
  6806. @sc{cvs} activity. Particularly useful with @samp{-n} to explore the
  6807. potential impact of an unfamiliar command.
  6808. @item -v
  6809. @item --version
  6810. Display version and copyright information for @sc{cvs}.
  6811. @cindex CVSREAD, overriding
  6812. @cindex Overriding CVSREAD
  6813. @item -w
  6814. Make new working files read-write. Overrides the
  6815. setting of the @code{$CVSREAD} environment variable.
  6816. Files are created read-write by default, unless @code{$CVSREAD} is
  6817. set or @samp{-r} is given.
  6818. @c Note that -w only overrides -r and CVSREAD; it has
  6819. @c no effect on files which are readonly because of
  6820. @c "cvs watch on". My guess is that is the way it
  6821. @c should be (or should "cvs -w get" on a watched file
  6822. @c be the same as a get and a cvs edit?), but I'm not
  6823. @c completely sure whether to document it this way.
  6824. @item -x
  6825. @cindex Encryption
  6826. Encrypt all communication between the client and the
  6827. server. Only has an effect on the @sc{cvs} client. As
  6828. of this writing, this is only implemented when using a
  6829. GSSAPI connection (@pxref{GSSAPI authenticated}) or a
  6830. Kerberos connection (@pxref{Kerberos authenticated}).
  6831. Enabling encryption implies that message traffic is
  6832. also authenticated. Encryption support is not
  6833. available by default; it must be enabled using a
  6834. special configure option, @file{--enable-encryption},
  6835. when you build @sc{cvs}.
  6836. @item -z @var{gzip-level}
  6837. @cindex Compression
  6838. @cindex Gzip
  6839. Set the compression level.
  6840. Valid levels are 1 (high speed, low compression) to
  6841. 9 (low speed, high compression), or 0 to disable
  6842. compression (the default).
  6843. Only has an effect on the @sc{cvs} client.
  6844. @end table
  6845. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  6846. @node Common options
  6847. @appendixsec Common command options
  6848. @cindex Common options
  6849. @cindex Right-hand options
  6850. This section describes the @samp{command_options} that
  6851. are available across several @sc{cvs} commands. These
  6852. options are always given to the right of
  6853. @samp{cvs_command}. Not all
  6854. commands support all of these options; each option is
  6855. only supported for commands where it makes sense.
  6856. However, when a command has one of these options you
  6857. can almost always count on the same behavior of the
  6858. option as in other commands. (Other command options,
  6859. which are listed with the individual commands, may have
  6860. different behavior from one @sc{cvs} command to the other).
  6861. @strong{The @samp{history} command is an exception; it supports
  6862. many options that conflict even with these standard options.}
  6863. @table @code
  6864. @cindex Dates
  6865. @cindex Time
  6866. @cindex Specifying dates
  6867. @item -D @var{date_spec}
  6868. Use the most recent revision no later than @var{date_spec}.
  6869. @var{date_spec} is a single argument, a date description
  6870. specifying a date in the past.
  6871. The specification is @dfn{sticky} when you use it to make a
  6872. private copy of a source file; that is, when you get a working
  6873. file using @samp{-D}, @sc{cvs} records the date you specified, so that
  6874. further updates in the same directory will use the same date
  6875. (for more information on sticky tags/dates, @pxref{Sticky tags}).
  6876. @samp{-D} is available with the @code{annotate}, @code{checkout},
  6877. @code{diff}, @code{export}, @code{history},
  6878. @code{rdiff}, @code{rtag}, and @code{update} commands.
  6879. (The @code{history} command uses this option in a
  6880. slightly different way; @pxref{history options}).
  6881. @c What other formats should we accept? I don't want
  6882. @c to start accepting a whole mess of non-standard
  6883. @c new formats (there are a lot which are in wide use in
  6884. @c one context or another), but practicality does
  6885. @c dictate some level of flexibility.
  6886. @c * POSIX.2 (e.g. touch, ls output, date) and other
  6887. @c POSIX and/or de facto unix standards (e.g. at). The
  6888. @c practice here is too inconsistent to be of any use.
  6889. @c * VMS dates. This is not a formal standard, but
  6890. @c there is a published specification (see SYS$ASCTIM
  6891. @c and SYS$BINTIM in the _VMS System Services Reference
  6892. @c Manual_), it is implemented consistently in VMS
  6893. @c utilities, and VMS users will expect CVS running on
  6894. @c VMS to support this format (and if we're going to do
  6895. @c that, better to make CVS support it on all
  6896. @c platforms. Maybe).
  6897. @c
  6898. @c NOTE: The tar manual has some documentation for
  6899. @c getdate.y (just for our info; we don't want to
  6900. @c attempt to document all the formats accepted by
  6901. @c getdate.y).
  6902. @c
  6903. @c One more note: In output, CVS should consistently
  6904. @c use one date format, and that format should be one that
  6905. @c it accepts in input as well. The former isn't
  6906. @c really true (see survey below), and I'm not
  6907. @c sure that either of those formats is accepted in
  6908. @c input.
  6909. @c
  6910. @c cvs log
  6911. @c current 1996/01/02 13:45:31
  6912. @c Internet 02 Jan 1996 13:45:31 UT
  6913. @c ISO 1996-01-02 13:45:31
  6914. @c cvs ann
  6915. @c current 02-Jan-96
  6916. @c Internet-like 02 Jan 96
  6917. @c ISO 96-01-02
  6918. @c cvs status
  6919. @c current Tue Jun 11 02:54:53 1996
  6920. @c Internet [Tue,] 11 Jun 1996 02:54:53
  6921. @c ISO 1996-06-11 02:54:53
  6922. @c note: date possibly should be omitted entirely for
  6923. @c other reasons.
  6924. @c cvs editors
  6925. @c current Tue Jun 11 02:54:53 1996 GMT
  6926. @c cvs history
  6927. @c current 06/11 02:54 +0000
  6928. @c any others?
  6929. @c There is a good chance the proper solution has to
  6930. @c involve at least some level of letting the user
  6931. @c decide which format (with the default being the
  6932. @c formats CVS has always used; changing these might be
  6933. @c _very_ disruptive since scripts may very well be
  6934. @c parsing them).
  6935. @c
  6936. @c Another random bit of prior art concerning dates is
  6937. @c the strptime function which takes templates such as
  6938. @c "%m/%d/%y", and apparent a variant of getdate()
  6939. @c which also honors them. See
  6940. @c X/Open CAE Specification, System Interfaces and
  6941. @c Headers Issue 4, Version 2 (September 1994), in the
  6942. @c entry for getdate() on page 231
  6943. @cindex Timezone, in input
  6944. @cindex Zone, time, in input
  6945. A wide variety of date formats are supported by
  6946. @sc{cvs}. The most standard ones are ISO8601 (from the
  6947. International Standards Organization) and the Internet
  6948. e-mail standard (specified in RFC822 as amended by
  6949. RFC1123).
  6950. @c Probably should be doing more to spell out just what
  6951. @c the rules are, rather than just giving examples.
  6952. @c But I want to keep this simple too.
  6953. @c So I don't know....
  6954. @c A few specific issues: (1) Maybe should reassure
  6955. @c people that years after 2000
  6956. @c work (they are in the testsuite, so they do indeed
  6957. @c work). (2) What do two digit years
  6958. @c mean? Where do we accept them? (3) Local times can
  6959. @c be ambiguous or nonexistent if they fall during the
  6960. @c hour when daylight savings time goes into or out of
  6961. @c effect. Pretty obscure, so I'm not at all sure we
  6962. @c should be documenting the behavior in that case.
  6963. ISO8601 dates have many variants but a few examples
  6964. are:
  6965. @example
  6966. 1972-09-24
  6967. 1972-09-24 20:05
  6968. @end example
  6969. @c I doubt we really accept all ISO8601 format dates
  6970. @c (for example, decimal hours like 1972-09-24 20,2)
  6971. @c I'm not sure we should, many of them are pretty
  6972. @c bizarre and it has lots of gratuitous multiple ways
  6973. @c to specify the same thing.
  6974. There are a lot more ISO8601 date formats, and @sc{cvs}
  6975. accepts many of them, but you probably don't want to
  6976. hear the @emph{whole} long story :-).
  6977. @c Citing a URL here is kind of problematic given how
  6978. @c much they change and people who have old versions of
  6979. @c this manual, but in case we want to reinstate an
  6980. @c ISO8601 URL, a few are:
  6981. @c http://www.saqqara.demon.co.uk/datefmt.htm
  6982. @c http://www.cl.cam.ac.uk/~mgk25/iso-time.html
  6983. @c Citing some other ISO8601 source is probably even
  6984. @c worse :-).
  6985. In addition to the dates allowed in Internet e-mail
  6986. itself, @sc{cvs} also allows some of the fields to be
  6987. omitted. For example:
  6988. @c FIXME: Need to figure out better, and document,
  6989. @c what we want to allow the user to omit.
  6990. @c NOTE: "omit" does not imply "reorder".
  6991. @c FIXME: Need to cite a web page describing how to get
  6992. @c RFC's.
  6993. @example
  6994. 24 Sep 1972 20:05
  6995. 24 Sep
  6996. @end example
  6997. The date is interpreted as being in the
  6998. local timezone, unless a specific timezone is
  6999. specified.
  7000. These two date formats are preferred. However,
  7001. @sc{cvs} currently accepts a wide variety of other date
  7002. formats. They are intentionally not documented here in
  7003. any detail, and future versions of @sc{cvs} might not
  7004. accept all of them.
  7005. @c We should document and testsuite "now" and
  7006. @c "yesterday". "now" is mentioned in the FAQ and
  7007. @c "yesterday" is mentioned in this document (and the
  7008. @c message from "cvs import" suggesting a merge
  7009. @c command). What else? Probably some/all of the "3
  7010. @c weeks ago" family.
  7011. @c
  7012. @c Maybe at
  7013. @c some point have CVS start give warnings on "unofficial"
  7014. @c formats (many of which might be typos or user
  7015. @c misunderstandings, and/or formats people never/rarely
  7016. @c use to specify dates)?
  7017. One such format is
  7018. @code{@var{month}/@var{day}/@var{year}}. This may
  7019. confuse people who are accustomed to having the month
  7020. and day in the other order; @samp{1/4/96} is January 4,
  7021. not April 1.
  7022. Remember to quote the argument to the @samp{-D}
  7023. flag so that your shell doesn't interpret spaces as
  7024. argument separators. A command using the @samp{-D}
  7025. flag can look like this:
  7026. @example
  7027. $ cvs diff -D "1 hour ago" cvs.texinfo
  7028. @end example
  7029. @cindex Forcing a tag match
  7030. @item -f
  7031. When you specify a particular date or tag to @sc{cvs} commands, they
  7032. normally ignore files that do not contain the tag (or did not
  7033. exist prior to the date) that you specified. Use the @samp{-f} option
  7034. if you want files retrieved even when there is no match for the
  7035. tag or date. (The most recent revision of the file
  7036. will be used).
  7037. Note that even with @samp{-f}, a tag that you specify
  7038. must exist (that is, in some file, not necessary in
  7039. every file). This is so that @sc{cvs} will continue to
  7040. give an error if you mistype a tag name.
  7041. @need 800
  7042. @samp{-f} is available with these commands:
  7043. @code{annotate}, @code{checkout}, @code{export},
  7044. @code{rdiff}, @code{rtag}, and @code{update}.
  7045. @strong{WARNING: The @code{commit} and @code{remove}
  7046. commands also have a
  7047. @samp{-f} option, but it has a different behavior for
  7048. those commands. See @ref{commit options}, and
  7049. @ref{Removing files}.}
  7050. @item -k @var{kflag}
  7051. Alter the default processing of keywords.
  7052. See @ref{Keyword substitution}, for the meaning of
  7053. @var{kflag}. Your @var{kflag} specification is
  7054. @dfn{sticky} when you use it to create a private copy
  7055. of a source file; that is, when you use this option
  7056. with the @code{checkout} or @code{update} commands,
  7057. @sc{cvs} associates your selected @var{kflag} with the
  7058. file, and continues to use it with future update
  7059. commands on the same file until you specify otherwise.
  7060. The @samp{-k} option is available with the @code{add},
  7061. @code{checkout}, @code{diff}, @code{rdiff}, @code{import} and
  7062. @code{update} commands.
  7063. @item -l
  7064. Local; run only in current working directory, rather than
  7065. recursing through subdirectories.
  7066. Available with the following commands: @code{annotate}, @code{checkout},
  7067. @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
  7068. @code{log}, @code{rdiff}, @code{remove}, @code{rtag},
  7069. @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
  7070. and @code{watchers}.
  7071. @cindex Editor, avoiding invocation of
  7072. @cindex Avoiding editor invocation
  7073. @item -m @var{message}
  7074. Use @var{message} as log information, instead of
  7075. invoking an editor.
  7076. Available with the following commands: @code{add},
  7077. @code{commit} and @code{import}.
  7078. @item -n
  7079. Do not run any tag program. (A program can be
  7080. specified to run in the modules
  7081. database (@pxref{modules}); this option bypasses it).
  7082. @strong{This is not the same as the @samp{cvs -n}
  7083. program option, which you can specify to the left of a cvs command!}
  7084. Available with the @code{checkout}, @code{export},
  7085. and @code{rtag} commands.
  7086. @item -P
  7087. Prune empty directories. See @ref{Removing directories}.
  7088. @item -p
  7089. Pipe the files retrieved from the repository to standard output,
  7090. rather than writing them in the current directory. Available
  7091. with the @code{checkout} and @code{update} commands.
  7092. @item -R
  7093. Process directories recursively. This is on by default.
  7094. Available with the following commands: @code{annotate}, @code{checkout},
  7095. @code{commit}, @code{diff}, @code{edit}, @code{editors}, @code{export},
  7096. @code{rdiff}, @code{remove}, @code{rtag},
  7097. @code{status}, @code{tag}, @code{unedit}, @code{update}, @code{watch},
  7098. and @code{watchers}.
  7099. @item -r @var{tag}
  7100. @cindex HEAD, special tag
  7101. @cindex BASE, special tag
  7102. Use the revision specified by the @var{tag} argument instead of the
  7103. default @dfn{head} revision. As well as arbitrary tags defined
  7104. with the @code{tag} or @code{rtag} command, two special tags are
  7105. always available: @samp{HEAD} refers to the most recent version
  7106. available in the repository, and @samp{BASE} refers to the
  7107. revision you last checked out into the current working directory.
  7108. @c FIXME: What does HEAD really mean? I believe that
  7109. @c the current answer is the head of the default branch
  7110. @c for all cvs commands except diff. For diff, it
  7111. @c seems to be (a) the head of the trunk (or the default
  7112. @c branch?) if there is no sticky tag, (b) the head of the
  7113. @c branch for the sticky tag, if there is a sticky tag.
  7114. @c (b) is ugly as it differs
  7115. @c from what HEAD means for other commands, but people
  7116. @c and/or scripts are quite possibly used to it.
  7117. @c See "head" tests in sanity.sh.
  7118. @c Probably the best fix is to introduce two new
  7119. @c special tags, ".thead" for the head of the trunk,
  7120. @c and ".bhead" for the head of the current branch.
  7121. @c Then deprecate HEAD. This has the advantage of
  7122. @c not surprising people with a change to HEAD, and a
  7123. @c side benefit of also phasing out the poorly-named
  7124. @c HEAD (see discussion of reserved tag names in node
  7125. @c "Tags"). Of course, .thead and .bhead should be
  7126. @c carefully implemented (with the implementation the
  7127. @c same for "diff" as for everyone else), test cases
  7128. @c written (similar to the ones in "head"), new tests
  7129. @c cases written for things like default branches, &c.
  7130. The tag specification is sticky when you use this
  7131. @c option
  7132. with @code{checkout} or @code{update} to make your own
  7133. copy of a file: @sc{cvs} remembers the tag and continues to use it on
  7134. future update commands, until you specify otherwise (for more information
  7135. on sticky tags/dates, @pxref{Sticky tags}).
  7136. The tag can be either a symbolic or numeric tag, as
  7137. described in @ref{Tags}, or the name of a branch, as
  7138. described in @ref{Branching and merging}.
  7139. When a command expects a specific revision,
  7140. the name of a branch is interpreted as the most recent
  7141. revision on that branch.
  7142. Specifying the @samp{-q} global option along with the
  7143. @samp{-r} command option is often useful, to suppress
  7144. the warning messages when the @sc{rcs} file
  7145. does not contain the specified tag.
  7146. @strong{This is not the same as the overall @samp{cvs -r} option,
  7147. which you can specify to the left of a @sc{cvs} command!}
  7148. @samp{-r} is available with the @code{annotate}, @code{checkout},
  7149. @code{commit}, @code{diff}, @code{history}, @code{export}, @code{rdiff},
  7150. @code{rtag}, and @code{update} commands.
  7151. @item -W
  7152. Specify file names that should be filtered. You can
  7153. use this option repeatedly. The spec can be a file
  7154. name pattern of the same type that you can specify in
  7155. the @file{.cvswrappers} file.
  7156. Available with the following commands: @code{import},
  7157. and @code{update}.
  7158. @end table
  7159. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7160. @node add
  7161. @appendixsec add---Add files and directories to the repository
  7162. @cindex add (subcommand)
  7163. @itemize @bullet
  7164. @item
  7165. Synopsis: add [-k rcs-kflag] [-m message] files...
  7166. @item
  7167. Requires: repository, working directory.
  7168. @item
  7169. Changes: repository, working directory.
  7170. @end itemize
  7171. The @code{add} command is used to present new files
  7172. and directories for addition into the @sc{cvs}
  7173. repository. When @code{add} is used on a directory,
  7174. a new directory is created in the repository
  7175. immediately. When used on a file, only the working
  7176. directory is updated. Changes to the repository are
  7177. not made until the @code{commit} command is used on
  7178. the newly added file.
  7179. The @code{add} command also resurrects files that
  7180. have been previously removed. This can be done
  7181. before or after the @code{commit} command is used
  7182. to finalize the removal of files. Resurrected files
  7183. are restored into the working directory at the time
  7184. the @code{add} command is executed.
  7185. @menu
  7186. * add options:: add options
  7187. * add examples:: add examples
  7188. @end menu
  7189. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7190. @node add options
  7191. @appendixsubsec add options
  7192. These standard options are supported by @code{add}
  7193. (@pxref{Common options}, for a complete description of
  7194. them):
  7195. @table @code
  7196. @item -k @var{kflag}
  7197. Process keywords according to @var{kflag}. See
  7198. @ref{Keyword substitution}.
  7199. This option is sticky; future updates of
  7200. this file in this working directory will use the same
  7201. @var{kflag}. The @code{status} command can be viewed
  7202. to see the sticky options. For more information on
  7203. the @code{status} command, @xref{Invoking CVS}.
  7204. @item -m @var{message}
  7205. Use @var{message} as the log message, instead of
  7206. invoking an editor.
  7207. @end table
  7208. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7209. @node add examples
  7210. @appendixsubsec add examples
  7211. @appendixsubsubsec Adding a directory
  7212. @example
  7213. $ mkdir doc
  7214. $ cvs add doc
  7215. Directory /path/to/repository/doc added to the repository
  7216. @end example
  7217. @appendixsubsubsec Adding a file
  7218. @example
  7219. $ >TODO
  7220. $ cvs add TODO
  7221. cvs add: scheduling file `TODO' for addition
  7222. cvs add: use 'cvs commit' to add this file permanently
  7223. @end example
  7224. @appendixsubsubsec Undoing a @code{remove} command
  7225. @example
  7226. $ rm -f makefile
  7227. $ cvs remove makefile
  7228. cvs remove: scheduling `makefile' for removal
  7229. cvs remove: use 'cvs commit' to remove this file permanently
  7230. $ cvs add makefile
  7231. U makefile
  7232. cvs add: makefile, version 1.2, resurrected
  7233. @end example
  7234. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7235. @node admin
  7236. @appendixsec admin---Administration
  7237. @cindex Admin (subcommand)
  7238. @itemize @bullet
  7239. @item
  7240. Requires: repository, working directory.
  7241. @item
  7242. Changes: repository.
  7243. @item
  7244. Synonym: rcs
  7245. @end itemize
  7246. This is the @sc{cvs} interface to assorted
  7247. administrative facilities. Some of them have
  7248. questionable usefulness for @sc{cvs} but exist for
  7249. historical purposes. Some of the questionable options
  7250. are likely to disappear in the future. This command
  7251. @emph{does} work recursively, so extreme care should be
  7252. used.
  7253. @cindex cvsadmin
  7254. On unix, if there is a group named @code{cvsadmin},
  7255. only members of that group can run @code{cvs admin}
  7256. (except for the @code{cvs admin -k} command, which can
  7257. be run by anybody). This group should exist on the
  7258. server, or any system running the non-client/server
  7259. @sc{cvs}. To disallow @code{cvs admin} for all users,
  7260. create a group with no users in it. On NT, the
  7261. @code{cvsadmin} feature does not exist and all users
  7262. can run @code{cvs admin}.
  7263. @menu
  7264. * admin options:: admin options
  7265. @end menu
  7266. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7267. @node admin options
  7268. @appendixsubsec admin options
  7269. Some of these options have questionable usefulness for
  7270. @sc{cvs} but exist for historical purposes. Some even
  7271. make it impossible to use @sc{cvs} until you undo the
  7272. effect!
  7273. @table @code
  7274. @item -A@var{oldfile}
  7275. Might not work together with @sc{cvs}. Append the
  7276. access list of @var{oldfile} to the access list of the
  7277. @sc{rcs} file.
  7278. @item -a@var{logins}
  7279. Might not work together with @sc{cvs}. Append the
  7280. login names appearing in the comma-separated list
  7281. @var{logins} to the access list of the @sc{rcs} file.
  7282. @item -b[@var{rev}]
  7283. Set the default branch to @var{rev}. In @sc{cvs}, you
  7284. normally do not manipulate default branches; sticky
  7285. tags (@pxref{Sticky tags}) are a better way to decide
  7286. which branch you want to work on. There is one reason
  7287. to run @code{cvs admin -b}: to revert to the vendor's
  7288. version when using vendor branches (@pxref{Reverting
  7289. local changes}).
  7290. There can be no space between @samp{-b} and its argument.
  7291. @c Hmm, we don't document the usage where rev is
  7292. @c omitted. Maybe that usage can/should be deprecated
  7293. @c (and replaced with -bHEAD or something?) (so we can toss
  7294. @c the optional argument). Note that -bHEAD does not
  7295. @c work, as of 17 Sep 1997, but probably will once "cvs
  7296. @c admin" is internal to CVS.
  7297. @cindex Comment leader
  7298. @item -c@var{string}
  7299. Sets the comment leader to @var{string}. The comment
  7300. leader is not used by current versions of @sc{cvs} or
  7301. @sc{rcs} 5.7. Therefore, you can almost surely not
  7302. worry about it. See @ref{Keyword substitution}.
  7303. @item -e[@var{logins}]
  7304. Might not work together with @sc{cvs}. Erase the login
  7305. names appearing in the comma-separated list
  7306. @var{logins} from the access list of the RCS file. If
  7307. @var{logins} is omitted, erase the entire access list.
  7308. There can be no space between @samp{-e} and its argument.
  7309. @item -I
  7310. Run interactively, even if the standard input is not a
  7311. terminal. This option does not work with the
  7312. client/server @sc{cvs} and is likely to disappear in
  7313. a future release of @sc{cvs}.
  7314. @item -i
  7315. Useless with @sc{cvs}. This creates and initializes a
  7316. new @sc{rcs} file, without depositing a revision. With
  7317. @sc{cvs}, add files with the @code{cvs add} command
  7318. (@pxref{Adding files}).
  7319. @item -k@var{subst}
  7320. Set the default keyword
  7321. substitution to @var{subst}. See @ref{Keyword
  7322. substitution}. Giving an explicit @samp{-k} option to
  7323. @code{cvs update}, @code{cvs export}, or @code{cvs
  7324. checkout} overrides this default.
  7325. @item -l[@var{rev}]
  7326. Lock the revision with number @var{rev}. If a branch
  7327. is given, lock the latest revision on that branch. If
  7328. @var{rev} is omitted, lock the latest revision on the
  7329. default branch. There can be no space between
  7330. @samp{-l} and its argument.
  7331. This can be used in conjunction with the
  7332. @file{rcslock.pl} script in the @file{contrib}
  7333. directory of the @sc{cvs} source distribution to
  7334. provide reserved checkouts (where only one user can be
  7335. editing a given file at a time). See the comments in
  7336. that file for details (and see the @file{README} file
  7337. in that directory for disclaimers about the unsupported
  7338. nature of contrib). According to comments in that
  7339. file, locking must set to strict (which is the default).
  7340. @item -L
  7341. Set locking to strict. Strict locking means that the
  7342. owner of an RCS file is not exempt from locking for
  7343. checkin. For use with @sc{cvs}, strict locking must be
  7344. set; see the discussion under the @samp{-l} option above.
  7345. @cindex Changing a log message
  7346. @cindex Replacing a log message
  7347. @cindex Correcting a log message
  7348. @cindex Fixing a log message
  7349. @cindex Log message, correcting
  7350. @item -m@var{rev}:@var{msg}
  7351. Replace the log message of revision @var{rev} with
  7352. @var{msg}.
  7353. @c The rcs -M option, to suppress sending mail, has never been
  7354. @c documented as a cvs admin option.
  7355. @item -N@var{name}[:[@var{rev}]]
  7356. Act like @samp{-n}, except override any previous
  7357. assignment of @var{name}. For use with magic branches,
  7358. see @ref{Magic branch numbers}.
  7359. @item -n@var{name}[:[@var{rev}]]
  7360. Associate the symbolic name @var{name} with the branch
  7361. or revision @var{rev}. It is normally better to use
  7362. @samp{cvs tag} or @samp{cvs rtag} instead. Delete the
  7363. symbolic name if both @samp{:} and @var{rev} are
  7364. omitted; otherwise, print an error message if
  7365. @var{name} is already associated with another number.
  7366. If @var{rev} is symbolic, it is expanded before
  7367. association. A @var{rev} consisting of a branch number
  7368. followed by a @samp{.} stands for the current latest
  7369. revision in the branch. A @samp{:} with an empty
  7370. @var{rev} stands for the current latest revision on the
  7371. default branch, normally the trunk. For example,
  7372. @samp{cvs admin -n@var{name}:} associates @var{name} with the
  7373. current latest revision of all the RCS files;
  7374. this contrasts with @samp{cvs admin -n@var{name}:$} which
  7375. associates @var{name} with the revision numbers
  7376. extracted from keyword strings in the corresponding
  7377. working files.
  7378. @cindex Deleting revisions
  7379. @cindex Outdating revisions
  7380. @cindex Saving space
  7381. @item -o@var{range}
  7382. Deletes (@dfn{outdates}) the revisions given by
  7383. @var{range}.
  7384. Note that this command can be quite dangerous unless
  7385. you know @emph{exactly} what you are doing (for example
  7386. see the warnings below about how the
  7387. @var{rev1}:@var{rev2} syntax is confusing).
  7388. If you are short on disc this option might help you.
  7389. But think twice before using it---there is no way short
  7390. of restoring the latest backup to undo this command!
  7391. If you delete different revisions than you planned,
  7392. either due to carelessness or (heaven forbid) a @sc{cvs}
  7393. bug, there is no opportunity to correct the error
  7394. before the revisions are deleted. It probably would be
  7395. a good idea to experiment on a copy of the repository
  7396. first.
  7397. Specify @var{range} in one of the following ways:
  7398. @table @code
  7399. @item @var{rev1}::@var{rev2}
  7400. Collapse all revisions between rev1 and rev2, so that
  7401. @sc{cvs} only stores the differences associated with going
  7402. from rev1 to rev2, not intermediate steps. For
  7403. example, after @samp{-o 1.3::1.5} one can retrieve
  7404. revision 1.3, revision 1.5, or the differences to get
  7405. from 1.3 to 1.5, but not the revision 1.4, or the
  7406. differences between 1.3 and 1.4. Other examples:
  7407. @samp{-o 1.3::1.4} and @samp{-o 1.3::1.3} have no
  7408. effect, because there are no intermediate revisions to
  7409. remove.
  7410. @item ::@var{rev}
  7411. Collapse revisions between the beginning of the branch
  7412. containing @var{rev} and @var{rev} itself. The
  7413. branchpoint and @var{rev} are left intact. For
  7414. example, @samp{-o ::1.3.2.6} deletes revision 1.3.2.1,
  7415. revision 1.3.2.5, and everything in between, but leaves
  7416. 1.3 and 1.3.2.6 intact.
  7417. @item @var{rev}::
  7418. Collapse revisions between @var{rev} and the end of the
  7419. branch containing @var{rev}. Revision @var{rev} is
  7420. left intact but the head revision is deleted.
  7421. @item @var{rev}
  7422. Delete the revision @var{rev}. For example, @samp{-o
  7423. 1.3} is equivalent to @samp{-o 1.2::1.4}.
  7424. @item @var{rev1}:@var{rev2}
  7425. Delete the revisions from @var{rev1} to @var{rev2},
  7426. inclusive, on the same branch. One will not be able to
  7427. retrieve @var{rev1} or @var{rev2} or any of the
  7428. revisions in between. For example, the command
  7429. @samp{cvs admin -oR_1_01:R_1_02 .} is rarely useful.
  7430. It means to delete revisions up to, and including, the
  7431. tag R_1_02. But beware! If there are files that have not
  7432. changed between R_1_02 and R_1_03 the file will have
  7433. @emph{the same} numerical revision number assigned to
  7434. the tags R_1_02 and R_1_03. So not only will it be
  7435. impossible to retrieve R_1_02; R_1_03 will also have to
  7436. be restored from the tapes! In most cases you want to
  7437. specify @var{rev1}::@var{rev2} instead.
  7438. @item :@var{rev}
  7439. Delete revisions from the beginning of the
  7440. branch containing @var{rev} up to and including
  7441. @var{rev}.
  7442. @item @var{rev}:
  7443. Delete revisions from revision @var{rev}, including
  7444. @var{rev} itself, to the end of the branch containing
  7445. @var{rev}.
  7446. @end table
  7447. None of the revisions to be deleted may have
  7448. branches or locks.
  7449. If any of the revisions to be deleted have symbolic
  7450. names, and one specifies one of the @samp{::} syntaxes,
  7451. then @sc{cvs} will give an error and not delete any
  7452. revisions. If you really want to delete both the
  7453. symbolic names and the revisions, first delete the
  7454. symbolic names with @code{cvs tag -d}, then run
  7455. @code{cvs admin -o}. If one specifies the
  7456. non-@samp{::} syntaxes, then @sc{cvs} will delete the
  7457. revisions but leave the symbolic names pointing to
  7458. nonexistent revisions. This behavior is preserved for
  7459. compatibility with previous versions of @sc{cvs}, but
  7460. because it isn't very useful, in the future it may
  7461. change to be like the @samp{::} case.
  7462. Due to the way @sc{cvs} handles branches @var{rev}
  7463. cannot be specified symbolically if it is a branch.
  7464. See @ref{Magic branch numbers} for an explanation.
  7465. @c FIXME: is this still true? I suspect not.
  7466. Make sure that no-one has checked out a copy of the
  7467. revision you outdate. Strange things will happen if he
  7468. starts to edit it and tries to check it back in. For
  7469. this reason, this option is not a good way to take back
  7470. a bogus commit; commit a new revision undoing the bogus
  7471. change instead (@pxref{Merging two revisions}).
  7472. @item -q
  7473. Run quietly; do not print diagnostics.
  7474. @item -s@var{state}[:@var{rev}]
  7475. Useful with @sc{cvs}. Set the state attribute of the
  7476. revision @var{rev} to @var{state}. If @var{rev} is a
  7477. branch number, assume the latest revision on that
  7478. branch. If @var{rev} is omitted, assume the latest
  7479. revision on the default branch. Any identifier is
  7480. acceptable for @var{state}. A useful set of states is
  7481. @samp{Exp} (for experimental), @samp{Stab} (for
  7482. stable), and @samp{Rel} (for released). By default,
  7483. the state of a new revision is set to @samp{Exp} when
  7484. it is created. The state is visible in the output from
  7485. @var{cvs log} (@pxref{log}), and in the
  7486. @samp{$@splitrcskeyword{Log}$} and @samp{$@splitrcskeyword{State}$} keywords
  7487. (@pxref{Keyword substitution}). Note that @sc{cvs}
  7488. uses the @code{dead} state for its own purposes (@pxref{Attic}); to
  7489. take a file to or from the @code{dead} state use
  7490. commands like @code{cvs remove} and @code{cvs add}
  7491. (@pxref{Adding and removing}), not @code{cvs admin -s}.
  7492. @item -t[@var{file}]
  7493. Useful with @sc{cvs}. Write descriptive text from the
  7494. contents of the named @var{file} into the RCS file,
  7495. deleting the existing text. The @var{file} pathname
  7496. may not begin with @samp{-}. The descriptive text can be seen in the
  7497. output from @samp{cvs log} (@pxref{log}).
  7498. There can be no space between @samp{-t} and its argument.
  7499. If @var{file} is omitted,
  7500. obtain the text from standard input, terminated by
  7501. end-of-file or by a line containing @samp{.} by itself.
  7502. Prompt for the text if interaction is possible; see
  7503. @samp{-I}.
  7504. @item -t-@var{string}
  7505. Similar to @samp{-t@var{file}}. Write descriptive text
  7506. from the @var{string} into the @sc{rcs} file, deleting
  7507. the existing text.
  7508. There can be no space between @samp{-t} and its argument.
  7509. @c The rcs -T option, do not update last-mod time for
  7510. @c minor changes, has never been documented as a
  7511. @c cvs admin option.
  7512. @item -U
  7513. Set locking to non-strict. Non-strict locking means
  7514. that the owner of a file need not lock a revision for
  7515. checkin. For use with @sc{cvs}, strict locking must be
  7516. set; see the discussion under the @samp{-l} option
  7517. above.
  7518. @item -u[@var{rev}]
  7519. See the option @samp{-l} above, for a discussion of
  7520. using this option with @sc{cvs}. Unlock the revision
  7521. with number @var{rev}. If a branch is given, unlock
  7522. the latest revision on that branch. If @var{rev} is
  7523. omitted, remove the latest lock held by the caller.
  7524. Normally, only the locker of a revision may unlock it;
  7525. somebody else unlocking a revision breaks the lock.
  7526. This causes the original locker to be sent a @code{commit}
  7527. notification (@pxref{Getting Notified}).
  7528. There can be no space between @samp{-u} and its argument.
  7529. @item -V@var{n}
  7530. In previous versions of @sc{cvs}, this option meant to
  7531. write an @sc{rcs} file which would be acceptable to
  7532. @sc{rcs} version @var{n}, but it is now obsolete and
  7533. specifying it will produce an error.
  7534. @c Note that -V without an argument has never been
  7535. @c documented as a cvs admin option.
  7536. @item -x@var{suffixes}
  7537. In previous versions of @sc{cvs}, this was documented
  7538. as a way of specifying the names of the @sc{rcs}
  7539. files. However, @sc{cvs} has always required that the
  7540. @sc{rcs} files used by @sc{cvs} end in @samp{,v}, so
  7541. this option has never done anything useful.
  7542. @c The rcs -z option, to specify the timezone, has
  7543. @c never been documented as a cvs admin option.
  7544. @end table
  7545. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7546. @node annotate
  7547. @appendixsec annotate---What revision modified each line of a file?
  7548. @cindex annotate (subcommand)
  7549. @itemize @bullet
  7550. @item
  7551. Synopsis: annotate [options] files@dots{}
  7552. @item
  7553. Requires: repository.
  7554. @item
  7555. Synonym: blame
  7556. @item
  7557. Changes: nothing.
  7558. @end itemize
  7559. For each file in @var{files}, print the head revision
  7560. of the trunk, together with information on the last
  7561. modification for each line.
  7562. @menu
  7563. * annotate options:: annotate options
  7564. * annotate example:: annotate example
  7565. @end menu
  7566. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7567. @node annotate options
  7568. @appendixsubsec annotate options
  7569. These standard options are supported by @code{annotate}
  7570. (@pxref{Common options} for a complete description of
  7571. them):
  7572. @table @code
  7573. @item -l
  7574. Local directory only, no recursion.
  7575. @item -R
  7576. Process directories recursively.
  7577. @item -f
  7578. Use head revision if tag/date not found.
  7579. @item -F
  7580. Annotate binary files.
  7581. @item -r @var{revision}
  7582. Annotate file as of specified revision/tag.
  7583. @item -D @var{date}
  7584. Annotate file as of specified date.
  7585. @end table
  7586. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7587. @node annotate example
  7588. @appendixsubsec annotate example
  7589. For example:
  7590. @example
  7591. $ cvs annotate ssfile
  7592. Annotations for ssfile
  7593. ***************
  7594. 1.1 (mary 27-Mar-96): ssfile line 1
  7595. 1.2 (joe 28-Mar-96): ssfile line 2
  7596. @end example
  7597. The file @file{ssfile} currently contains two lines.
  7598. The @code{ssfile line 1} line was checked in by
  7599. @code{mary} on March 27. Then, on March 28, @code{joe}
  7600. added a line @code{ssfile line 2}, without modifying
  7601. the @code{ssfile line 1} line. This report doesn't
  7602. tell you anything about lines which have been deleted
  7603. or replaced; you need to use @code{cvs diff} for that
  7604. (@pxref{diff}).
  7605. The options to @code{cvs annotate} are listed in
  7606. @ref{Invoking CVS}, and can be used to select the files
  7607. and revisions to annotate. The options are described
  7608. in more detail there and in @ref{Common options}.
  7609. @c FIXME: maybe an example using the options? Just
  7610. @c what it means to select a revision might be worth a
  7611. @c few words of explanation ("you want to see who
  7612. @c changed this line *before* 1.4"...).
  7613. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7614. @node checkout
  7615. @appendixsec checkout---Check out sources for editing
  7616. @cindex checkout (subcommand)
  7617. @cindex co (subcommand)
  7618. @itemize @bullet
  7619. @item
  7620. Synopsis: checkout [options] modules@dots{}
  7621. @item
  7622. Requires: repository.
  7623. @item
  7624. Changes: working directory.
  7625. @item
  7626. Synonyms: co, get
  7627. @end itemize
  7628. Create or update a working directory containing copies of the
  7629. source files specified by @var{modules}. You must execute
  7630. @code{checkout} before using most of the other @sc{cvs}
  7631. commands, since most of them operate on your working
  7632. directory.
  7633. The @var{modules} are either
  7634. symbolic names for some
  7635. collection of source directories and files, or paths to
  7636. directories or files in the repository. The symbolic
  7637. names are defined in the @samp{modules} file.
  7638. See @ref{modules}.
  7639. @c Needs an example, particularly of the non-"modules"
  7640. @c case but probably of both.
  7641. @c FIXME: this seems like a very odd place to introduce
  7642. @c people to how CVS works. The bit about unreserved
  7643. @c checkouts is also misleading as it depends on how
  7644. @c things are set up.
  7645. Depending on the modules you specify, @code{checkout} may
  7646. recursively create directories and populate them with
  7647. the appropriate source files. You can then edit these
  7648. source files at any time (regardless of whether other
  7649. software developers are editing their own copies of the
  7650. sources); update them to include new changes applied by
  7651. others to the source repository; or commit your work as
  7652. a permanent change to the source repository.
  7653. Note that @code{checkout} is used to create
  7654. directories. The top-level directory created is always
  7655. added to the directory where @code{checkout} is
  7656. invoked, and usually has the same name as the specified
  7657. module. In the case of a module alias, the created
  7658. sub-directory may have a different name, but you can be
  7659. sure that it will be a sub-directory, and that
  7660. @code{checkout} will show the relative path leading to
  7661. each file as it is extracted into your private work
  7662. area (unless you specify the @samp{-Q} global option).
  7663. The files created by @code{checkout} are created
  7664. read-write, unless the @samp{-r} option to @sc{cvs}
  7665. (@pxref{Global options}) is specified, the
  7666. @code{CVSREAD} environment variable is specified
  7667. (@pxref{Environment variables}), or a watch is in
  7668. effect for that file (@pxref{Watches}).
  7669. Note that running @code{checkout} on a directory that was already
  7670. built by a prior @code{checkout} is also permitted.
  7671. This is similar to specifying the @samp{-d} option
  7672. to the @code{update} command in the sense that new
  7673. directories that have been created in the repository
  7674. will appear in your work area.
  7675. However, @code{checkout} takes a module name whereas
  7676. @code{update} takes a directory name. Also
  7677. to use @code{checkout} this way it must be run from the
  7678. top level directory (where you originally ran
  7679. @code{checkout} from), so before you run
  7680. @code{checkout} to update an existing directory, don't
  7681. forget to change your directory to the top level
  7682. directory.
  7683. For the output produced by the @code{checkout} command,
  7684. @xref{update output}.
  7685. @menu
  7686. * checkout options:: checkout options
  7687. * checkout examples:: checkout examples
  7688. @end menu
  7689. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7690. @node checkout options
  7691. @appendixsubsec checkout options
  7692. These standard options are supported by @code{checkout}
  7693. (@pxref{Common options} for a complete description of
  7694. them):
  7695. @table @code
  7696. @item -D @var{date}
  7697. Use the most recent revision no later than @var{date}.
  7698. This option is sticky, and implies @samp{-P}. See
  7699. @ref{Sticky tags} for more information on sticky tags/dates.
  7700. @item -f
  7701. Only useful with the @samp{-D @var{date}} or @samp{-r
  7702. @var{tag}} flags. If no matching revision is found,
  7703. retrieve the most recent revision (instead of ignoring
  7704. the file).
  7705. @item -k @var{kflag}
  7706. Process keywords according to @var{kflag}. See
  7707. @ref{Keyword substitution}.
  7708. This option is sticky; future updates of
  7709. this file in this working directory will use the same
  7710. @var{kflag}. The @code{status} command can be viewed
  7711. to see the sticky options. See @ref{Invoking CVS} for
  7712. more information on the @code{status} command.
  7713. @item -l
  7714. Local; run only in current working directory.
  7715. @item -n
  7716. Do not run any checkout program (as specified
  7717. with the @samp{-o} option in the modules file;
  7718. @pxref{modules}).
  7719. @item -P
  7720. Prune empty directories. See @ref{Moving directories}.
  7721. @item -p
  7722. Pipe files to the standard output.
  7723. @item -R
  7724. Checkout directories recursively. This option is on by default.
  7725. @item -r @var{tag}
  7726. Use revision @var{tag}. This option is sticky, and implies @samp{-P}.
  7727. See @ref{Sticky tags}, for more information on sticky tags/dates.
  7728. @end table
  7729. In addition to those, you can use these special command
  7730. options with @code{checkout}:
  7731. @table @code
  7732. @item -A
  7733. Reset any sticky tags, dates, or @samp{-k} options.
  7734. Does not reset sticky @samp{-k} options on modified files.
  7735. See @ref{Sticky tags} for more information on sticky tags/dates.
  7736. @item -c
  7737. Copy the module file, sorted, to the standard output,
  7738. instead of creating or modifying any files or
  7739. directories in your working directory.
  7740. @item -d @var{dir}
  7741. Create a directory called @var{dir} for the working
  7742. files, instead of using the module name. In general,
  7743. using this flag is equivalent to using @samp{mkdir
  7744. @var{dir}; cd @var{dir}} followed by the checkout
  7745. command without the @samp{-d} flag.
  7746. There is an important exception, however. It is very
  7747. convenient when checking out a single item to have the
  7748. output appear in a directory that doesn't contain empty
  7749. intermediate directories. In this case @emph{only},
  7750. @sc{cvs} tries to ``shorten'' pathnames to avoid those empty
  7751. directories.
  7752. For example, given a module @samp{foo} that contains
  7753. the file @samp{bar.c}, the command @samp{cvs co -d dir
  7754. foo} will create directory @samp{dir} and place
  7755. @samp{bar.c} inside. Similarly, given a module
  7756. @samp{bar} which has subdirectory @samp{baz} wherein
  7757. there is a file @samp{quux.c}, the command @samp{cvs co
  7758. -d dir bar/baz} will create directory @samp{dir} and
  7759. place @samp{quux.c} inside.
  7760. Using the @samp{-N} flag will defeat this behavior.
  7761. Given the same module definitions above, @samp{cvs co
  7762. -N -d dir foo} will create directories @samp{dir/foo}
  7763. and place @samp{bar.c} inside, while @samp{cvs co -N -d
  7764. dir bar/baz} will create directories @samp{dir/bar/baz}
  7765. and place @samp{quux.c} inside.
  7766. @item -j @var{tag}
  7767. With two @samp{-j} options, merge changes from the
  7768. revision specified with the first @samp{-j} option to
  7769. the revision specified with the second @samp{j} option,
  7770. into the working directory.
  7771. With one @samp{-j} option, merge changes from the
  7772. ancestor revision to the revision specified with the
  7773. @samp{-j} option, into the working directory. The
  7774. ancestor revision is the common ancestor of the
  7775. revision which the working directory is based on, and
  7776. the revision specified in the @samp{-j} option.
  7777. In addition, each -j option can contain an optional
  7778. date specification which, when used with branches, can
  7779. limit the chosen revision to one within a specific
  7780. date. An optional date is specified by adding a colon
  7781. (:) to the tag:
  7782. @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
  7783. See @ref{Branching and merging}.
  7784. @item -N
  7785. Only useful together with @samp{-d @var{dir}}. With
  7786. this option, @sc{cvs} will not ``shorten'' module paths
  7787. in your working directory when you check out a single
  7788. module. See the @samp{-d} flag for examples and a
  7789. discussion.
  7790. @item -s
  7791. Like @samp{-c}, but include the status of all modules,
  7792. and sort it by the status string. See @ref{modules}, for
  7793. info about the @samp{-s} option that is used inside the
  7794. modules file to set the module status.
  7795. @end table
  7796. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7797. @node checkout examples
  7798. @appendixsubsec checkout examples
  7799. Get a copy of the module @samp{tc}:
  7800. @example
  7801. $ cvs checkout tc
  7802. @end example
  7803. Get a copy of the module @samp{tc} as it looked one day
  7804. ago:
  7805. @example
  7806. $ cvs checkout -D yesterday tc
  7807. @end example
  7808. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7809. @node commit
  7810. @appendixsec commit---Check files into the repository
  7811. @cindex commit (subcommand)
  7812. @itemize @bullet
  7813. @item
  7814. Synopsis: commit [-lRf] [-m 'log_message' |
  7815. -F file] [-r revision] [files@dots{}]
  7816. @item
  7817. Requires: working directory, repository.
  7818. @item
  7819. Changes: repository.
  7820. @item
  7821. Synonym: ci
  7822. @end itemize
  7823. Use @code{commit} when you want to incorporate changes
  7824. from your working source files into the source
  7825. repository.
  7826. If you don't specify particular files to commit, all of
  7827. the files in your working current directory are
  7828. examined. @code{commit} is careful to change in the
  7829. repository only those files that you have really
  7830. changed. By default (or if you explicitly specify the
  7831. @samp{-R} option), files in subdirectories are also
  7832. examined and committed if they have changed; you can
  7833. use the @samp{-l} option to limit @code{commit} to the
  7834. current directory only.
  7835. @code{commit} verifies that the selected files are up
  7836. to date with the current revisions in the source
  7837. repository; it will notify you, and exit without
  7838. committing, if any of the specified files must be made
  7839. current first with @code{update} (@pxref{update}).
  7840. @code{commit} does not call the @code{update} command
  7841. for you, but rather leaves that for you to do when the
  7842. time is right.
  7843. When all is well, an editor is invoked to allow you to
  7844. enter a log message that will be written to one or more
  7845. logging programs (@pxref{modules}, and @pxref{loginfo})
  7846. and placed in the @sc{rcs} file inside the
  7847. repository. This log message can be retrieved with the
  7848. @code{log} command; @xref{log}. You can specify the
  7849. log message on the command line with the @samp{-m
  7850. @var{message}} option, and thus avoid the editor invocation,
  7851. or use the @samp{-F @var{file}} option to specify
  7852. that the argument file contains the log message.
  7853. @menu
  7854. * commit options:: commit options
  7855. * commit examples:: commit examples
  7856. @end menu
  7857. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7858. @node commit options
  7859. @appendixsubsec commit options
  7860. These standard options are supported by @code{commit}
  7861. (@pxref{Common options} for a complete description of
  7862. them):
  7863. @table @code
  7864. @item -l
  7865. Local; run only in current working directory.
  7866. @item -R
  7867. Commit directories recursively. This is on by default.
  7868. @item -r @var{revision}
  7869. Commit to @var{revision}. @var{revision} must be
  7870. either a branch, or a revision on the main trunk that
  7871. is higher than any existing revision number
  7872. (@pxref{Assigning revisions}). You
  7873. cannot commit to a specific revision on a branch.
  7874. @c FIXME: Need xref for branch case.
  7875. @end table
  7876. @code{commit} also supports these options:
  7877. @table @code
  7878. @item -F @var{file}
  7879. Read the log message from @var{file}, instead
  7880. of invoking an editor.
  7881. @item -f
  7882. Note that this is not the standard behavior of
  7883. the @samp{-f} option as defined in @ref{Common options}.
  7884. Force @sc{cvs} to commit a new revision even if you haven't
  7885. made any changes to the file. If the current revision
  7886. of @var{file} is 1.7, then the following two commands
  7887. are equivalent:
  7888. @example
  7889. $ cvs commit -f @var{file}
  7890. $ cvs commit -r 1.8 @var{file}
  7891. @end example
  7892. @c This is odd, but it's how CVS has worked for some
  7893. @c time.
  7894. The @samp{-f} option disables recursion (i.e., it
  7895. implies @samp{-l}). To force @sc{cvs} to commit a new
  7896. revision for all files in all subdirectories, you must
  7897. use @samp{-f -R}.
  7898. @item -m @var{message}
  7899. Use @var{message} as the log message, instead of
  7900. invoking an editor.
  7901. @end table
  7902. @need 2000
  7903. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7904. @node commit examples
  7905. @appendixsubsec commit examples
  7906. @c FIXME: this material wants to be somewhere
  7907. @c in "Branching and merging".
  7908. @appendixsubsubsec Committing to a branch
  7909. You can commit to a branch revision (one that has an
  7910. even number of dots) with the @samp{-r} option. To
  7911. create a branch revision, use the @samp{-b} option
  7912. of the @code{rtag} or @code{tag} commands
  7913. (@pxref{Branching and merging}). Then, either @code{checkout} or
  7914. @code{update} can be used to base your sources on the
  7915. newly created branch. From that point on, all
  7916. @code{commit} changes made within these working sources
  7917. will be automatically added to a branch revision,
  7918. thereby not disturbing main-line development in any
  7919. way. For example, if you had to create a patch to the
  7920. 1.2 version of the product, even though the 2.0 version
  7921. is already under development, you might do:
  7922. @example
  7923. $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
  7924. $ cvs checkout -r FCS1_2_Patch product_module
  7925. $ cd product_module
  7926. [[ hack away ]]
  7927. $ cvs commit
  7928. @end example
  7929. @noindent
  7930. This works automatically since the @samp{-r} option is
  7931. sticky.
  7932. @appendixsubsubsec Creating the branch after editing
  7933. Say you have been working on some extremely
  7934. experimental software, based on whatever revision you
  7935. happened to checkout last week. If others in your
  7936. group would like to work on this software with you, but
  7937. without disturbing main-line development, you could
  7938. commit your change to a new branch. Others can then
  7939. checkout your experimental stuff and utilize the full
  7940. benefit of @sc{cvs} conflict resolution. The scenario might
  7941. look like:
  7942. @c FIXME: Should we be recommending tagging the branchpoint?
  7943. @example
  7944. [[ hacked sources are present ]]
  7945. $ cvs tag -b EXPR1
  7946. $ cvs update -r EXPR1
  7947. $ cvs commit
  7948. @end example
  7949. The @code{update} command will make the @samp{-r
  7950. EXPR1} option sticky on all files. Note that your
  7951. changes to the files will never be removed by the
  7952. @code{update} command. The @code{commit} will
  7953. automatically commit to the correct branch, because the
  7954. @samp{-r} is sticky. You could also do like this:
  7955. @c FIXME: Should we be recommending tagging the branchpoint?
  7956. @example
  7957. [[ hacked sources are present ]]
  7958. $ cvs tag -b EXPR1
  7959. $ cvs commit -r EXPR1
  7960. @end example
  7961. @noindent
  7962. but then, only those files that were changed by you
  7963. will have the @samp{-r EXPR1} sticky flag. If you hack
  7964. away, and commit without specifying the @samp{-r EXPR1}
  7965. flag, some files may accidentally end up on the main
  7966. trunk.
  7967. To work with you on the experimental change, others
  7968. would simply do
  7969. @example
  7970. $ cvs checkout -r EXPR1 whatever_module
  7971. @end example
  7972. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7973. @node diff
  7974. @appendixsec diff---Show differences between revisions
  7975. @cindex diff (subcommand)
  7976. @itemize @bullet
  7977. @item
  7978. Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files@dots{}]
  7979. @item
  7980. Requires: working directory, repository.
  7981. @item
  7982. Changes: nothing.
  7983. @end itemize
  7984. The @code{diff} command is used to compare different
  7985. revisions of files. The default action is to compare
  7986. your working files with the revisions they were based
  7987. on, and report any differences that are found.
  7988. If any file names are given, only those files are
  7989. compared. If any directories are given, all files
  7990. under them will be compared.
  7991. The exit status for diff is different than for other
  7992. @sc{cvs} commands; for details @xref{Exit status}.
  7993. @menu
  7994. * diff options:: diff options
  7995. * diff examples:: diff examples
  7996. @end menu
  7997. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  7998. @node diff options
  7999. @appendixsubsec diff options
  8000. These standard options are supported by @code{diff}
  8001. (@pxref{Common options} for a complete description of
  8002. them):
  8003. @table @code
  8004. @item -D @var{date}
  8005. Use the most recent revision no later than @var{date}.
  8006. See @samp{-r} for how this affects the comparison.
  8007. @item -k @var{kflag}
  8008. Process keywords according to @var{kflag}. See
  8009. @ref{Keyword substitution}.
  8010. @item -l
  8011. Local; run only in current working directory.
  8012. @item -R
  8013. Examine directories recursively. This option is on by
  8014. default.
  8015. @item -r @var{tag}
  8016. Compare with revision @var{tag}. Zero, one or two
  8017. @samp{-r} options can be present. With no @samp{-r}
  8018. option, the working file will be compared with the
  8019. revision it was based on. With one @samp{-r}, that
  8020. revision will be compared to your current working file.
  8021. With two @samp{-r} options those two revisions will be
  8022. compared (and your working file will not affect the
  8023. outcome in any way).
  8024. @c We should be a lot more explicit, with examples,
  8025. @c about the difference between "cvs diff" and "cvs
  8026. @c diff -r HEAD". This often confuses new users.
  8027. One or both @samp{-r} options can be replaced by a
  8028. @samp{-D @var{date}} option, described above.
  8029. @end table
  8030. @c Conceptually, this is a disaster. There are 3
  8031. @c zillion diff formats that we support via the diff
  8032. @c library. It is not obvious to me that we should
  8033. @c document them all. Maybe just the most common ones
  8034. @c like -c and -u, and think about phasing out the
  8035. @c obscure ones.
  8036. @c FIXCVS: also should be a way to specify an external
  8037. @c diff program (which can be different for different
  8038. @c file types) and pass through
  8039. @c arbitrary options, so that the user can do
  8040. @c "--pass=-Z --pass=foo" or something even if CVS
  8041. @c doesn't know about the "-Z foo" option to diff.
  8042. @c This would fit nicely with deprecating/eliminating
  8043. @c the obscure options of the diff library, because it
  8044. @c would let people specify an external GNU diff if
  8045. @c they are into that sort of thing.
  8046. The following options specify the format of the
  8047. output. They have the same meaning as in GNU diff.
  8048. Most options have two equivalent names, one of which is a single letter
  8049. preceded by @samp{-}, and the other of which is a long name preceded by
  8050. @samp{--}.
  8051. @table @samp
  8052. @item -@var{lines}
  8053. Show @var{lines} (an integer) lines of context. This option does not
  8054. specify an output format by itself; it has no effect unless it is
  8055. combined with @samp{-c} or @samp{-u}. This option is obsolete. For proper
  8056. operation, @code{patch} typically needs at least two lines of context.
  8057. @item -a
  8058. Treat all files as text and compare them line-by-line, even if they
  8059. do not seem to be text.
  8060. @item -b
  8061. Ignore trailing white space and consider all other sequences of one or
  8062. more white space characters to be equivalent.
  8063. @item -B
  8064. Ignore changes that just insert or delete blank lines.
  8065. @item --binary
  8066. Read and write data in binary mode.
  8067. @item --brief
  8068. Report only whether the files differ, not the details of the
  8069. differences.
  8070. @item -c
  8071. Use the context output format.
  8072. @item -C @var{lines}
  8073. @itemx --context@r{[}=@var{lines}@r{]}
  8074. Use the context output format, showing @var{lines} (an integer) lines of
  8075. context, or three if @var{lines} is not given.
  8076. For proper operation, @code{patch} typically needs at least two lines of
  8077. context.
  8078. @item --changed-group-format=@var{format}
  8079. Use @var{format} to output a line group containing differing lines from
  8080. both files in if-then-else format. See @ref{Line group formats}.
  8081. @item -d
  8082. Change the algorithm to perhaps find a smaller set of changes. This makes
  8083. @code{diff} slower (sometimes much slower).
  8084. @item -e
  8085. @itemx --ed
  8086. Make output that is a valid @code{ed} script.
  8087. @item --expand-tabs
  8088. Expand tabs to spaces in the output, to preserve the alignment of tabs
  8089. in the input files.
  8090. @item -f
  8091. Make output that looks vaguely like an @code{ed} script but has changes
  8092. in the order they appear in the file.
  8093. @item -F @var{regexp}
  8094. In context and unified format, for each hunk of differences, show some
  8095. of the last preceding line that matches @var{regexp}.
  8096. @item --forward-ed
  8097. Make output that looks vaguely like an @code{ed} script but has changes
  8098. in the order they appear in the file.
  8099. @item -H
  8100. Use heuristics to speed handling of large files that have numerous
  8101. scattered small changes.
  8102. @item --horizon-lines=@var{lines}
  8103. Do not discard the last @var{lines} lines of the common prefix
  8104. and the first @var{lines} lines of the common suffix.
  8105. @item -i
  8106. Ignore changes in case; consider upper- and lower-case letters
  8107. equivalent.
  8108. @item -I @var{regexp}
  8109. Ignore changes that just insert or delete lines that match @var{regexp}.
  8110. @item --ifdef=@var{name}
  8111. Make merged if-then-else output using @var{name}.
  8112. @item --ignore-all-space
  8113. Ignore white space when comparing lines.
  8114. @item --ignore-blank-lines
  8115. Ignore changes that just insert or delete blank lines.
  8116. @item --ignore-case
  8117. Ignore changes in case; consider upper- and lower-case to be the same.
  8118. @item --ignore-matching-lines=@var{regexp}
  8119. Ignore changes that just insert or delete lines that match @var{regexp}.
  8120. @item --ignore-space-change
  8121. Ignore trailing white space and consider all other sequences of one or
  8122. more white space characters to be equivalent.
  8123. @item --initial-tab
  8124. Output a tab rather than a space before the text of a line in normal or
  8125. context format. This causes the alignment of tabs in the line to look
  8126. normal.
  8127. @item -L @var{label}
  8128. Use @var{label} instead of the file name in the context format
  8129. and unified format headers.
  8130. @item --label=@var{label}
  8131. Use @var{label} instead of the file name in the context format
  8132. and unified format headers.
  8133. @item --left-column
  8134. Print only the left column of two common lines in side by side format.
  8135. @item --line-format=@var{format}
  8136. Use @var{format} to output all input lines in if-then-else format.
  8137. See @ref{Line formats}.
  8138. @item --minimal
  8139. Change the algorithm to perhaps find a smaller set of changes. This
  8140. makes @code{diff} slower (sometimes much slower).
  8141. @item -n
  8142. Output RCS-format diffs; like @samp{-f} except that each command
  8143. specifies the number of lines affected.
  8144. @item -N
  8145. @itemx --new-file
  8146. In directory comparison, if a file is found in only one directory,
  8147. treat it as present but empty in the other directory.
  8148. @item --new-group-format=@var{format}
  8149. Use @var{format} to output a group of lines taken from just the second
  8150. file in if-then-else format. See @ref{Line group formats}.
  8151. @item --new-line-format=@var{format}
  8152. Use @var{format} to output a line taken from just the second file in
  8153. if-then-else format. See @ref{Line formats}.
  8154. @item --old-group-format=@var{format}
  8155. Use @var{format} to output a group of lines taken from just the first
  8156. file in if-then-else format. See @ref{Line group formats}.
  8157. @item --old-line-format=@var{format}
  8158. Use @var{format} to output a line taken from just the first file in
  8159. if-then-else format. See @ref{Line formats}.
  8160. @item -p
  8161. Show which C function each change is in.
  8162. @item --rcs
  8163. Output RCS-format diffs; like @samp{-f} except that each command
  8164. specifies the number of lines affected.
  8165. @item --report-identical-files
  8166. @itemx -s
  8167. Report when two files are the same.
  8168. @item --show-c-function
  8169. Show which C function each change is in.
  8170. @item --show-function-line=@var{regexp}
  8171. In context and unified format, for each hunk of differences, show some
  8172. of the last preceding line that matches @var{regexp}.
  8173. @item --side-by-side
  8174. Use the side by side output format.
  8175. @item --speed-large-files
  8176. Use heuristics to speed handling of large files that have numerous
  8177. scattered small changes.
  8178. @item --suppress-common-lines
  8179. Do not print common lines in side by side format.
  8180. @item -t
  8181. Expand tabs to spaces in the output, to preserve the alignment of tabs
  8182. in the input files.
  8183. @item -T
  8184. Output a tab rather than a space before the text of a line in normal or
  8185. context format. This causes the alignment of tabs in the line to look
  8186. normal.
  8187. @item --text
  8188. Treat all files as text and compare them line-by-line, even if they
  8189. do not appear to be text.
  8190. @item -u
  8191. Use the unified output format.
  8192. @item --unchanged-group-format=@var{format}
  8193. Use @var{format} to output a group of common lines taken from both files
  8194. in if-then-else format. @xref{Line group formats}.
  8195. @item --unchanged-line-format=@var{format}
  8196. Use @var{format} to output a line common to both files in if-then-else
  8197. format. @xref{Line formats}.
  8198. @item -U @var{lines}
  8199. @itemx --unified@r{[}=@var{lines}@r{]}
  8200. Use the unified output format, showing @var{lines} (an integer) lines of
  8201. context, or three if @var{lines} is not given.
  8202. For proper operation, @code{patch} typically needs at least two lines of
  8203. context.
  8204. @item -w
  8205. Ignore white space when comparing lines.
  8206. @item -W @var{columns}
  8207. @itemx --width=@var{columns}
  8208. Use an output width of @var{columns} in side by side format.
  8209. @item -y
  8210. Use the side by side output format.
  8211. @end table
  8212. @menu
  8213. * Line group formats:: Line group formats
  8214. * Line formats:: Line formats
  8215. @end menu
  8216. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8217. @node Line group formats
  8218. @appendixsubsubsec Line group formats
  8219. Line group formats let you specify formats suitable for many
  8220. applications that allow if-then-else input, including programming
  8221. languages and text formatting languages. A line group format specifies
  8222. the output format for a contiguous group of similar lines.
  8223. For example, the following command compares the TeX file @file{myfile}
  8224. with the original version from the repository,
  8225. and outputs a merged file in which old regions are
  8226. surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
  8227. regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
  8228. @example
  8229. cvs diff \
  8230. --old-group-format='\begin@{em@}
  8231. %<\end@{em@}
  8232. ' \
  8233. --new-group-format='\begin@{bf@}
  8234. %>\end@{bf@}
  8235. ' \
  8236. myfile
  8237. @end example
  8238. The following command is equivalent to the above example, but it is a
  8239. little more verbose, because it spells out the default line group formats.
  8240. @example
  8241. cvs diff \
  8242. --old-group-format='\begin@{em@}
  8243. %<\end@{em@}
  8244. ' \
  8245. --new-group-format='\begin@{bf@}
  8246. %>\end@{bf@}
  8247. ' \
  8248. --unchanged-group-format='%=' \
  8249. --changed-group-format='\begin@{em@}
  8250. %<\end@{em@}
  8251. \begin@{bf@}
  8252. %>\end@{bf@}
  8253. ' \
  8254. myfile
  8255. @end example
  8256. Here is a more advanced example, which outputs a diff listing with
  8257. headers containing line numbers in a ``plain English'' style.
  8258. @example
  8259. cvs diff \
  8260. --unchanged-group-format='' \
  8261. --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
  8262. %<' \
  8263. --new-group-format='-------- %dN line%(N=1?:s) added after %de:
  8264. %>' \
  8265. --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
  8266. %<-------- to:
  8267. %>' \
  8268. myfile
  8269. @end example
  8270. To specify a line group format, use one of the options
  8271. listed below. You can specify up to four line group formats, one for
  8272. each kind of line group. You should quote @var{format}, because it
  8273. typically contains shell metacharacters.
  8274. @table @samp
  8275. @item --old-group-format=@var{format}
  8276. These line groups are hunks containing only lines from the first file.
  8277. The default old group format is the same as the changed group format if
  8278. it is specified; otherwise it is a format that outputs the line group as-is.
  8279. @item --new-group-format=@var{format}
  8280. These line groups are hunks containing only lines from the second
  8281. file. The default new group format is same as the changed group
  8282. format if it is specified; otherwise it is a format that outputs the
  8283. line group as-is.
  8284. @item --changed-group-format=@var{format}
  8285. These line groups are hunks containing lines from both files. The
  8286. default changed group format is the concatenation of the old and new
  8287. group formats.
  8288. @item --unchanged-group-format=@var{format}
  8289. These line groups contain lines common to both files. The default
  8290. unchanged group format is a format that outputs the line group as-is.
  8291. @end table
  8292. In a line group format, ordinary characters represent themselves;
  8293. conversion specifications start with @samp{%} and have one of the
  8294. following forms.
  8295. @table @samp
  8296. @item %<
  8297. stands for the lines from the first file, including the trailing newline.
  8298. Each line is formatted according to the old line format (@pxref{Line formats}).
  8299. @item %>
  8300. stands for the lines from the second file, including the trailing newline.
  8301. Each line is formatted according to the new line format.
  8302. @item %=
  8303. stands for the lines common to both files, including the trailing newline.
  8304. Each line is formatted according to the unchanged line format.
  8305. @item %%
  8306. stands for @samp{%}.
  8307. @item %c'@var{C}'
  8308. where @var{C} is a single character, stands for @var{C}.
  8309. @var{C} may not be a backslash or an apostrophe.
  8310. For example, @samp{%c':'} stands for a colon, even inside
  8311. the then-part of an if-then-else format, which a colon would
  8312. normally terminate.
  8313. @item %c'\@var{O}'
  8314. where @var{O} is a string of 1, 2, or 3 octal digits,
  8315. stands for the character with octal code @var{O}.
  8316. For example, @samp{%c'\0'} stands for a null character.
  8317. @item @var{F}@var{n}
  8318. where @var{F} is a @code{printf} conversion specification and @var{n} is one
  8319. of the following letters, stands for @var{n}'s value formatted with @var{F}.
  8320. @table @samp
  8321. @item e
  8322. The line number of the line just before the group in the old file.
  8323. @item f
  8324. The line number of the first line in the group in the old file;
  8325. equals @var{e} + 1.
  8326. @item l
  8327. The line number of the last line in the group in the old file.
  8328. @item m
  8329. The line number of the line just after the group in the old file;
  8330. equals @var{l} + 1.
  8331. @item n
  8332. The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
  8333. @item E, F, L, M, N
  8334. Likewise, for lines in the new file.
  8335. @end table
  8336. The @code{printf} conversion specification can be @samp{%d},
  8337. @samp{%o}, @samp{%x}, or @samp{%X}, specifying decimal, octal,
  8338. lower case hexadecimal, or upper case hexadecimal output
  8339. respectively. After the @samp{%} the following options can appear in
  8340. sequence: a @samp{-} specifying left-justification; an integer
  8341. specifying the minimum field width; and a period followed by an
  8342. optional integer specifying the minimum number of digits.
  8343. For example, @samp{%5dN} prints the number of new lines in the group
  8344. in a field of width 5 characters, using the @code{printf} format @code{"%5d"}.
  8345. @item (@var{A}=@var{B}?@var{T}:@var{E})
  8346. If @var{A} equals @var{B} then @var{T} else @var{E}.
  8347. @var{A} and @var{B} are each either a decimal constant
  8348. or a single letter interpreted as above.
  8349. This format spec is equivalent to @var{T} if
  8350. @var{A}'s value equals @var{B}'s; otherwise it is equivalent to @var{E}.
  8351. For example, @samp{%(N=0?no:%dN) line%(N=1?:s)} is equivalent to
  8352. @samp{no lines} if @var{N} (the number of lines in the group in the
  8353. new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
  8354. otherwise.
  8355. @end table
  8356. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8357. @node Line formats
  8358. @appendixsubsubsec Line formats
  8359. Line formats control how each line taken from an input file is
  8360. output as part of a line group in if-then-else format.
  8361. For example, the following command outputs text with a one-column
  8362. change indicator to the left of the text. The first column of output
  8363. is @samp{-} for deleted lines, @samp{|} for added lines, and a space
  8364. for unchanged lines. The formats contain newline characters where
  8365. newlines are desired on output.
  8366. @example
  8367. cvs diff \
  8368. --old-line-format='-%l
  8369. ' \
  8370. --new-line-format='|%l
  8371. ' \
  8372. --unchanged-line-format=' %l
  8373. ' \
  8374. myfile
  8375. @end example
  8376. To specify a line format, use one of the following options. You should
  8377. quote @var{format}, since it often contains shell metacharacters.
  8378. @table @samp
  8379. @item --old-line-format=@var{format}
  8380. formats lines just from the first file.
  8381. @item --new-line-format=@var{format}
  8382. formats lines just from the second file.
  8383. @item --unchanged-line-format=@var{format}
  8384. formats lines common to both files.
  8385. @item --line-format=@var{format}
  8386. formats all lines; in effect, it sets all three above options simultaneously.
  8387. @end table
  8388. In a line format, ordinary characters represent themselves;
  8389. conversion specifications start with @samp{%} and have one of the
  8390. following forms.
  8391. @table @samp
  8392. @item %l
  8393. stands for the contents of the line, not counting its trailing
  8394. newline (if any). This format ignores whether the line is incomplete.
  8395. @item %L
  8396. stands for the contents of the line, including its trailing newline
  8397. (if any). If a line is incomplete, this format preserves its
  8398. incompleteness.
  8399. @item %%
  8400. stands for @samp{%}.
  8401. @item %c'@var{C}'
  8402. where @var{C} is a single character, stands for @var{C}.
  8403. @var{C} may not be a backslash or an apostrophe.
  8404. For example, @samp{%c':'} stands for a colon.
  8405. @item %c'\@var{O}'
  8406. where @var{O} is a string of 1, 2, or 3 octal digits,
  8407. stands for the character with octal code @var{O}.
  8408. For example, @samp{%c'\0'} stands for a null character.
  8409. @item @var{F}n
  8410. where @var{F} is a @code{printf} conversion specification,
  8411. stands for the line number formatted with @var{F}.
  8412. For example, @samp{%.5dn} prints the line number using the
  8413. @code{printf} format @code{"%.5d"}. @xref{Line group formats}, for
  8414. more about printf conversion specifications.
  8415. @end table
  8416. The default line format is @samp{%l} followed by a newline character.
  8417. If the input contains tab characters and it is important that they line
  8418. up on output, you should ensure that @samp{%l} or @samp{%L} in a line
  8419. format is just after a tab stop (e.g.@: by preceding @samp{%l} or
  8420. @samp{%L} with a tab character), or you should use the @samp{-t} or
  8421. @samp{--expand-tabs} option.
  8422. Taken together, the line and line group formats let you specify many
  8423. different formats. For example, the following command uses a format
  8424. similar to @code{diff}'s normal format. You can tailor this command
  8425. to get fine control over @code{diff}'s output.
  8426. @example
  8427. cvs diff \
  8428. --old-line-format='< %l
  8429. ' \
  8430. --new-line-format='> %l
  8431. ' \
  8432. --old-group-format='%df%(f=l?:,%dl)d%dE
  8433. %<' \
  8434. --new-group-format='%dea%dF%(F=L?:,%dL)
  8435. %>' \
  8436. --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
  8437. %<---
  8438. %>' \
  8439. --unchanged-group-format='' \
  8440. myfile
  8441. @end example
  8442. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8443. @node diff examples
  8444. @appendixsubsec diff examples
  8445. The following line produces a Unidiff (@samp{-u} flag)
  8446. between revision 1.14 and 1.19 of
  8447. @file{backend.c}. Due to the @samp{-kk} flag no
  8448. keywords are substituted, so differences that only depend
  8449. on keyword substitution are ignored.
  8450. @example
  8451. $ cvs diff -kk -u -r 1.14 -r 1.19 backend.c
  8452. @end example
  8453. Suppose the experimental branch EXPR1 was based on a
  8454. set of files tagged RELEASE_1_0. To see what has
  8455. happened on that branch, the following can be used:
  8456. @example
  8457. $ cvs diff -r RELEASE_1_0 -r EXPR1
  8458. @end example
  8459. A command like this can be used to produce a context
  8460. diff between two releases:
  8461. @example
  8462. $ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs
  8463. @end example
  8464. If you are maintaining ChangeLogs, a command like the following
  8465. just before you commit your changes may help you write
  8466. the ChangeLog entry. All local modifications that have
  8467. not yet been committed will be printed.
  8468. @example
  8469. $ cvs diff -u | less
  8470. @end example
  8471. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8472. @node export
  8473. @appendixsec export---Export sources from CVS, similar to checkout
  8474. @cindex export (subcommand)
  8475. @itemize @bullet
  8476. @item
  8477. Synopsis: export [-flNnR] [-r rev|-D date] [-k subst] [-d dir] module@dots{}
  8478. @item
  8479. Requires: repository.
  8480. @item
  8481. Changes: current directory.
  8482. @end itemize
  8483. This command is a variant of @code{checkout}; use it
  8484. when you want a copy of the source for module without
  8485. the @sc{cvs} administrative directories. For example, you
  8486. might use @code{export} to prepare source for shipment
  8487. off-site. This command requires that you specify a
  8488. date or tag (with @samp{-D} or @samp{-r}), so that you
  8489. can count on reproducing the source you ship to others
  8490. (and thus it always prunes empty directories).
  8491. One often would like to use @samp{-kv} with @code{cvs
  8492. export}. This causes any keywords to be
  8493. expanded such that an import done at some other site
  8494. will not lose the keyword revision information. But be
  8495. aware that doesn't handle an export containing binary
  8496. files correctly. Also be aware that after having used
  8497. @samp{-kv}, one can no longer use the @code{ident}
  8498. command (which is part of the @sc{rcs} suite---see
  8499. ident(1)) which looks for keyword strings. If
  8500. you want to be able to use @code{ident} you must not
  8501. use @samp{-kv}.
  8502. @menu
  8503. * export options:: export options
  8504. @end menu
  8505. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8506. @node export options
  8507. @appendixsubsec export options
  8508. These standard options are supported by @code{export}
  8509. (@pxref{Common options}, for a complete description of
  8510. them):
  8511. @table @code
  8512. @item -D @var{date}
  8513. Use the most recent revision no later than @var{date}.
  8514. @item -f
  8515. If no matching revision is found, retrieve the most
  8516. recent revision (instead of ignoring the file).
  8517. @item -l
  8518. Local; run only in current working directory.
  8519. @item -n
  8520. Do not run any checkout program.
  8521. @item -R
  8522. Export directories recursively. This is on by default.
  8523. @item -r @var{tag}
  8524. Use revision @var{tag}.
  8525. @end table
  8526. In addition, these options (that are common to
  8527. @code{checkout} and @code{export}) are also supported:
  8528. @table @code
  8529. @item -d @var{dir}
  8530. Create a directory called @var{dir} for the working
  8531. files, instead of using the module name.
  8532. See @ref{checkout options} for complete details on how
  8533. @sc{cvs} handles this flag.
  8534. @item -k @var{subst}
  8535. Set keyword expansion mode (@pxref{Substitution modes}).
  8536. @item -N
  8537. Only useful together with @samp{-d @var{dir}}.
  8538. See @ref{checkout options} for complete details on how
  8539. @sc{cvs} handles this flag.
  8540. @end table
  8541. @ignore
  8542. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8543. @c @node export examples
  8544. @appendixsubsec export examples
  8545. Contributed examples are gratefully accepted.
  8546. @c -- Examples here!!
  8547. @end ignore
  8548. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8549. @node history
  8550. @appendixsec history---Show status of files and users
  8551. @cindex history (subcommand)
  8552. @itemize @bullet
  8553. @item
  8554. Synopsis: history [-report] [-flags] [-options args] [files@dots{}]
  8555. @item
  8556. Requires: the file @file{$CVSROOT/CVSROOT/history}
  8557. @item
  8558. Changes: nothing.
  8559. @end itemize
  8560. @sc{cvs} can keep a history file that tracks each use of the
  8561. @code{checkout}, @code{commit}, @code{rtag},
  8562. @code{update}, and @code{release} commands. You can
  8563. use @code{history} to display this information in
  8564. various formats.
  8565. Logging must be enabled by creating the file
  8566. @file{$CVSROOT/CVSROOT/history}.
  8567. @strong{@code{history} uses @samp{-f}, @samp{-l},
  8568. @samp{-n}, and @samp{-p} in ways that conflict with the
  8569. normal use inside @sc{cvs} (@pxref{Common options}).}
  8570. @menu
  8571. * history options:: history options
  8572. @end menu
  8573. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8574. @node history options
  8575. @appendixsubsec history options
  8576. Several options (shown above as @samp{-report}) control what
  8577. kind of report is generated:
  8578. @table @code
  8579. @item -c
  8580. Report on each time commit was used (i.e., each time
  8581. the repository was modified).
  8582. @item -e
  8583. Everything (all record types). Equivalent to
  8584. specifying @samp{-x} with all record types. Of course,
  8585. @samp{-e} will also include record types which are
  8586. added in a future version of @sc{cvs}; if you are
  8587. writing a script which can only handle certain record
  8588. types, you'll want to specify @samp{-x}.
  8589. @item -m @var{module}
  8590. Report on a particular module. (You can meaningfully
  8591. use @samp{-m} more than once on the command line.)
  8592. @item -o
  8593. Report on checked-out modules. This is the default report type.
  8594. @item -T
  8595. Report on all tags.
  8596. @item -x @var{type}
  8597. Extract a particular set of record types @var{type} from the @sc{cvs}
  8598. history. The types are indicated by single letters,
  8599. which you may specify in combination.
  8600. Certain commands have a single record type:
  8601. @table @code
  8602. @item F
  8603. release
  8604. @item O
  8605. checkout
  8606. @item E
  8607. export
  8608. @item T
  8609. rtag
  8610. @end table
  8611. @noindent
  8612. One of five record types may result from an update:
  8613. @table @code
  8614. @item C
  8615. A merge was necessary but collisions were
  8616. detected (requiring manual merging).
  8617. @item G
  8618. A merge was necessary and it succeeded.
  8619. @item U
  8620. A working file was copied from the repository.
  8621. @item P
  8622. A working file was patched to match the repository.
  8623. @item W
  8624. The working copy of a file was deleted during
  8625. update (because it was gone from the repository).
  8626. @end table
  8627. @noindent
  8628. One of three record types results from commit:
  8629. @table @code
  8630. @item A
  8631. A file was added for the first time.
  8632. @item M
  8633. A file was modified.
  8634. @item R
  8635. A file was removed.
  8636. @end table
  8637. @end table
  8638. The options shown as @samp{-flags} constrain or expand
  8639. the report without requiring option arguments:
  8640. @table @code
  8641. @item -a
  8642. Show data for all users (the default is to show data
  8643. only for the user executing @code{history}).
  8644. @item -l
  8645. Show last modification only.
  8646. @item -w
  8647. Show only the records for modifications done from the
  8648. same working directory where @code{history} is
  8649. executing.
  8650. @end table
  8651. The options shown as @samp{-options @var{args}} constrain the report
  8652. based on an argument:
  8653. @table @code
  8654. @item -b @var{str}
  8655. Show data back to a record containing the string
  8656. @var{str} in either the module name, the file name, or
  8657. the repository path.
  8658. @item -D @var{date}
  8659. Show data since @var{date}. This is slightly different
  8660. from the normal use of @samp{-D @var{date}}, which
  8661. selects the newest revision older than @var{date}.
  8662. @item -f @var{file}
  8663. Show data for a particular file
  8664. (you can specify several @samp{-f} options on the same command line).
  8665. This is equivalent to specifying the file on the command line.
  8666. @item -n @var{module}
  8667. Show data for a particular module
  8668. (you can specify several @samp{-n} options on the same command line).
  8669. @item -p @var{repository}
  8670. Show data for a particular source repository (you
  8671. can specify several @samp{-p} options on the same command
  8672. line).
  8673. @item -r @var{rev}
  8674. Show records referring to revisions since the revision
  8675. or tag named @var{rev} appears in individual @sc{rcs}
  8676. files. Each @sc{rcs} file is searched for the revision or
  8677. tag.
  8678. @item -t @var{tag}
  8679. Show records since tag @var{tag} was last added to the
  8680. history file. This differs from the @samp{-r} flag
  8681. above in that it reads only the history file, not the
  8682. @sc{rcs} files, and is much faster.
  8683. @item -u @var{name}
  8684. Show records for user @var{name}.
  8685. @item -z @var{timezone}
  8686. Show times in the selected records using the specified
  8687. time zone instead of UTC.
  8688. @end table
  8689. @ignore
  8690. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8691. @c @node history examples
  8692. @appendixsubsec history examples
  8693. Contributed examples will gratefully be accepted.
  8694. @c -- Examples here!
  8695. @end ignore
  8696. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8697. @node import
  8698. @appendixsec import---Import sources into CVS, using vendor branches
  8699. @cindex import (subcommand)
  8700. @c FIXME: This node is way too long for one which has subnodes.
  8701. @itemize @bullet
  8702. @item
  8703. Synopsis: import [-options] repository vendortag releasetag@dots{}
  8704. @item
  8705. Requires: Repository, source distribution directory.
  8706. @item
  8707. Changes: repository.
  8708. @end itemize
  8709. Use @code{import} to incorporate an entire source
  8710. distribution from an outside source (e.g., a source
  8711. vendor) into your source repository directory. You can
  8712. use this command both for initial creation of a
  8713. repository, and for wholesale updates to the module
  8714. from the outside source. See @ref{Tracking sources} for
  8715. a discussion on this subject.
  8716. The @var{repository} argument gives a directory name
  8717. (or a path to a directory) under the @sc{cvs} root directory
  8718. for repositories; if the directory did not exist,
  8719. import creates it.
  8720. When you use import for updates to source that has been
  8721. modified in your source repository (since a prior
  8722. import), it will notify you of any files that conflict
  8723. in the two branches of development; use @samp{checkout
  8724. -j} to reconcile the differences, as import instructs
  8725. you to do.
  8726. If @sc{cvs} decides a file should be ignored
  8727. (@pxref{cvsignore}), it does not import it and prints
  8728. @samp{I } followed by the filename (@pxref{import output} for a
  8729. complete description of the output).
  8730. If the file @file{$CVSROOT/CVSROOT/cvswrappers} exists,
  8731. any file whose names match the specifications in that
  8732. file will be treated as packages and the appropriate
  8733. filtering will be performed on the file/directory
  8734. before being imported. See @ref{Wrappers}.
  8735. The outside source is saved in a first-level
  8736. branch, by default 1.1.1. Updates are leaves of this
  8737. branch; for example, files from the first imported
  8738. collection of source will be revision 1.1.1.1, then
  8739. files from the first imported update will be revision
  8740. 1.1.1.2, and so on.
  8741. At least three arguments are required.
  8742. @var{repository} is needed to identify the collection
  8743. of source. @var{vendortag} is a tag for the entire
  8744. branch (e.g., for 1.1.1). You must also specify at
  8745. least one @var{releasetag} to uniquely identify the files at
  8746. the leaves created each time you execute @code{import}. The
  8747. @var{releasetag} should be new, not previously existing in the
  8748. repository file, and uniquely identify the imported release,
  8749. @c I'm not completely sure this belongs here. But
  8750. @c we need to say it _somewhere_ reasonably obvious; it
  8751. @c is a common misconception among people first learning CVS
  8752. Note that @code{import} does @emph{not} change the
  8753. directory in which you invoke it. In particular, it
  8754. does not set up that directory as a @sc{cvs} working
  8755. directory; if you want to work with the sources import
  8756. them first and then check them out into a different
  8757. directory (@pxref{Getting the source}).
  8758. @menu
  8759. * import options:: import options
  8760. * import output:: import output
  8761. * import examples:: import examples
  8762. @end menu
  8763. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8764. @node import options
  8765. @appendixsubsec import options
  8766. This standard option is supported by @code{import}
  8767. (@pxref{Common options} for a complete description):
  8768. @table @code
  8769. @item -m @var{message}
  8770. Use @var{message} as log information, instead of
  8771. invoking an editor.
  8772. @end table
  8773. There are the following additional special options.
  8774. @table @code
  8775. @item -b @var{branch}
  8776. See @ref{Multiple vendor branches}.
  8777. @item -k @var{subst}
  8778. Indicate the keyword expansion mode desired. This
  8779. setting will apply to all files created during the
  8780. import, but not to any files that previously existed in
  8781. the repository. See @ref{Substitution modes} for a
  8782. list of valid @samp{-k} settings.
  8783. @item -I @var{name}
  8784. Specify file names that should be ignored during
  8785. import. You can use this option repeatedly. To avoid
  8786. ignoring any files at all (even those ignored by
  8787. default), specify `-I !'.
  8788. @var{name} can be a file name pattern of the same type
  8789. that you can specify in the @file{.cvsignore} file.
  8790. See @ref{cvsignore}.
  8791. @c -- Is this really true?
  8792. @item -W @var{spec}
  8793. Specify file names that should be filtered during
  8794. import. You can use this option repeatedly.
  8795. @var{spec} can be a file name pattern of the same type
  8796. that you can specify in the @file{.cvswrappers}
  8797. file. @xref{Wrappers}.
  8798. @end table
  8799. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8800. @node import output
  8801. @appendixsubsec import output
  8802. @code{import} keeps you informed of its progress by printing a line
  8803. for each file, preceded by one character indicating the status of the file:
  8804. @table @code
  8805. @item U @var{file}
  8806. The file already exists in the repository and has not been locally
  8807. modified; a new revision has been created (if necessary).
  8808. @item N @var{file}
  8809. The file is a new file which has been added to the repository.
  8810. @item C @var{file}
  8811. The file already exists in the repository but has been locally modified;
  8812. you will have to merge the changes.
  8813. @item I @var{file}
  8814. The file is being ignored (@pxref{cvsignore}).
  8815. @cindex Symbolic link, importing
  8816. @cindex Link, symbolic, importing
  8817. @c FIXME: also (somewhere else) probably
  8818. @c should be documenting what happens if you "cvs add"
  8819. @c a symbolic link. Also maybe what happens if
  8820. @c you manually create symbolic links within the
  8821. @c repository (? - not sure why we'd want to suggest
  8822. @c doing that).
  8823. @item L @var{file}
  8824. The file is a symbolic link; @code{cvs import} ignores symbolic links.
  8825. People periodically suggest that this behavior should
  8826. be changed, but if there is a consensus on what it
  8827. should be changed to, it doesn't seem to be apparent.
  8828. (Various options in the @file{modules} file can be used
  8829. to recreate symbolic links on checkout, update, etc.;
  8830. @pxref{modules}.)
  8831. @end table
  8832. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8833. @node import examples
  8834. @appendixsubsec import examples
  8835. See @ref{Tracking sources}, and @ref{From files}.
  8836. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  8837. @node log
  8838. @appendixsec log---Print out log information for files
  8839. @cindex log (subcommand)
  8840. @itemize @bullet
  8841. @item
  8842. Synopsis: log [options] [files@dots{}]
  8843. @item
  8844. Requires: repository, working directory.
  8845. @item
  8846. Changes: nothing.
  8847. @end itemize
  8848. Display log information for files. @code{log} used to
  8849. call the @sc{rcs} utility @code{rlog}. Although this
  8850. is no longer true in the current sources, this history
  8851. determines the format of the output and the options,
  8852. which are not quite in the style of the other @sc{cvs}
  8853. commands.
  8854. @cindex Timezone, in output
  8855. @cindex Zone, time, in output
  8856. @c Kind of a funny place to document the timezone used
  8857. @c in output from commands other than @code{log}.
  8858. @c There is also more we need to say about this,
  8859. @c including what happens in a client/server environment.
  8860. The output includes the location of the @sc{rcs} file,
  8861. the @dfn{head} revision (the latest revision on the
  8862. trunk), all symbolic names (tags) and some other
  8863. things. For each revision, the revision number, the
  8864. author, the number of lines added/deleted and the log
  8865. message are printed. All times are displayed in
  8866. Coordinated Universal Time (UTC). (Other parts of
  8867. @sc{cvs} print times in the local timezone).
  8868. @c FIXCVS: need a better way to control the timezone
  8869. @c used in output. Previous/current versions of CVS did/do
  8870. @c sometimes support -z in RCSINIT, and/or an
  8871. @c undocumented (except by reference to 'rlog') -z option
  8872. @c to cvs log, but this has not been a consistent,
  8873. @c documented feature. Perhaps a new global option,
  8874. @c where LT means the client's timezone, which the
  8875. @c client then communicates to the server, is the
  8876. @c right solution.
  8877. @strong{@code{log} uses @samp{-R} in a way that conflicts
  8878. with the normal use inside @sc{cvs} (@pxref{Common options}).}
  8879. @menu
  8880. * log options:: log options
  8881. * log examples:: log examples
  8882. @end menu
  8883. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  8884. @node log options
  8885. @appendixsubsec log options
  8886. By default, @code{log} prints all information that is
  8887. available. All other options restrict the output. Note that the revision
  8888. selection options (@code{-b}, @code{-d}, @code{-r}, @code{-s}, and @code{-w})
  8889. have no
  8890. effect, other than possibly causing a search for files in Attic directories,
  8891. when used in conjunction with the options that restrict the output to only
  8892. @code{log} header fields (@code{-h}, @code{-R}, and @code{-t})
  8893. unless the @code{-S} option is also specified.
  8894. @table @code
  8895. @item -b
  8896. Print information about the revisions on the default
  8897. branch, normally the highest branch on the trunk.
  8898. @item -d @var{dates}
  8899. Print information about revisions with a checkin
  8900. date/time in the range given by the
  8901. semicolon-separated list of dates. The date formats
  8902. accepted are those accepted by the @samp{-D} option to
  8903. many other @sc{cvs} commands (@pxref{Common options}).
  8904. Dates can be combined into ranges as follows:
  8905. @c Should we be thinking about accepting ISO8601
  8906. @c ranges? For example "1972-09-10/1972-09-12".
  8907. @table @code
  8908. @item @var{d1}<@var{d2}
  8909. @itemx @var{d2}>@var{d1}
  8910. Select the revisions that were deposited between
  8911. @var{d1} and @var{d2}.
  8912. @item <@var{d}
  8913. @itemx @var{d}>
  8914. Select all revisions dated @var{d} or earlier.
  8915. @item @var{d}<
  8916. @itemx >@var{d}
  8917. Select all revisions dated @var{d} or later.
  8918. @item @var{d}
  8919. Select the single, latest revision dated @var{d} or
  8920. earlier.
  8921. @end table
  8922. The @samp{>} or @samp{<} characters may be followed by
  8923. @samp{=} to indicate an inclusive range rather than an
  8924. exclusive one.
  8925. Note that the separator is a semicolon (;).
  8926. @item -h
  8927. Print only the name of the @sc{rcs} file, name
  8928. of the file in the working directory, head,
  8929. default branch, access list, locks, symbolic names, and
  8930. suffix.
  8931. @item -l
  8932. Local; run only in current working directory. (Default
  8933. is to run recursively).
  8934. @item -N
  8935. Do not print the list of tags for this file. This
  8936. option can be very useful when your site uses a lot of
  8937. tags, so rather than "more"'ing over 3 pages of tag
  8938. information, the log information is presented without
  8939. tags at all.
  8940. @item -n
  8941. Print the list of tags for this file. This option can
  8942. be very useful when your @file{.cvsrc} file has a
  8943. @samp{log -N} entry as a way to get a full list of all
  8944. of the tags.
  8945. @item -R
  8946. Print only the name of the @sc{rcs} file.
  8947. @c Note that using a bare revision (in addition to not
  8948. @c being explicitly documented here) is potentially
  8949. @c confusing; it shows the log message to get from the
  8950. @c previous revision to that revision. "-r1.3 -r1.6"
  8951. @c (equivalent to "-r1.3,1.6") is even worse; it
  8952. @c prints the messages to get from 1.2 to 1.3 and 1.5
  8953. @c to 1.6. By analogy with "cvs diff", users might
  8954. @c expect that it is more like specifying a range.
  8955. @c It is not 100% clear to me how much of this should
  8956. @c be documented (for example, multiple -r options
  8957. @c perhaps could/should be deprecated given the false
  8958. @c analogy with "cvs diff").
  8959. @c In general, this section should be rewritten to talk
  8960. @c about messages to get from revision rev1 to rev2,
  8961. @c rather than messages for revision rev2 (that is, the
  8962. @c messages are associated with a change not a static
  8963. @c revision and failing to make this distinction causes
  8964. @c much confusion).
  8965. @item -r@var{revisions}
  8966. Print information about revisions given in the
  8967. comma-separated list @var{revisions} of revisions and
  8968. ranges. The following table explains the available
  8969. range formats:
  8970. @table @code
  8971. @item @var{rev1}:@var{rev2}
  8972. Revisions @var{rev1} to @var{rev2} (which must be on
  8973. the same branch).
  8974. @item @var{rev1}::@var{rev2}
  8975. The same, but excluding @var{rev1}.
  8976. @item :@var{rev}
  8977. @itemx ::@var{rev}
  8978. Revisions from the beginning of the branch up to
  8979. and including @var{rev}.
  8980. @item @var{rev}:
  8981. Revisions starting with @var{rev} to the end of the
  8982. branch containing @var{rev}.
  8983. @item @var{rev}::
  8984. Revisions starting just after @var{rev} to the end of the
  8985. branch containing @var{rev}.
  8986. @item @var{branch}
  8987. An argument that is a branch means all revisions on
  8988. that branch.
  8989. @item @var{branch1}:@var{branch2}
  8990. @itemx @var{branch1}::@var{branch2}
  8991. A range of branches means all revisions
  8992. on the branches in that range.
  8993. @item @var{branch}.
  8994. The latest revision in @var{branch}.
  8995. @end table
  8996. A bare @samp{-r} with no revisions means the latest
  8997. revision on the default branch, normally the trunk.
  8998. There can be no space between the @samp{-r} option and
  8999. its argument.
  9000. @item -S
  9001. Suppress the header if no revisions are selected.
  9002. @item -s @var{states}
  9003. Print information about revisions whose state
  9004. attributes match one of the states given in the
  9005. comma-separated list @var{states}. Individual states may
  9006. be any text string, though @sc{cvs} commonly only uses two
  9007. states, @samp{Exp} and @samp{dead}. See @ref{admin options}
  9008. for more information.
  9009. @item -t
  9010. Print the same as @samp{-h}, plus the descriptive text.
  9011. @item -w@var{logins}
  9012. Print information about revisions checked in by users
  9013. with login names appearing in the comma-separated list
  9014. @var{logins}. If @var{logins} is omitted, the user's
  9015. login is assumed. There can be no space between the
  9016. @samp{-w} option and its argument.
  9017. @end table
  9018. @code{log} prints the intersection of the revisions
  9019. selected with the options @samp{-d}, @samp{-s}, and
  9020. @samp{-w}, intersected with the union of the revisions
  9021. selected by @samp{-b} and @samp{-r}.
  9022. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9023. @node log examples
  9024. @appendixsubsec log examples
  9025. Contributed examples are gratefully accepted.
  9026. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9027. @node rdiff
  9028. @appendixsec rdiff---'patch' format diffs between releases
  9029. @cindex rdiff (subcommand)
  9030. @itemize @bullet
  9031. @item
  9032. rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules@dots{}
  9033. @item
  9034. Requires: repository.
  9035. @item
  9036. Changes: nothing.
  9037. @item
  9038. Synonym: patch
  9039. @end itemize
  9040. Builds a Larry Wall format patch(1) file between two
  9041. releases, that can be fed directly into the @code{patch}
  9042. program to bring an old release up-to-date with the new
  9043. release. (This is one of the few @sc{cvs} commands that
  9044. operates directly from the repository, and doesn't
  9045. require a prior checkout.) The diff output is sent to
  9046. the standard output device.
  9047. You can specify (using the standard @samp{-r} and
  9048. @samp{-D} options) any combination of one or two
  9049. revisions or dates. If only one revision or date is
  9050. specified, the patch file reflects differences between
  9051. that revision or date and the current head revisions in
  9052. the @sc{rcs} file.
  9053. Note that if the software release affected is contained
  9054. in more than one directory, then it may be necessary to
  9055. specify the @samp{-p} option to the @code{patch} command when
  9056. patching the old sources, so that @code{patch} is able to find
  9057. the files that are located in other directories.
  9058. @menu
  9059. * rdiff options:: rdiff options
  9060. * rdiff examples:: rdiff examples
  9061. @end menu
  9062. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9063. @node rdiff options
  9064. @appendixsubsec rdiff options
  9065. These standard options are supported by @code{rdiff}
  9066. (@pxref{Common options} for a complete description of
  9067. them):
  9068. @table @code
  9069. @item -D @var{date}
  9070. Use the most recent revision no later than @var{date}.
  9071. @item -f
  9072. If no matching revision is found, retrieve the most
  9073. recent revision (instead of ignoring the file).
  9074. @item -k @var{kflag}
  9075. Process keywords according to @var{kflag}. See
  9076. @ref{Keyword substitution}.
  9077. @item -l
  9078. Local; don't descend subdirectories.
  9079. @item -R
  9080. Examine directories recursively. This option is on by default.
  9081. @item -r @var{tag}
  9082. Use revision @var{tag}.
  9083. @end table
  9084. In addition to the above, these options are available:
  9085. @table @code
  9086. @item -c
  9087. Use the context diff format. This is the default format.
  9088. @item -s
  9089. Create a summary change report instead of a patch. The
  9090. summary includes information about files that were
  9091. changed or added between the releases. It is sent to
  9092. the standard output device. This is useful for finding
  9093. out, for example, which files have changed between two
  9094. dates or revisions.
  9095. @item -t
  9096. A diff of the top two revisions is sent to the standard
  9097. output device. This is most useful for seeing what the
  9098. last change to a file was.
  9099. @item -u
  9100. Use the unidiff format for the context diffs.
  9101. Remember that old versions
  9102. of the @code{patch} program can't handle the unidiff
  9103. format, so if you plan to post this patch to the net
  9104. you should probably not use @samp{-u}.
  9105. @item -V @var{vn}
  9106. Expand keywords according to the rules current in
  9107. @sc{rcs} version @var{vn} (the expansion format changed with
  9108. @sc{rcs} version 5). Note that this option is no
  9109. longer accepted. @sc{cvs} will always expand keywords the
  9110. way that @sc{rcs} version 5 does.
  9111. @end table
  9112. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9113. @node rdiff examples
  9114. @appendixsubsec rdiff examples
  9115. Suppose you receive mail from @t{foo@@example.net} asking for an
  9116. update from release 1.2 to 1.4 of the tc compiler. You
  9117. have no such patches on hand, but with @sc{cvs} that can
  9118. easily be fixed with a command such as this:
  9119. @example
  9120. $ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
  9121. > Mail -s 'The patches you asked for' foo@@example.net
  9122. @end example
  9123. Suppose you have made release 1.3, and forked a branch
  9124. called @samp{R_1_3fix} for bug fixes. @samp{R_1_3_1}
  9125. corresponds to release 1.3.1, which was made some time
  9126. ago. Now, you want to see how much development has been
  9127. done on the branch. This command can be used:
  9128. @example
  9129. $ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
  9130. cvs rdiff: Diffing module-name
  9131. File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
  9132. File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
  9133. File bar.h,v changed from revision 1.29.2.1 to 1.2
  9134. @end example
  9135. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9136. @node release
  9137. @appendixsec release---Indicate that a Module is no longer in use
  9138. @cindex release (subcommand)
  9139. @itemize @bullet
  9140. @item
  9141. release [-d] directories@dots{}
  9142. @item
  9143. Requires: Working directory.
  9144. @item
  9145. Changes: Working directory, history log.
  9146. @end itemize
  9147. This command is meant to safely cancel the effect of
  9148. @samp{cvs checkout}. Since @sc{cvs} doesn't lock files, it
  9149. isn't strictly necessary to use this command. You can
  9150. always simply delete your working directory, if you
  9151. like; but you risk losing changes you may have
  9152. forgotten, and you leave no trace in the @sc{cvs} history
  9153. file (@pxref{history file}) that you've abandoned your
  9154. checkout.
  9155. Use @samp{cvs release} to avoid these problems. This
  9156. command checks that no uncommitted changes are
  9157. present; that you are executing it from immediately
  9158. above a @sc{cvs} working directory; and that the repository
  9159. recorded for your files is the same as the repository
  9160. defined in the module database.
  9161. If all these conditions are true, @samp{cvs release}
  9162. leaves a record of its execution (attesting to your
  9163. intentionally abandoning your checkout) in the @sc{cvs}
  9164. history log.
  9165. @menu
  9166. * release options:: release options
  9167. * release output:: release output
  9168. * release examples:: release examples
  9169. @end menu
  9170. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9171. @node release options
  9172. @appendixsubsec release options
  9173. The @code{release} command supports one command option:
  9174. @table @code
  9175. @item -d
  9176. Delete your working copy of the file if the release
  9177. succeeds. If this flag is not given your files will
  9178. remain in your working directory.
  9179. @strong{WARNING: The @code{release} command deletes
  9180. all directories and files recursively. This
  9181. has the very serious side-effect that any directory
  9182. created inside checked-out sources, and not added to
  9183. the repository (using the @code{add} command;
  9184. @pxref{Adding files}) will be silently deleted---even
  9185. if it is non-empty!}
  9186. @end table
  9187. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9188. @node release output
  9189. @appendixsubsec release output
  9190. Before @code{release} releases your sources it will
  9191. print a one-line message for any file that is not
  9192. up-to-date.
  9193. @table @code
  9194. @item U @var{file}
  9195. @itemx P @var{file}
  9196. There exists a newer revision of this file in the
  9197. repository, and you have not modified your local copy
  9198. of the file (@samp{U} and @samp{P} mean the same thing).
  9199. @item A @var{file}
  9200. The file has been added to your private copy of the
  9201. sources, but has not yet been committed to the
  9202. repository. If you delete your copy of the sources
  9203. this file will be lost.
  9204. @item R @var{file}
  9205. The file has been removed from your private copy of the
  9206. sources, but has not yet been removed from the
  9207. repository, since you have not yet committed the
  9208. removal. See @ref{commit}.
  9209. @item M @var{file}
  9210. The file is modified in your working directory. There
  9211. might also be a newer revision inside the repository.
  9212. @item ? @var{file}
  9213. @var{file} is in your working directory, but does not
  9214. correspond to anything in the source repository, and is
  9215. not in the list of files for @sc{cvs} to ignore (see the
  9216. description of the @samp{-I} option, and
  9217. @pxref{cvsignore}). If you remove your working
  9218. sources, this file will be lost.
  9219. @end table
  9220. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9221. @node release examples
  9222. @appendixsubsec release examples
  9223. Release the @file{tc} directory, and delete your local working copy
  9224. of the files.
  9225. @example
  9226. $ cd .. # @r{You must stand immediately above the}
  9227. # @r{sources when you issue @samp{cvs release}.}
  9228. $ cvs release -d tc
  9229. You have [0] altered files in this repository.
  9230. Are you sure you want to release (and delete) directory `tc': y
  9231. $
  9232. @end example
  9233. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9234. @node remove
  9235. @appendixsec remove---Remove files from active use
  9236. @cindex remove (subcommand)
  9237. @itemize @bullet
  9238. @item
  9239. Synopsis: remove [-flR] [files...]
  9240. @item
  9241. Requires: repository, working directory.
  9242. @item
  9243. Changes: working directory.
  9244. @end itemize
  9245. The @code{remove} command is used to remove unwanted
  9246. files from active use. The user normally deletes the
  9247. files from the working directory prior to invocation
  9248. of the @code{remove} command. Only the working
  9249. directory is updated. Changes to the repository are
  9250. not made until the @code{commit} command is run.
  9251. The @code{remove} command does not delete files from
  9252. from the repository. @sc{cvs} keeps all historical
  9253. data in the repository so that it is possible to
  9254. reconstruct previous states of the projects under
  9255. revision control.
  9256. To undo @sc{cvs} @code{remove} or to resurrect files
  9257. that were previously removed, @xref{add}.
  9258. @menu
  9259. * remove options:: remove options
  9260. * remove examples:: remove examples
  9261. @end menu
  9262. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9263. @node remove options
  9264. @appendixsubsec remove options
  9265. These standard options are supported by @code{remove}
  9266. (@pxref{Common options} for a complete description of
  9267. them):
  9268. @table @code
  9269. @item -l
  9270. Local; run only in current working directory. See @ref{Recursive behavior}.
  9271. @item -R
  9272. Process directories recursively. See @ref{Recursive behavior}.
  9273. @end table
  9274. In addition, these options are also supported:
  9275. @table @code
  9276. @item -f
  9277. Note that this is not the standard behavior of
  9278. the @samp{-f} option as defined in @ref{Common options}.
  9279. Delete files before removing them.
  9280. Entire directory hierarchies are easily removed
  9281. using @samp{-f}, but take note that it is not as
  9282. easy to resurrect directory hierarchies as it is
  9283. to remove them.
  9284. @end table
  9285. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9286. @node remove examples
  9287. @appendixsubsec remove examples
  9288. @appendixsubsubsec Removing a file
  9289. @example
  9290. $ cvs remove remove.me
  9291. cvs remove: file `remove.me' still in working directory
  9292. cvs remove: 1 file exists; remove it first
  9293. $ rm -f remove.me
  9294. $ cvs remove remove.me
  9295. cvs remove: scheduling `remove.me' for removal
  9296. cvs remove: use 'cvs commit' to remove this file permanently
  9297. $ ls remove.it
  9298. remove.it
  9299. $ cvs remove -f remove.it
  9300. cvs remove: scheduling `remove.it' for removal
  9301. cvs remove: use 'cvs commit' to remove this file permanently
  9302. @end example
  9303. @appendixsubsubsec Removing entire directories
  9304. @example
  9305. $ tree -d a
  9306. a
  9307. |-- CVS
  9308. `-- b
  9309. `-- CVS
  9310. 3 directories
  9311. $ cvs remove -f a
  9312. cvs remove: Removing a
  9313. cvs remove: Removing a/b
  9314. cvs remove: scheduling `a/b/c' for removal
  9315. cvs remove: use 'cvs commit' to remove this file permanently
  9316. @end example
  9317. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9318. @node update
  9319. @appendixsec update---Bring work tree in sync with repository
  9320. @cindex update (subcommand)
  9321. @itemize @bullet
  9322. @item
  9323. update [-ACdflPpR] [-I name] [-j rev [-j rev]] [-k kflag] [-r tag|-D date] [-W spec] files@dots{}
  9324. @item
  9325. Requires: repository, working directory.
  9326. @item
  9327. Changes: working directory.
  9328. @end itemize
  9329. After you've run checkout to create your private copy
  9330. of source from the common repository, other developers
  9331. will continue changing the central source. From time
  9332. to time, when it is convenient in your development
  9333. process, you can use the @code{update} command from
  9334. within your working directory to reconcile your work
  9335. with any revisions applied to the source repository
  9336. since your last checkout or update.
  9337. @menu
  9338. * update options:: update options
  9339. * update output:: update output
  9340. @end menu
  9341. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9342. @node update options
  9343. @appendixsubsec update options
  9344. These standard options are available with @code{update}
  9345. (@pxref{Common options} for a complete description of
  9346. them):
  9347. @table @code
  9348. @item -D date
  9349. Use the most recent revision no later than @var{date}.
  9350. This option is sticky, and implies @samp{-P}.
  9351. See @ref{Sticky tags} for more information on sticky tags/dates.
  9352. @item -f
  9353. Only useful with the @samp{-D @var{date}} or @samp{-r
  9354. @var{tag}} flags. If no matching revision is found,
  9355. retrieve the most recent revision (instead of ignoring
  9356. the file).
  9357. @item -k @var{kflag}
  9358. Process keywords according to @var{kflag}. See
  9359. @ref{Keyword substitution}.
  9360. This option is sticky; future updates of
  9361. this file in this working directory will use the same
  9362. @var{kflag}. The @code{status} command can be viewed
  9363. to see the sticky options. See @ref{Invoking CVS} for
  9364. more information on the @code{status} command.
  9365. @item -l
  9366. Local; run only in current working directory. See @ref{Recursive behavior}.
  9367. @item -P
  9368. Prune empty directories. See @ref{Moving directories}.
  9369. @item -p
  9370. Pipe files to the standard output.
  9371. @item -R
  9372. Update directories recursively (default). See @ref{Recursive
  9373. behavior}.
  9374. @item -r rev
  9375. Retrieve revision/tag @var{rev}. This option is sticky,
  9376. and implies @samp{-P}.
  9377. See @ref{Sticky tags}, for more information on sticky tags/dates.
  9378. @end table
  9379. @need 800
  9380. These special options are also available with
  9381. @code{update}.
  9382. @table @code
  9383. @item -A
  9384. Reset any sticky tags, dates, or @samp{-k} options.
  9385. Does not reset sticky @samp{-k} options on modified files.
  9386. See @ref{Sticky tags} for more information on sticky tags/dates.
  9387. @item -C
  9388. Overwrite locally modified files with clean copies from
  9389. the repository (the modified file is saved in
  9390. @file{.#@var{file}.@var{revision}}, however).
  9391. @item -d
  9392. Create any directories that exist in the repository if
  9393. they're missing from the working directory. Normally,
  9394. @code{update} acts only on directories and files that
  9395. were already enrolled in your working directory.
  9396. This is useful for updating directories that were
  9397. created in the repository since the initial checkout;
  9398. but it has an unfortunate side effect. If you
  9399. deliberately avoided certain directories in the
  9400. repository when you created your working directory
  9401. (either through use of a module name or by listing
  9402. explicitly the files and directories you wanted on the
  9403. command line), then updating with @samp{-d} will create
  9404. those directories, which may not be what you want.
  9405. @item -I @var{name}
  9406. Ignore files whose names match @var{name} (in your
  9407. working directory) during the update. You can specify
  9408. @samp{-I} more than once on the command line to specify
  9409. several files to ignore. Use @samp{-I !} to avoid
  9410. ignoring any files at all. See @ref{cvsignore} for other
  9411. ways to make @sc{cvs} ignore some files.
  9412. @item -W@var{spec}
  9413. Specify file names that should be filtered during
  9414. update. You can use this option repeatedly.
  9415. @var{spec} can be a file name pattern of the same type
  9416. that you can specify in the @file{.cvswrappers}
  9417. file. See @ref{Wrappers}.
  9418. @item -j@var{revision}
  9419. With two @samp{-j} options, merge changes from the
  9420. revision specified with the first @samp{-j} option to
  9421. the revision specified with the second @samp{j} option,
  9422. into the working directory.
  9423. With one @samp{-j} option, merge changes from the
  9424. ancestor revision to the revision specified with the
  9425. @samp{-j} option, into the working directory. The
  9426. ancestor revision is the common ancestor of the
  9427. revision which the working directory is based on, and
  9428. the revision specified in the @samp{-j} option.
  9429. Note that using a single @samp{-j @var{tagname}} option rather than
  9430. @samp{-j @var{branchname}} to merge changes from a branch will
  9431. often not remove files which were removed on the branch.
  9432. See @ref{Merging adds and removals} for more information.
  9433. In addition, each @samp{-j} option can contain an optional
  9434. date specification which, when used with branches, can
  9435. limit the chosen revision to one within a specific
  9436. date. An optional date is specified by adding a colon
  9437. (:) to the tag:
  9438. @samp{-j@var{Symbolic_Tag}:@var{Date_Specifier}}.
  9439. See @ref{Branching and merging}.
  9440. @end table
  9441. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  9442. @node update output
  9443. @appendixsubsec update output
  9444. @code{update} and @code{checkout} keep you informed of
  9445. their progress by printing a line for each file, preceded
  9446. by one character indicating the status of the file:
  9447. @table @code
  9448. @item U @var{file}
  9449. The file was brought up to date with respect to the
  9450. repository. This is done for any file that exists in
  9451. the repository but not in your working directory, and for files
  9452. that you haven't changed but are not the most recent
  9453. versions available in the repository.
  9454. @item P @var{file}
  9455. Like @samp{U}, but the @sc{cvs} server sends a patch instead of an entire
  9456. file. This accomplishes the same thing as @samp{U} using less bandwidth.
  9457. @item A @var{file}
  9458. The file has been added to your private copy of the
  9459. sources, and will be added to the source repository
  9460. when you run @code{commit} on the file. This is a
  9461. reminder to you that the file needs to be committed.
  9462. @item R @var{file}
  9463. The file has been removed from your private copy of the
  9464. sources, and will be removed from the source repository
  9465. when you run @code{commit} on the file. This is a
  9466. reminder to you that the file needs to be committed.
  9467. @item M @var{file}
  9468. The file is modified in your working directory.
  9469. @samp{M} can indicate one of two states for a file
  9470. you're working on: either there were no modifications
  9471. to the same file in the repository, so that your file
  9472. remains as you last saw it; or there were modifications
  9473. in the repository as well as in your copy, but they
  9474. were merged successfully, without conflict, in your
  9475. working directory.
  9476. @sc{cvs} will print some messages if it merges your work,
  9477. and a backup copy of your working file (as it looked
  9478. before you ran @code{update}) will be made. The exact
  9479. name of that file is printed while @code{update} runs.
  9480. @item C @var{file}
  9481. @cindex .# files
  9482. @cindex __ files (VMS)
  9483. A conflict was detected while trying to merge your
  9484. changes to @var{file} with changes from the source
  9485. repository. @var{file} (the copy in your working
  9486. directory) is now the result of attempting to merge
  9487. the two revisions; an unmodified copy of your file
  9488. is also in your working directory, with the name
  9489. @file{.#@var{file}.@var{revision}} where @var{revision}
  9490. is the revision that your modified file started
  9491. from. Resolve the conflict as described in
  9492. @ref{Conflicts example}.
  9493. @c "some systems" as in out-of-the-box OSes? Not as
  9494. @c far as I know. We need to advise sysadmins as well
  9495. @c as users how to set up this kind of purge, if that is
  9496. @c what they want.
  9497. @c We also might want to think about cleaner solutions,
  9498. @c like having CVS remove the .# file once the conflict
  9499. @c has been resolved or something like that.
  9500. (Note that some systems automatically purge
  9501. files that begin with @file{.#} if they have not been
  9502. accessed for a few days. If you intend to keep a copy
  9503. of your original file, it is a very good idea to rename
  9504. it.) Under @sc{vms}, the file name starts with
  9505. @file{__} rather than @file{.#}.
  9506. @item ? @var{file}
  9507. @var{file} is in your working directory, but does not
  9508. correspond to anything in the source repository, and is
  9509. not in the list of files for @sc{cvs} to ignore (see the
  9510. description of the @samp{-I} option, and
  9511. @pxref{cvsignore}).
  9512. @end table
  9513. @c ----- END MAN 1 -----
  9514. @c ---------------------------------------------------------------------
  9515. @node Invoking CVS
  9516. @appendix Quick reference to CVS commands
  9517. @cindex Command reference
  9518. @cindex Reference, commands
  9519. @cindex Invoking CVS
  9520. This appendix describes how to invoke @sc{cvs}, with
  9521. references to where each command or feature is
  9522. described in detail. For other references run the
  9523. @code{cvs --help} command, or see @ref{Index}.
  9524. A @sc{cvs} command looks like:
  9525. @example
  9526. cvs [ @var{global_options} ] @var{command} [ @var{command_options} ] [ @var{command_args} ]
  9527. @end example
  9528. Global options:
  9529. @table @code
  9530. @item --allow-root=@var{rootdir}
  9531. Specify legal @sc{cvsroot} directory (server only) (not
  9532. in @sc{cvs} 1.9 and older). See @ref{Password
  9533. authentication server}.
  9534. @item -a
  9535. Authenticate all communication (client only) (not in @sc{cvs}
  9536. 1.9 and older). See @ref{Global options}.
  9537. @item -b
  9538. Specify RCS location (@sc{cvs} 1.9 and older). See
  9539. @ref{Global options}.
  9540. @item -d @var{root}
  9541. Specify the @sc{cvsroot}. See @ref{Repository}.
  9542. @item -e @var{editor}
  9543. Edit messages with @var{editor}. See @ref{Committing
  9544. your changes}.
  9545. @item -f
  9546. Do not read the @file{~/.cvsrc} file. See @ref{Global
  9547. options}.
  9548. @item -H
  9549. @itemx --help
  9550. Print a help message. See @ref{Global options}.
  9551. @item -n
  9552. Do not change any files. See @ref{Global options}.
  9553. @item -Q
  9554. Be really quiet. See @ref{Global options}.
  9555. @item -q
  9556. Be somewhat quiet. See @ref{Global options}.
  9557. @item -r
  9558. Make new working files read-only. See @ref{Global options}.
  9559. @item -s @var{variable}=@var{value}
  9560. Set a user variable. See @ref{Variables}.
  9561. @item -T @var{tempdir}
  9562. Put temporary files in @var{tempdir}. See @ref{Global
  9563. options}.
  9564. @item -t
  9565. Trace @sc{cvs} execution. See @ref{Global options}.
  9566. @item -v
  9567. @item --version
  9568. Display version and copyright information for @sc{cvs}.
  9569. @item -w
  9570. Make new working files read-write. See @ref{Global
  9571. options}.
  9572. @item -x
  9573. Encrypt all communication (client only).
  9574. See @ref{Global options}.
  9575. @item -z @var{gzip-level}
  9576. @cindex Compression
  9577. @cindex Gzip
  9578. Set the compression level (client only).
  9579. See @ref{Global options}.
  9580. @end table
  9581. Keyword expansion modes (@pxref{Substitution modes}):
  9582. @example
  9583. -kkv $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
  9584. -kkvl $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
  9585. -kk $@splitrcskeyword{Id}$
  9586. -kv file1,v 1.1 1993/12/09 03:21:13 joe Exp
  9587. -ko @i{no expansion}
  9588. -kb @i{no expansion, file is binary}
  9589. @end example
  9590. Keywords (@pxref{Keyword list}):
  9591. @example
  9592. $@splitrcskeyword{Author}: joe $
  9593. $@splitrcskeyword{Date}: 1993/12/09 03:21:13 $
  9594. $@splitrcskeyword{Header}: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
  9595. $@splitrcskeyword{Id}: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
  9596. $@splitrcskeyword{Locker}: harry $
  9597. $@splitrcskeyword{Name}: snapshot_1_14 $
  9598. $@splitrcskeyword{RCSfile}: file1,v $
  9599. $@splitrcskeyword{Revision}: 1.1 $
  9600. $@splitrcskeyword{Source}: /home/files/file1,v $
  9601. $@splitrcskeyword{State}: Exp $
  9602. $@splitrcskeyword{Log}: file1,v $
  9603. Revision 1.1 1993/12/09 03:30:17 joe
  9604. Initial revision
  9605. @end example
  9606. @c The idea behind this table is that we want each item
  9607. @c to be a sentence or two at most. Preferably a
  9608. @c single line.
  9609. @c
  9610. @c In some cases refs to "foo options" are just to get
  9611. @c this thing written quickly, not because the "foo
  9612. @c options" node is really the best place to point.
  9613. Commands, command options, and command arguments:
  9614. @table @code
  9615. @c ------------------------------------------------------------
  9616. @item add [@var{options}] [@var{files}@dots{}]
  9617. Add a new file/directory. See @ref{Adding files}.
  9618. @table @code
  9619. @item -k @var{kflag}
  9620. Set keyword expansion.
  9621. @item -m @var{msg}
  9622. Set file description.
  9623. @end table
  9624. @c ------------------------------------------------------------
  9625. @item admin [@var{options}] [@var{files}@dots{}]
  9626. Administration of history files in the repository. See
  9627. @ref{admin}.
  9628. @c This list omits those options which are not
  9629. @c documented as being useful with CVS. That might be
  9630. @c a mistake...
  9631. @table @code
  9632. @item -b[@var{rev}]
  9633. Set default branch. See @ref{Reverting local changes}.
  9634. @item -c@var{string}
  9635. Set comment leader.
  9636. @item -k@var{subst}
  9637. Set keyword substitution. See @ref{Keyword
  9638. substitution}.
  9639. @item -l[@var{rev}]
  9640. Lock revision @var{rev}, or latest revision.
  9641. @item -m@var{rev}:@var{msg}
  9642. Replace the log message of revision @var{rev} with
  9643. @var{msg}.
  9644. @item -o@var{range}
  9645. Delete revisions from the repository. See
  9646. @ref{admin options}.
  9647. @item -q
  9648. Run quietly; do not print diagnostics.
  9649. @item -s@var{state}[:@var{rev}]
  9650. Set the state. See @ref{admin options} for more information on possible
  9651. states.
  9652. @c Does not work for client/server CVS
  9653. @item -t
  9654. Set file description from standard input.
  9655. @item -t@var{file}
  9656. Set file description from @var{file}.
  9657. @item -t-@var{string}
  9658. Set file description to @var{string}.
  9659. @item -u[@var{rev}]
  9660. Unlock revision @var{rev}, or latest revision.
  9661. @end table
  9662. @c ------------------------------------------------------------
  9663. @item annotate [@var{options}] [@var{files}@dots{}]
  9664. Show last revision where each line was modified. See
  9665. @ref{annotate}.
  9666. @table @code
  9667. @item -D @var{date}
  9668. Annotate the most recent revision no later than
  9669. @var{date}. See @ref{Common options}.
  9670. @item -F
  9671. Force annotation of binary files. (Without this option,
  9672. binary files are skipped with a message.)
  9673. @item -f
  9674. Use head revision if tag/date not found. See
  9675. @ref{Common options}.
  9676. @item -l
  9677. Local; run only in current working directory. @xref{Recursive behavior}.
  9678. @item -R
  9679. Operate recursively (default). @xref{Recursive
  9680. behavior}.
  9681. @item -r @var{tag}
  9682. Annotate revision @var{tag}. See @ref{Common options}.
  9683. @end table
  9684. @c ------------------------------------------------------------
  9685. @item checkout [@var{options}] @var{modules}@dots{}
  9686. Get a copy of the sources. See @ref{checkout}.
  9687. @table @code
  9688. @item -A
  9689. Reset any sticky tags/date/options. See @ref{Sticky
  9690. tags} and @ref{Keyword substitution}.
  9691. @item -c
  9692. Output the module database. See @ref{checkout options}.
  9693. @item -D @var{date}
  9694. Check out revisions as of @var{date} (is sticky). See
  9695. @ref{Common options}.
  9696. @item -d @var{dir}
  9697. Check out into @var{dir}. See @ref{checkout options}.
  9698. @item -f
  9699. Use head revision if tag/date not found. See
  9700. @ref{Common options}.
  9701. @c Probably want to use rev1/rev2 style like for diff
  9702. @c -r. Here and in on-line help.
  9703. @item -j @var{rev}
  9704. Merge in changes. See @ref{checkout options}.
  9705. @item -k @var{kflag}
  9706. Use @var{kflag} keyword expansion. See
  9707. @ref{Substitution modes}.
  9708. @item -l
  9709. Local; run only in current working directory. @xref{Recursive behavior}.
  9710. @item -N
  9711. Don't ``shorten'' module paths if -d specified. See
  9712. @ref{checkout options}.
  9713. @item -n
  9714. Do not run module program (if any). See @ref{checkout options}.
  9715. @item -P
  9716. Prune empty directories. See @ref{Moving directories}.
  9717. @item -p
  9718. Check out files to standard output (avoids
  9719. stickiness). See @ref{checkout options}.
  9720. @item -R
  9721. Operate recursively (default). @xref{Recursive
  9722. behavior}.
  9723. @item -r @var{tag}
  9724. Checkout revision @var{tag} (is sticky). See @ref{Common options}.
  9725. @item -s
  9726. Like -c, but include module status. See @ref{checkout options}.
  9727. @end table
  9728. @c ------------------------------------------------------------
  9729. @item commit [@var{options}] [@var{files}@dots{}]
  9730. Check changes into the repository. See @ref{commit}.
  9731. @table @code
  9732. @item -F @var{file}
  9733. Read log message from @var{file}. See @ref{commit options}.
  9734. @item -f
  9735. @c What is this "disables recursion"? It is from the
  9736. @c on-line help; is it documented in this manual?
  9737. Force the file to be committed; disables recursion.
  9738. See @ref{commit options}.
  9739. @item -l
  9740. Local; run only in current working directory. See @ref{Recursive behavior}.
  9741. @item -m @var{msg}
  9742. Use @var{msg} as log message. See @ref{commit options}.
  9743. @item -n
  9744. Do not run module program (if any). See @ref{commit options}.
  9745. @item -R
  9746. Operate recursively (default). @xref{Recursive
  9747. behavior}.
  9748. @item -r @var{rev}
  9749. Commit to @var{rev}. See @ref{commit options}.
  9750. @c FIXME: should be dragging over text from
  9751. @c commit options, especially if it can be cleaned up
  9752. @c and made concise enough.
  9753. @end table
  9754. @c ------------------------------------------------------------
  9755. @item diff [@var{options}] [@var{files}@dots{}]
  9756. Show differences between revisions. See @ref{diff}.
  9757. In addition to the options shown below, accepts a wide
  9758. variety of options to control output style, for example
  9759. @samp{-c} for context diffs.
  9760. @table @code
  9761. @item -D @var{date1}
  9762. Diff revision for date against working file. See
  9763. @ref{diff options}.
  9764. @item -D @var{date2}
  9765. Diff @var{rev1}/@var{date1} against @var{date2}. See
  9766. @ref{diff options}.
  9767. @item -l
  9768. Local; run only in current working directory. See @ref{Recursive behavior}.
  9769. @item -N
  9770. Include diffs for added and removed files. See
  9771. @ref{diff options}.
  9772. @item -R
  9773. Operate recursively (default). @xref{Recursive
  9774. behavior}.
  9775. @item -r @var{rev1}
  9776. Diff revision for @var{rev1} against working file. See
  9777. @ref{diff options}.
  9778. @item -r @var{rev2}
  9779. Diff @var{rev1}/@var{date1} against @var{rev2}. See @ref{diff options}.
  9780. @end table
  9781. @c ------------------------------------------------------------
  9782. @item edit [@var{options}] [@var{files}@dots{}]
  9783. Get ready to edit a watched file. See @ref{Editing files}.
  9784. @table @code
  9785. @item -a @var{actions}
  9786. Specify actions for temporary watch, where
  9787. @var{actions} is @code{edit}, @code{unedit},
  9788. @code{commit}, @code{all}, or @code{none}. See
  9789. @ref{Editing files}.
  9790. @item -l
  9791. Local; run only in current working directory. See @ref{Recursive behavior}.
  9792. @item -R
  9793. Operate recursively (default). @xref{Recursive
  9794. behavior}.
  9795. @end table
  9796. @c ------------------------------------------------------------
  9797. @item editors [@var{options}] [@var{files}@dots{}]
  9798. See who is editing a watched file. See @ref{Watch information}.
  9799. @table @code
  9800. @item -l
  9801. Local; run only in current working directory. See @ref{Recursive behavior}.
  9802. @item -R
  9803. Operate recursively (default). @xref{Recursive
  9804. behavior}.
  9805. @end table
  9806. @c ------------------------------------------------------------
  9807. @item export [@var{options}] @var{modules}@dots{}
  9808. Export files from @sc{cvs}. See @ref{export}.
  9809. @table @code
  9810. @item -D @var{date}
  9811. Check out revisions as of @var{date}. See
  9812. @ref{Common options}.
  9813. @item -d @var{dir}
  9814. Check out into @var{dir}. See @ref{export options}.
  9815. @item -f
  9816. Use head revision if tag/date not found. See
  9817. @ref{Common options}.
  9818. @item -k @var{kflag}
  9819. Use @var{kflag} keyword expansion. See
  9820. @ref{Substitution modes}.
  9821. @item -l
  9822. Local; run only in current working directory. @xref{Recursive behavior}.
  9823. @item -N
  9824. Don't ``shorten'' module paths if -d specified. See
  9825. @ref{export options}.
  9826. @item -n
  9827. Do not run module program (if any). See @ref{export options}.
  9828. @item -R
  9829. Operate recursively (default). @xref{Recursive
  9830. behavior}.
  9831. @item -r @var{tag}
  9832. Checkout revision @var{tag}. See @ref{Common options}.
  9833. @end table
  9834. @c ------------------------------------------------------------
  9835. @item history [@var{options}] [@var{files}@dots{}]
  9836. Show repository access history. See @ref{history}.
  9837. @table @code
  9838. @item -a
  9839. All users (default is self). See @ref{history options}.
  9840. @item -b @var{str}
  9841. Back to record with @var{str} in module/file/repos
  9842. field. See @ref{history options}.
  9843. @item -c
  9844. Report on committed (modified) files. See @ref{history options}.
  9845. @item -D @var{date}
  9846. Since @var{date}. See @ref{history options}.
  9847. @item -e
  9848. Report on all record types. See @ref{history options}.
  9849. @item -l
  9850. Last modified (committed or modified report). See @ref{history options}.
  9851. @item -m @var{module}
  9852. Report on @var{module} (repeatable). See @ref{history options}.
  9853. @item -n @var{module}
  9854. In @var{module}. See @ref{history options}.
  9855. @item -o
  9856. Report on checked out modules. See @ref{history options}.
  9857. @item -p @var{repository}
  9858. In @var{repository}. See @ref{history options}.
  9859. @item -r @var{rev}
  9860. Since revision @var{rev}. See @ref{history options}.
  9861. @item -T
  9862. @c What the @#$@# is a TAG? Same as a tag? This
  9863. @c wording is also in the online-line help.
  9864. Produce report on all TAGs. See @ref{history options}.
  9865. @item -t @var{tag}
  9866. Since tag record placed in history file (by anyone).
  9867. See @ref{history options}.
  9868. @item -u @var{user}
  9869. For user @var{user} (repeatable). See @ref{history options}.
  9870. @item -w
  9871. Working directory must match. See @ref{history options}.
  9872. @item -x @var{types}
  9873. Report on @var{types}, one or more of
  9874. @code{TOEFWUPCGMAR}. See @ref{history options}.
  9875. @item -z @var{zone}
  9876. Output for time zone @var{zone}. See @ref{history options}.
  9877. @end table
  9878. @c ------------------------------------------------------------
  9879. @item import [@var{options}] @var{repository} @var{vendor-tag} @var{release-tags}@dots{}
  9880. Import files into @sc{cvs}, using vendor branches. See
  9881. @ref{import}.
  9882. @table @code
  9883. @item -b @var{bra}
  9884. Import to vendor branch @var{bra}. See
  9885. @ref{Multiple vendor branches}.
  9886. @item -d
  9887. Use the file's modification time as the time of
  9888. import. See @ref{import options}.
  9889. @item -k @var{kflag}
  9890. Set default keyword substitution mode. See
  9891. @ref{import options}.
  9892. @item -m @var{msg}
  9893. Use @var{msg} for log message. See
  9894. @ref{import options}.
  9895. @item -I @var{ign}
  9896. More files to ignore (! to reset). See
  9897. @ref{import options}.
  9898. @item -W @var{spec}
  9899. More wrappers. See @ref{import options}.
  9900. @end table
  9901. @c ------------------------------------------------------------
  9902. @item init
  9903. Create a @sc{cvs} repository if it doesn't exist. See
  9904. @ref{Creating a repository}.
  9905. @c ------------------------------------------------------------
  9906. @item kserver
  9907. Kerberos authenticated server.
  9908. See @ref{Kerberos authenticated}.
  9909. @c ------------------------------------------------------------
  9910. @item log [@var{options}] [@var{files}@dots{}]
  9911. Print out history information for files. See @ref{log}.
  9912. @table @code
  9913. @item -b
  9914. Only list revisions on the default branch. See @ref{log options}.
  9915. @item -d @var{dates}
  9916. Specify dates (@var{d1}<@var{d2} for range, @var{d} for
  9917. latest before). See @ref{log options}.
  9918. @item -h
  9919. Only print header. See @ref{log options}.
  9920. @item -l
  9921. Local; run only in current working directory. See @ref{Recursive behavior}.
  9922. @item -N
  9923. Do not list tags. See @ref{log options}.
  9924. @item -R
  9925. Only print name of RCS file. See @ref{log options}.
  9926. @item -r@var{revs}
  9927. Only list revisions @var{revs}. See @ref{log options}.
  9928. @item -s @var{states}
  9929. Only list revisions with specified states. See @ref{log options}.
  9930. @item -t
  9931. Only print header and descriptive text. See @ref{log
  9932. options}.
  9933. @item -w@var{logins}
  9934. Only list revisions checked in by specified logins. See @ref{log options}.
  9935. @end table
  9936. @c ------------------------------------------------------------
  9937. @item login
  9938. Prompt for password for authenticating server. See
  9939. @ref{Password authentication client}.
  9940. @c ------------------------------------------------------------
  9941. @item logout
  9942. Remove stored password for authenticating server. See
  9943. @ref{Password authentication client}.
  9944. @c ------------------------------------------------------------
  9945. @item pserver
  9946. Password authenticated server.
  9947. See @ref{Password authentication server}.
  9948. @c ------------------------------------------------------------
  9949. @item rannotate [@var{options}] [@var{modules}@dots{}]
  9950. Show last revision where each line was modified. See
  9951. @ref{annotate}.
  9952. @table @code
  9953. @item -D @var{date}
  9954. Annotate the most recent revision no later than
  9955. @var{date}. See @ref{Common options}.
  9956. @item -F
  9957. Force annotation of binary files. (Without this option,
  9958. binary files are skipped with a message.)
  9959. @item -f
  9960. Use head revision if tag/date not found. See
  9961. @ref{Common options}.
  9962. @item -l
  9963. Local; run only in current working directory. @xref{Recursive behavior}.
  9964. @item -R
  9965. Operate recursively (default). @xref{Recursive behavior}.
  9966. @item -r @var{tag}
  9967. Annotate revision @var{tag}. See @ref{Common options}.
  9968. @end table
  9969. @c ------------------------------------------------------------
  9970. @item rdiff [@var{options}] @var{modules}@dots{}
  9971. Show differences between releases. See @ref{rdiff}.
  9972. @table @code
  9973. @item -c
  9974. Context diff output format (default). See @ref{rdiff options}.
  9975. @item -D @var{date}
  9976. Select revisions based on @var{date}. See @ref{Common options}.
  9977. @item -f
  9978. Use head revision if tag/date not found. See
  9979. @ref{Common options}.
  9980. @item -l
  9981. Local; run only in current working directory. See @ref{Recursive behavior}.
  9982. @item -R
  9983. Operate recursively (default). @xref{Recursive
  9984. behavior}.
  9985. @item -r @var{rev}
  9986. Select revisions based on @var{rev}. See @ref{Common options}.
  9987. @item -s
  9988. Short patch - one liner per file. See @ref{rdiff options}.
  9989. @item -t
  9990. Top two diffs - last change made to the file. See
  9991. @ref{diff options}.
  9992. @item -u
  9993. Unidiff output format. See @ref{rdiff options}.
  9994. @item -V @var{vers}
  9995. Use RCS Version @var{vers} for keyword expansion (obsolete). See
  9996. @ref{rdiff options}.
  9997. @end table
  9998. @c ------------------------------------------------------------
  9999. @item release [@var{options}] @var{directory}
  10000. Indicate that a directory is no longer in use. See
  10001. @ref{release}.
  10002. @table @code
  10003. @item -d
  10004. Delete the given directory. See @ref{release options}.
  10005. @end table
  10006. @c ------------------------------------------------------------
  10007. @item remove [@var{options}] [@var{files}@dots{}]
  10008. Remove an entry from the repository. See @ref{Removing files}.
  10009. @table @code
  10010. @item -f
  10011. Delete the file before removing it. See @ref{Removing files}.
  10012. @item -l
  10013. Local; run only in current working directory. See @ref{Recursive behavior}.
  10014. @item -R
  10015. Operate recursively (default). @xref{Recursive
  10016. behavior}.
  10017. @end table
  10018. @c ------------------------------------------------------------
  10019. @item rlog [@var{options}] [@var{files}@dots{}]
  10020. Print out history information for modules. See @ref{log}.
  10021. @table @code
  10022. @item -b
  10023. Only list revisions on the default branch. See @ref{log options}.
  10024. @item -d @var{dates}
  10025. Specify dates (@var{d1}<@var{d2} for range, @var{d} for
  10026. latest before). See @ref{log options}.
  10027. @item -h
  10028. Only print header. See @ref{log options}.
  10029. @item -l
  10030. Local; run only in current working directory. See @ref{Recursive behavior}.
  10031. @item -N
  10032. Do not list tags. See @ref{log options}.
  10033. @item -R
  10034. Only print name of RCS file. See @ref{log options}.
  10035. @item -r@var{revs}
  10036. Only list revisions @var{revs}. See @ref{log options}.
  10037. @item -s @var{states}
  10038. Only list revisions with specified states. See @ref{log options}.
  10039. @item -t
  10040. Only print header and descriptive text. See @ref{log options}.
  10041. @item -w@var{logins}
  10042. Only list revisions checked in by specified logins. See @ref{log options}.
  10043. @end table
  10044. @c ------------------------------------------------------------
  10045. @item rtag [@var{options}] @var{tag} @var{modules}@dots{}
  10046. Add a symbolic tag to a module.
  10047. See @ref{Revisions} and @ref{Branching and merging}.
  10048. @table @code
  10049. @item -a
  10050. Clear tag from removed files that would not otherwise
  10051. be tagged. See @ref{Tagging add/remove}.
  10052. @item -b
  10053. Create a branch named @var{tag}. See @ref{Branching and merging}.
  10054. @item -B
  10055. Used in conjunction with -F or -d, enables movement and deletion of
  10056. branch tags. Use with extreme caution.
  10057. @item -D @var{date}
  10058. Tag revisions as of @var{date}. See @ref{Tagging by date/tag}.
  10059. @item -d
  10060. Delete @var{tag}. See @ref{Modifying tags}.
  10061. @item -F
  10062. Move @var{tag} if it already exists. See @ref{Modifying tags}.
  10063. @item -f
  10064. Force a head revision match if tag/date not found.
  10065. See @ref{Tagging by date/tag}.
  10066. @item -l
  10067. Local; run only in current working directory. See @ref{Recursive behavior}.
  10068. @item -n
  10069. No execution of tag program. See @ref{Common options}.
  10070. @item -R
  10071. Operate recursively (default). @xref{Recursive
  10072. behavior}.
  10073. @item -r @var{rev}
  10074. Tag existing tag @var{rev}. See @ref{Tagging by date/tag}.
  10075. @end table
  10076. @c ------------------------------------------------------------
  10077. @item server
  10078. Rsh server. See @ref{Connecting via rsh}.
  10079. @c ------------------------------------------------------------
  10080. @item status [@var{options}] @var{files}@dots{}
  10081. Display status information in a working directory. See
  10082. @ref{File status}.
  10083. @table @code
  10084. @item -l
  10085. Local; run only in current working directory. See @ref{Recursive behavior}.
  10086. @item -R
  10087. Operate recursively (default). @xref{Recursive
  10088. behavior}.
  10089. @item -v
  10090. Include tag information for file. See @ref{Tags}.
  10091. @end table
  10092. @c ------------------------------------------------------------
  10093. @item tag [@var{options}] @var{tag} [@var{files}@dots{}]
  10094. Add a symbolic tag to checked out version of files.
  10095. See @ref{Revisions} and @ref{Branching and merging}.
  10096. @table @code
  10097. @item -b
  10098. Create a branch named @var{tag}. See @ref{Branching and merging}.
  10099. @item -c
  10100. Check that working files are unmodified. See
  10101. @ref{Tagging the working directory}.
  10102. @item -D @var{date}
  10103. Tag revisions as of @var{date}. See @ref{Tagging by date/tag}.
  10104. @item -d
  10105. Delete @var{tag}. See @ref{Modifying tags}.
  10106. @item -F
  10107. Move @var{tag} if it already exists. See @ref{Modifying tags}.
  10108. @item -f
  10109. Force a head revision match if tag/date not found.
  10110. See @ref{Tagging by date/tag}.
  10111. @item -l
  10112. Local; run only in current working directory. See @ref{Recursive behavior}.
  10113. @item -R
  10114. Operate recursively (default). @xref{Recursive
  10115. behavior}.
  10116. @item -r @var{rev}
  10117. Tag existing tag @var{rev}. See @ref{Tagging by date/tag}.
  10118. @end table
  10119. @c ------------------------------------------------------------
  10120. @item unedit [@var{options}] [@var{files}@dots{}]
  10121. Undo an edit command. See @ref{Editing files}.
  10122. @table @code
  10123. @item -l
  10124. Local; run only in current working directory. See @ref{Recursive behavior}.
  10125. @item -R
  10126. Operate recursively (default). @xref{Recursive behavior}.
  10127. @end table
  10128. @c ------------------------------------------------------------
  10129. @item update [@var{options}] [@var{files}@dots{}]
  10130. Bring work tree in sync with repository. See
  10131. @ref{update}.
  10132. @table @code
  10133. @item -A
  10134. Reset any sticky tags/date/options. See @ref{Sticky
  10135. tags} and @ref{Keyword substitution}.
  10136. @item -C
  10137. Overwrite locally modified files with clean copies from
  10138. the repository (the modified file is saved in
  10139. @file{.#@var{file}.@var{revision}}, however).
  10140. @item -D @var{date}
  10141. Check out revisions as of @var{date} (is sticky). See
  10142. @ref{Common options}.
  10143. @item -d
  10144. Create directories. See @ref{update options}.
  10145. @item -f
  10146. Use head revision if tag/date not found. See
  10147. @ref{Common options}.
  10148. @item -I @var{ign}
  10149. More files to ignore (! to reset). See
  10150. @ref{import options}.
  10151. @c Probably want to use rev1/rev2 style like for diff
  10152. @c -r. Here and in on-line help.
  10153. @item -j @var{rev}
  10154. Merge in changes. See @ref{update options}.
  10155. @item -k @var{kflag}
  10156. Use @var{kflag} keyword expansion. See
  10157. @ref{Substitution modes}.
  10158. @item -l
  10159. Local; run only in current working directory. @xref{Recursive behavior}.
  10160. @item -P
  10161. Prune empty directories. See @ref{Moving directories}.
  10162. @item -p
  10163. Check out files to standard output (avoids
  10164. stickiness). See @ref{update options}.
  10165. @item -R
  10166. Operate recursively (default). @xref{Recursive
  10167. behavior}.
  10168. @item -r @var{tag}
  10169. Checkout revision @var{tag} (is sticky). See @ref{Common options}.
  10170. @item -W @var{spec}
  10171. More wrappers. See @ref{import options}.
  10172. @end table
  10173. @c ------------------------------------------------------------
  10174. @item version
  10175. @cindex version (subcommand)
  10176. Display the version of @sc{cvs} being used. If the repository
  10177. is remote, display both the client and server versions.
  10178. @c ------------------------------------------------------------
  10179. @item watch [on|off|add|remove] [@var{options}] [@var{files}@dots{}]
  10180. on/off: turn on/off read-only checkouts of files. See
  10181. @ref{Setting a watch}.
  10182. add/remove: add or remove notification on actions. See
  10183. @ref{Getting Notified}.
  10184. @table @code
  10185. @item -a @var{actions}
  10186. Specify actions for temporary watch, where
  10187. @var{actions} is @code{edit}, @code{unedit},
  10188. @code{commit}, @code{all}, or @code{none}. See
  10189. @ref{Editing files}.
  10190. @item -l
  10191. Local; run only in current working directory. See @ref{Recursive behavior}.
  10192. @item -R
  10193. Operate recursively (default). @xref{Recursive
  10194. behavior}.
  10195. @end table
  10196. @c ------------------------------------------------------------
  10197. @item watchers [@var{options}] [@var{files}@dots{}]
  10198. See who is watching a file. See @ref{Watch information}.
  10199. @table @code
  10200. @item -l
  10201. Local; run only in current working directory. See @ref{Recursive behavior}.
  10202. @item -R
  10203. Operate recursively (default). @xref{Recursive
  10204. behavior}.
  10205. @end table
  10206. @end table
  10207. @c ---------------------------------------------------------------------
  10208. @node Administrative files
  10209. @appendix Reference manual for Administrative files
  10210. @cindex Administrative files (reference)
  10211. @cindex Files, reference manual
  10212. @cindex Reference manual (files)
  10213. @cindex CVSROOT (file)
  10214. @c FIXME? Somewhere there needs to be a more "how-to"
  10215. @c guide to writing these. I think the triggers
  10216. @c (commitinfo, loginfo, taginfo, &c) are perhaps a
  10217. @c different case than files like modules. One
  10218. @c particular issue that people sometimes are
  10219. @c (unnecessarily?) worried about is performance, and
  10220. @c the impact of writing in perl or sh or ____.
  10221. Inside the repository, in the directory
  10222. @file{$CVSROOT/CVSROOT}, there are a number of
  10223. supportive files for @sc{cvs}. You can use @sc{cvs} in a limited
  10224. fashion without any of them, but if they are set up
  10225. properly they can help make life easier. For a
  10226. discussion of how to edit them, see @ref{Intro
  10227. administrative files}.
  10228. The most important of these files is the @file{modules}
  10229. file, which defines the modules inside the repository.
  10230. @menu
  10231. * modules:: Defining modules
  10232. * Wrappers:: Specify binary-ness based on file name
  10233. * Trigger Scripts:: Some notes on the commit support files and
  10234. taginfo, referenced below.
  10235. * commit files:: The commit support files (commitinfo,
  10236. verifymsg, editinfo, loginfo)
  10237. * taginfo:: Verifying/Logging tags
  10238. * rcsinfo:: Templates for the log messages
  10239. * cvsignore:: Ignoring files via cvsignore
  10240. * checkoutlist:: Adding your own administrative files
  10241. * history file:: History information
  10242. * Variables:: Various variables are expanded
  10243. * config:: Miscellaneous CVS configuration
  10244. @end menu
  10245. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10246. @node modules
  10247. @appendixsec The modules file
  10248. @cindex Modules (admin file)
  10249. @cindex Defining modules (reference manual)
  10250. The @file{modules} file records your definitions of
  10251. names for collections of source code. @sc{cvs} will
  10252. use these definitions if you use @sc{cvs} to update the
  10253. modules file (use normal commands like @code{add},
  10254. @code{commit}, etc).
  10255. The @file{modules} file may contain blank lines and
  10256. comments (lines beginning with @samp{#}) as well as
  10257. module definitions. Long lines can be continued on the
  10258. next line by specifying a backslash (@samp{\}) as the
  10259. last character on the line.
  10260. There are three basic types of modules: alias modules,
  10261. regular modules, and ampersand modules. The difference
  10262. between them is the way that they map files in the
  10263. repository to files in the working directory. In all
  10264. of the following examples, the top-level repository
  10265. contains a directory called @file{first-dir}, which
  10266. contains two files, @file{file1} and @file{file2}, and a
  10267. directory @file{sdir}. @file{first-dir/sdir} contains
  10268. a file @file{sfile}.
  10269. @c FIXME: should test all the examples in this section.
  10270. @menu
  10271. * Alias modules:: The simplest kind of module
  10272. * Regular modules::
  10273. * Ampersand modules::
  10274. * Excluding directories:: Excluding directories from a module
  10275. * Module options:: Regular and ampersand modules can take options
  10276. * Module program options:: How the modules ``program options'' programs
  10277. are run.
  10278. @end menu
  10279. @node Alias modules
  10280. @appendixsubsec Alias modules
  10281. @cindex Alias modules
  10282. @cindex -a, in modules file
  10283. Alias modules are the simplest kind of module:
  10284. @table @code
  10285. @item @var{mname} -a @var{aliases}@dots{}
  10286. This represents the simplest way of defining a module
  10287. @var{mname}. The @samp{-a} flags the definition as a
  10288. simple alias: @sc{cvs} will treat any use of @var{mname} (as
  10289. a command argument) as if the list of names
  10290. @var{aliases} had been specified instead.
  10291. @var{aliases} may contain either other module names or
  10292. paths. When you use paths in aliases, @code{checkout}
  10293. creates all intermediate directories in the working
  10294. directory, just as if the path had been specified
  10295. explicitly in the @sc{cvs} arguments.
  10296. @end table
  10297. For example, if the modules file contains:
  10298. @example
  10299. amodule -a first-dir
  10300. @end example
  10301. @noindent
  10302. then the following two commands are equivalent:
  10303. @example
  10304. $ cvs co amodule
  10305. $ cvs co first-dir
  10306. @end example
  10307. @noindent
  10308. and they each would provide output such as:
  10309. @example
  10310. cvs checkout: Updating first-dir
  10311. U first-dir/file1
  10312. U first-dir/file2
  10313. cvs checkout: Updating first-dir/sdir
  10314. U first-dir/sdir/sfile
  10315. @end example
  10316. @node Regular modules
  10317. @appendixsubsec Regular modules
  10318. @cindex Regular modules
  10319. @table @code
  10320. @item @var{mname} [ options ] @var{dir} [ @var{files}@dots{} ]
  10321. In the simplest case, this form of module definition
  10322. reduces to @samp{@var{mname} @var{dir}}. This defines
  10323. all the files in directory @var{dir} as module mname.
  10324. @var{dir} is a relative path (from @code{$CVSROOT}) to a
  10325. directory of source in the source repository. In this
  10326. case, on checkout, a single directory called
  10327. @var{mname} is created as a working directory; no
  10328. intermediate directory levels are used by default, even
  10329. if @var{dir} was a path involving several directory
  10330. levels.
  10331. @end table
  10332. For example, if a module is defined by:
  10333. @example
  10334. regmodule first-dir
  10335. @end example
  10336. @noindent
  10337. then regmodule will contain the files from first-dir:
  10338. @example
  10339. $ cvs co regmodule
  10340. cvs checkout: Updating regmodule
  10341. U regmodule/file1
  10342. U regmodule/file2
  10343. cvs checkout: Updating regmodule/sdir
  10344. U regmodule/sdir/sfile
  10345. $
  10346. @end example
  10347. By explicitly specifying files in the module definition
  10348. after @var{dir}, you can select particular files from
  10349. directory @var{dir}. Here is
  10350. an example:
  10351. @example
  10352. regfiles first-dir/sdir sfile
  10353. @end example
  10354. @noindent
  10355. With this definition, getting the regfiles module
  10356. will create a single working directory
  10357. @file{regfiles} containing the file listed, which
  10358. comes from a directory deeper
  10359. in the @sc{cvs} source repository:
  10360. @example
  10361. $ cvs co regfiles
  10362. U regfiles/sfile
  10363. $
  10364. @end example
  10365. @node Ampersand modules
  10366. @appendixsubsec Ampersand modules
  10367. @cindex Ampersand modules
  10368. @cindex &, in modules file
  10369. A module definition can refer to other modules by
  10370. including @samp{&@var{module}} in its definition.
  10371. @example
  10372. @var{mname} [ options ] @var{&module}@dots{}
  10373. @end example
  10374. Then getting the module creates a subdirectory for each such
  10375. module, in the directory containing the module. For
  10376. example, if modules contains
  10377. @example
  10378. ampermod &first-dir
  10379. @end example
  10380. @noindent
  10381. then a checkout will create an @code{ampermod} directory
  10382. which contains a directory called @code{first-dir},
  10383. which in turns contains all the directories and files
  10384. which live there. For example, the command
  10385. @example
  10386. $ cvs co ampermod
  10387. @end example
  10388. @noindent
  10389. will create the following files:
  10390. @example
  10391. ampermod/first-dir/file1
  10392. ampermod/first-dir/file2
  10393. ampermod/first-dir/sdir/sfile
  10394. @end example
  10395. There is one quirk/bug: the messages that @sc{cvs}
  10396. prints omit the @file{ampermod}, and thus do not
  10397. correctly display the location to which it is checking
  10398. out the files:
  10399. @example
  10400. $ cvs co ampermod
  10401. cvs checkout: Updating first-dir
  10402. U first-dir/file1
  10403. U first-dir/file2
  10404. cvs checkout: Updating first-dir/sdir
  10405. U first-dir/sdir/sfile
  10406. $
  10407. @end example
  10408. Do not rely on this buggy behavior; it may get fixed in
  10409. a future release of @sc{cvs}.
  10410. @c FIXCVS: What happens if regular and & modules are
  10411. @c combined, as in "ampermodule first-dir &second-dir"?
  10412. @c When I tried it, it seemed to just ignore the
  10413. @c "first-dir". I think perhaps it should be an error
  10414. @c (but this needs further investigation).
  10415. @c In addition to discussing what each one does, we
  10416. @c should put in a few words about why you would use one or
  10417. @c the other in various situations.
  10418. @node Excluding directories
  10419. @appendixsubsec Excluding directories
  10420. @cindex Excluding directories, in modules file
  10421. @cindex !, in modules file
  10422. An alias module may exclude particular directories from
  10423. other modules by using an exclamation mark (@samp{!})
  10424. before the name of each directory to be excluded.
  10425. For example, if the modules file contains:
  10426. @example
  10427. exmodule -a !first-dir/sdir first-dir
  10428. @end example
  10429. @noindent
  10430. then checking out the module @samp{exmodule} will check
  10431. out everything in @samp{first-dir} except any files in
  10432. the subdirectory @samp{first-dir/sdir}.
  10433. @c Note that the "!first-dir/sdir" sometimes must be listed
  10434. @c before "first-dir". That seems like a probable bug, in which
  10435. @c case perhaps it should be fixed (to allow either
  10436. @c order) rather than documented. See modules4 in testsuite.
  10437. @node Module options
  10438. @appendixsubsec Module options
  10439. @cindex Options, in modules file
  10440. Either regular modules or ampersand modules can contain
  10441. options, which supply additional information concerning
  10442. the module.
  10443. @table @code
  10444. @cindex -d, in modules file
  10445. @item -d @var{name}
  10446. Name the working directory something other than the
  10447. module name.
  10448. @c FIXME: Needs a bunch of examples, analogous to the
  10449. @c examples for alias, regular, and ampersand modules
  10450. @c which show where the files go without -d.
  10451. @cindex Export program
  10452. @cindex -e, in modules file
  10453. @item -e @var{prog}
  10454. Specify a program @var{prog} to run whenever files in a
  10455. module are exported. @var{prog} runs with a single
  10456. argument, the module name.
  10457. @c FIXME: Is it run on server? client?
  10458. @cindex Checkout program
  10459. @cindex -o, in modules file
  10460. @item -o @var{prog}
  10461. Specify a program @var{prog} to run whenever files in a
  10462. module are checked out. @var{prog} runs with a single
  10463. argument, the module name. See @ref{Module program options} for
  10464. information on how @var{prog} is called.
  10465. @c FIXME: Is it run on server? client?
  10466. @cindex Status of a module
  10467. @cindex Module status
  10468. @cindex -s, in modules file
  10469. @item -s @var{status}
  10470. Assign a status to the module. When the module file is
  10471. printed with @samp{cvs checkout -s} the modules are
  10472. sorted according to primarily module status, and
  10473. secondarily according to the module name. This option
  10474. has no other meaning. You can use this option for
  10475. several things besides status: for instance, list the
  10476. person that is responsible for this module.
  10477. @cindex Tag program
  10478. @cindex -t, in modules file
  10479. @item -t @var{prog}
  10480. Specify a program @var{prog} to run whenever files in a
  10481. module are tagged with @code{rtag}. @var{prog} runs
  10482. with two arguments: the module name and the symbolic
  10483. tag specified to @code{rtag}. It is not run
  10484. when @code{tag} is executed. Generally you will find
  10485. that the @file{taginfo} file is a better solution (@pxref{taginfo}).
  10486. @c FIXME: Is it run on server? client?
  10487. @c Problems with -t include:
  10488. @c * It is run after the tag not before
  10489. @c * It doesn't get passed all the information that
  10490. @c taginfo does ("mov", &c).
  10491. @c * It only is run for rtag, not tag.
  10492. @end table
  10493. You should also see @pxref{Module program options} about how the
  10494. ``program options'' programs are run.
  10495. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10496. @node Module program options
  10497. @appendixsubsec How the modules file ``program options'' programs are run
  10498. @cindex Modules file program options
  10499. @cindex -t, in modules file
  10500. @cindex -o, in modules file
  10501. @cindex -e, in modules file
  10502. @noindent
  10503. For checkout, rtag, and export, the program is server-based, and as such the
  10504. following applies:-
  10505. If using remote access methods (pserver, ext, etc.),
  10506. @sc{cvs} will execute this program on the server from a temporary
  10507. directory. The path is searched for this program.
  10508. If using ``local access'' (on a local or remote NFS file system, i.e.,
  10509. repository set just to a path),
  10510. the program will be executed from the newly checked-out tree, if
  10511. found there, or alternatively searched for in the path if not.
  10512. The programs are all run after the operation has effectively
  10513. completed.
  10514. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10515. @node Wrappers
  10516. @appendixsec The cvswrappers file
  10517. @cindex cvswrappers (admin file)
  10518. @cindex CVSWRAPPERS, environment variable
  10519. @cindex Wrappers
  10520. @c FIXME: need some better way of separating this out
  10521. @c by functionality. -m is
  10522. @c one feature, and -k is a another. And this discussion
  10523. @c should be better motivated (e.g. start with the
  10524. @c problems, then explain how the feature solves it).
  10525. Wrappers refers to a @sc{cvs} feature which lets you
  10526. control certain settings based on the name of the file
  10527. which is being operated on. The settings are @samp{-k}
  10528. for binary files, and @samp{-m} for nonmergeable text
  10529. files.
  10530. The @samp{-m} option
  10531. specifies the merge methodology that should be used when
  10532. a non-binary file is updated. @code{MERGE} means the usual
  10533. @sc{cvs} behavior: try to merge the files. @code{COPY}
  10534. means that @code{cvs update} will refuse to merge
  10535. files, as it also does for files specified as binary
  10536. with @samp{-kb} (but if the file is specified as
  10537. binary, there is no need to specify @samp{-m 'COPY'}).
  10538. @sc{cvs} will provide the user with the
  10539. two versions of the files, and require the user using
  10540. mechanisms outside @sc{cvs}, to insert any necessary
  10541. changes.
  10542. @strong{WARNING: Do not use @code{COPY} with
  10543. @sc{cvs} 1.9 or earlier - such versions of @sc{cvs} will
  10544. copy one version of your file over the other, wiping
  10545. out the previous contents.}
  10546. @c Ordinarily we don't document the behavior of old
  10547. @c versions. But this one is so dangerous, I think we
  10548. @c must. I almost renamed it to -m 'NOMERGE' so we
  10549. @c could say "never use -m 'COPY'".
  10550. The @samp{-m} wrapper option only affects behavior when
  10551. merging is done on update; it does not affect how files
  10552. are stored. See @ref{Binary files}, for more on
  10553. binary files.
  10554. The basic format of the file @file{cvswrappers} is:
  10555. @c FIXME: @example is all wrong for this. Use @deffn or
  10556. @c something more sensible.
  10557. @example
  10558. wildcard [option value][option value]...
  10559. where option is one of
  10560. -m update methodology value: MERGE or COPY
  10561. -k keyword expansion value: expansion mode
  10562. and value is a single-quote delimited value.
  10563. @end example
  10564. @ignore
  10565. @example
  10566. *.nib -f 'unwrap %s' -t 'wrap %s %s' -m 'COPY'
  10567. *.c -t 'indent %s %s'
  10568. @end example
  10569. @c When does the filter need to be an absolute pathname
  10570. @c and when will something like the above work? I
  10571. @c suspect it relates to the PATH of the server (which
  10572. @c in turn depends on all kinds of stuff, e.g. inetd
  10573. @c for pserver). I'm not sure whether/where to discuss
  10574. @c this.
  10575. @c FIXME: What do the %s's stand for?
  10576. @noindent
  10577. The above example of a @file{cvswrappers} file
  10578. states that all files/directories that end with a @code{.nib}
  10579. should be filtered with the @file{wrap} program before
  10580. checking the file into the repository. The file should
  10581. be filtered though the @file{unwrap} program when the
  10582. file is checked out of the repository. The
  10583. @file{cvswrappers} file also states that a @code{COPY}
  10584. methodology should be used when updating the files in
  10585. the repository (that is, no merging should be performed).
  10586. @c What pitfalls arise when using indent this way? Is
  10587. @c it a winning thing to do? Would be nice to at least
  10588. @c hint at those issues; we want our examples to tell
  10589. @c how to solve problems, not just to say that cvs can
  10590. @c do certain things.
  10591. The last example line says that all files that end with
  10592. @code{.c} should be filtered with @file{indent}
  10593. before being checked into the repository. Unlike the previous
  10594. example, no filtering of the @code{.c} file is done when
  10595. it is checked out of the repository.
  10596. @noindent
  10597. The @code{-t} filter is called with two arguments,
  10598. the first is the name of the file/directory to filter
  10599. and the second is the pathname to where the resulting
  10600. filtered file should be placed.
  10601. @noindent
  10602. The @code{-f} filter is called with one argument,
  10603. which is the name of the file to filter from. The end
  10604. result of this filter will be a file in the users directory
  10605. that they can work on as they normally would.
  10606. Note that the @samp{-t}/@samp{-f} features do not
  10607. conveniently handle one portion of @sc{cvs}'s operation:
  10608. determining when files are modified. @sc{cvs} will still
  10609. want a file (or directory) to exist, and it will use
  10610. its modification time to determine whether a file is
  10611. modified. If @sc{cvs} erroneously thinks a file is
  10612. unmodified (for example, a directory is unchanged but
  10613. one of the files within it is changed), you can force
  10614. it to check in the file anyway by specifying the
  10615. @samp{-f} option to @code{cvs commit} (@pxref{commit
  10616. options}).
  10617. @c This is, of course, a serious design flaw in -t/-f.
  10618. @c Probably the whole functionality needs to be
  10619. @c redesigned (starting from requirements) to fix this.
  10620. @end ignore
  10621. @c FIXME: We don't document -W or point to where it is
  10622. @c documented. Or .cvswrappers.
  10623. For example, the following command imports a
  10624. directory, treating files whose name ends in
  10625. @samp{.exe} as binary:
  10626. @example
  10627. cvs import -I ! -W "*.exe -k 'b'" first-dir vendortag reltag
  10628. @end example
  10629. @c Another good example, would be storing files
  10630. @c (e.g. binary files) compressed in the repository.
  10631. @c ::::::::::::::::::
  10632. @c cvswrappers
  10633. @c ::::::::::::::::::
  10634. @c *.t12 -m 'COPY'
  10635. @c *.t[0-9][0-9] -f 'gunzipcp %s' -t 'gzipcp %s %s' -m 'COPY'
  10636. @c
  10637. @c ::::::::::::::::::
  10638. @c gunzipcp
  10639. @c ::::::::::::::::::
  10640. @c :
  10641. @c [ -f $1 ] || exit 1
  10642. @c zcat $1 > /tmp/.#$1.$$
  10643. @c mv /tmp/.#$1.$$ $1
  10644. @c
  10645. @c ::::::::::::::::::
  10646. @c gzipcp
  10647. @c ::::::::::::::::::
  10648. @c :
  10649. @c DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
  10650. @c if [ ! -d $DIRNAME ] ; then
  10651. @c DIRNAME=`echo $1 | sed -e "s|.*/||g"`
  10652. @c fi
  10653. @c gzip -c $DIRNAME > $2
  10654. @c One catch--"cvs diff" will not invoke the wrappers
  10655. @c (probably a CVS bug, although I haven't thought it out).
  10656. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  10657. @node Trigger Scripts
  10658. @appendixsec The Trigger Scripts
  10659. @cindex Info files
  10660. @cindex Trigger scripts
  10661. Several of the administrative files support triggers, or the launching external
  10662. scripts or programs at specific times before or after particular events. The
  10663. individual files are discussed in the later sections, @ref{commit files} and
  10664. @ref{taginfo}, but some of the common elements are discussed here.
  10665. All the trigger scripts are launched in a copy of the user sandbox being
  10666. committed, on the server, in client-server mode. In local mode, the scripts
  10667. are actually launched directly from the user sandbox directory being committed.
  10668. For most intents and purposes, the same scripts can be run in both locations
  10669. without alteration.
  10670. @menu
  10671. * syntax:: The common syntax
  10672. * Trigger Script Security:: Trigger script security
  10673. @end menu
  10674. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  10675. @node syntax
  10676. @appendixsubsec The common syntax
  10677. @cindex Info files (syntax)
  10678. @cindex Syntax of info files
  10679. @cindex Common syntax of info files
  10680. @c FIXME: having this so totally separate from the
  10681. @c Variables node is rather bogus.
  10682. The administrative files such as @file{commitinfo},
  10683. @file{loginfo}, @file{rcsinfo}, @file{verifymsg}, etc.,
  10684. all have a common format. The purpose of the files are
  10685. described later on. The common syntax is described
  10686. here.
  10687. @cindex Regular expression syntax
  10688. Each line contains the following:
  10689. @itemize @bullet
  10690. @item
  10691. @c Say anything about DEFAULT and ALL? Right now we
  10692. @c leave that to the description of each file (and in fact
  10693. @c the practice is inconsistent which is really annoying).
  10694. A regular expression. This is a basic regular
  10695. expression in the syntax used by GNU emacs.
  10696. @c FIXME: What we probably should be saying is "POSIX Basic
  10697. @c Regular Expression with the following extensions (`\('
  10698. @c `\|' '+' etc)"
  10699. @c rather than define it with reference to emacs.
  10700. @c The reference to emacs is not strictly speaking
  10701. @c true, as we don't support \=, \s, or \S. Also it isn't
  10702. @c clear we should document and/or promise to continue to
  10703. @c support all the obscure emacs extensions like \<.
  10704. @c Also need to better cite (or include) full
  10705. @c documentation for the syntax.
  10706. @c Also see comment in configure.in about what happens to the
  10707. @c syntax if we pick up a system-supplied regexp matcher.
  10708. @item
  10709. A whitespace separator---one or more spaces and/or tabs.
  10710. @item
  10711. A file name or command-line template.
  10712. @end itemize
  10713. @noindent
  10714. Blank lines are ignored. Lines that start with the
  10715. character @samp{#} are treated as comments. Long lines
  10716. unfortunately can @emph{not} be broken in two parts in
  10717. any way.
  10718. The first regular expression that matches the current
  10719. directory name in the repository is used. The rest of the line
  10720. is used as a file name or command-line as appropriate.
  10721. @c FIXME: need an example. In particular, show what
  10722. @c the regular expression is matched against (one
  10723. @c ordinarily clueful person got confused about whether it
  10724. @c includes the filename--"directory name" above should be
  10725. @c unambiguous but there is nothing like an example to
  10726. @c confirm people's understanding of this sort of thing).
  10727. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  10728. @node Trigger Script Security
  10729. @appendixsubsec Security and the Trigger Scripts
  10730. @cindex Info files, security
  10731. @cindex Trigger scripts, security
  10732. Security is a huge subject, and implementing a secure system is a non-trivial
  10733. task. This section will barely touch on all the issues involved, but it is
  10734. well to note that, as with any script you will be allowing an untrusted
  10735. user to run on your server, there are measures you can take to help prevent
  10736. your trigger scripts from being abused.
  10737. For instance, since the CVS trigger scripts all run in a copy of the user's
  10738. sandbox on the server, a naively coded Perl trigger script which attempts to
  10739. use a Perl module that is not installed on the system can be hijacked by any
  10740. user with commit access who is checking in a file with the correct name. Other
  10741. scripting languages may be vulnerable to similar hacks.
  10742. One way to make a script more secure, at least with Perl, is to use scripts
  10743. which invoke the @code{-T}, or "taint-check" switch on their @code{#!} line.
  10744. In the most basic terms, this causes Perl to avoid running code that may have
  10745. come from an external source. Please run the @code{perldoc perlsec} command
  10746. for more on Perl security. Again, other languages may implement other security
  10747. verification hooks which look more or less like Perl's "taint-check" mechanism.
  10748. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10749. @node commit files
  10750. @appendixsec The commit support files
  10751. @cindex Committing, administrative support files
  10752. There are three kinds of trigger scripts (@pxref{Trigger Scripts}) that can be
  10753. run at various times during a commit. They are specified in files in the
  10754. repository, as described below. The following table summarizes the
  10755. file names and the purpose of the corresponding programs.
  10756. @table @file
  10757. @item commitinfo
  10758. The program is responsible for checking that the commit
  10759. is allowed. If it exits with a non-zero exit status
  10760. the commit will be aborted.
  10761. @item verifymsg
  10762. The specified program is used to evaluate the log message,
  10763. and possibly verify that it contains all required
  10764. fields. This is most useful in combination with the
  10765. @file{rcsinfo} file, which can hold a log message
  10766. template (@pxref{rcsinfo}).
  10767. @item editinfo
  10768. The specified program is used to edit the log message,
  10769. and possibly verify that it contains all required
  10770. fields. This is most useful in combination with the
  10771. @file{rcsinfo} file, which can hold a log message
  10772. template (@pxref{rcsinfo}). (obsolete)
  10773. @item loginfo
  10774. The specified program is called when the commit is
  10775. complete. It receives the log message and some
  10776. additional information and can store the log message in
  10777. a file, or mail it to appropriate persons, or maybe
  10778. post it to a local newsgroup, or@dots{} Your
  10779. imagination is the limit!
  10780. @end table
  10781. @menu
  10782. * commitinfo:: Pre-commit checking
  10783. * verifymsg:: How are log messages evaluated?
  10784. * editinfo:: Specifying how log messages are created
  10785. (obsolete)
  10786. * loginfo:: Where should log messages be sent?
  10787. @end menu
  10788. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10789. @node commitinfo
  10790. @appendixsubsec Commitinfo
  10791. @cindex @file{commitinfo}
  10792. @cindex Commits, precommit verification of
  10793. @cindex Precommit checking
  10794. The @file{commitinfo} file defines programs to execute
  10795. whenever @samp{cvs commit} is about to execute. These
  10796. programs are used for pre-commit checking to verify
  10797. that the modified, added and removed files are really
  10798. ready to be committed. This could be used, for
  10799. instance, to verify that the changed files conform to
  10800. to your site's standards for coding practice.
  10801. As mentioned earlier, each line in the
  10802. @file{commitinfo} file consists of a regular expression
  10803. and a command-line template. The template can include
  10804. a program name and any number of arguments you wish to
  10805. supply to it. The full path to the current source
  10806. repository is appended to the template, followed by the
  10807. file names of any files involved in the commit (added,
  10808. removed, and modified files).
  10809. @cindex Exit status, of commitinfo
  10810. The first line with a regular expression matching the
  10811. directory within the repository will be used. If the
  10812. command returns a non-zero exit status the commit will
  10813. be aborted.
  10814. @c FIXME: need example(s) of what "directory within the
  10815. @c repository" means.
  10816. @cindex DEFAULT in commitinfo
  10817. If the repository name does not match any of the
  10818. regular expressions in this file, the @samp{DEFAULT}
  10819. line is used, if it is specified.
  10820. @cindex ALL in commitinfo
  10821. All occurrences of the name @samp{ALL} appearing as a
  10822. regular expression are used in addition to the first
  10823. matching regular expression or the name @samp{DEFAULT}.
  10824. @cindex @file{commitinfo}, working directory
  10825. @cindex @file{commitinfo}, command environment
  10826. The command will be run in the root of the workspace
  10827. containing the new versions of any files the user would like
  10828. to modify (commit), @emph{or in a copy of the workspace on
  10829. the server (@pxref{Remote repositories})}. If a file is
  10830. being removed, there will be no copy of the file under the
  10831. current directory. If a file is being added, there will be
  10832. no corresponding archive file in the repository unless the
  10833. file is being resurrected.
  10834. Note that both the repository directory and the corresponding
  10835. Attic (@pxref{Attic}) directory may need to be checked to
  10836. locate the archive file corresponding to any given file being
  10837. committed. Much of the information about the specific commit
  10838. request being made, including the destination branch, commit
  10839. message, and command line options specified, is not available
  10840. to the command.
  10841. @c FIXME: should discuss using commitinfo to control
  10842. @c who has checkin access to what (e.g. Joe can check into
  10843. @c directories a, b, and c, and Mary can check into
  10844. @c directories b, c, and d--note this case cannot be
  10845. @c conveniently handled with unix groups). Of course,
  10846. @c adding a new set of features to CVS might be a more
  10847. @c natural way to fix this problem than telling people to
  10848. @c use commitinfo.
  10849. @c FIXME: Should make some reference, especially in
  10850. @c the context of controlling who has access, to the fact
  10851. @c that commitinfo can be circumvented. Perhaps
  10852. @c mention SETXID (but has it been carefully examined
  10853. @c for holes?). This fits in with the discussion of
  10854. @c general CVS security in "Password authentication
  10855. @c security" (the bit which is not pserver-specific).
  10856. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10857. @node verifymsg
  10858. @appendixsubsec Verifying log messages
  10859. @cindex @file{verifymsg} (admin file)
  10860. @cindex Log message, verifying
  10861. Once you have entered a log message, you can evaluate
  10862. that message to check for specific content, such as
  10863. a bug ID. Use the @file{verifymsg} file to
  10864. specify a program that is used to verify the log message.
  10865. This program could be a simple script that checks
  10866. that the entered message contains the required fields.
  10867. The @file{verifymsg} file is often most useful together
  10868. with the @file{rcsinfo} file, which can be used to
  10869. specify a log message template.
  10870. Each line in the @file{verifymsg} file consists of a
  10871. regular expression and a command-line template. The
  10872. template must include a program name, and can include
  10873. any number of arguments. The full path to the current
  10874. log message template file is appended to the template.
  10875. One thing that should be noted is that the @samp{ALL}
  10876. keyword is not supported. If more than one matching
  10877. line is found, the first one is used. This can be
  10878. useful for specifying a default verification script in a
  10879. directory, and then overriding it in a subdirectory.
  10880. @cindex DEFAULT in @file{verifymsg}
  10881. If the repository name does not match any of the
  10882. regular expressions in this file, the @samp{DEFAULT}
  10883. line is used, if it is specified.
  10884. @cindex Exit status, of @file{verifymsg}
  10885. If the verification script exits with a non-zero exit status,
  10886. the commit is aborted.
  10887. @cindex @file{verifymsg}, changing the log message
  10888. In the default configuration, CVS allows the
  10889. verification script to change the log message. This is
  10890. controlled via the RereadLogAfterVerify CVSROOT/config
  10891. option.
  10892. When @samp{RereadLogAfterVerify=always} or
  10893. @samp{RereadLogAfterVerify=stat}, the log message will
  10894. either always be reread after the verification script
  10895. is run or reread only if the log message file status
  10896. has changed.
  10897. @xref{config}, for more on CVSROOT/config options.
  10898. It is NOT a good idea for a @file{verifymsg} script to
  10899. interact directly with the user in the various
  10900. client/server methods. For the @code{pserver} method,
  10901. there is no protocol support for communicating between
  10902. @file{verifymsg} and the client on the remote end. For the
  10903. @code{ext} and @code{server} methods, it is possible
  10904. for CVS to become confused by the characters going
  10905. along the same channel as the CVS protocol
  10906. messages. See @ref{Remote repositories}, for more
  10907. information on client/server setups. In addition, at the time
  10908. the @file{verifymsg} script runs, the CVS
  10909. server has locks in place in the repository. If control is
  10910. returned to the user here then other users may be stuck waiting
  10911. for access to the repository.
  10912. This option can be useful if you find yourself using an
  10913. rcstemplate that needs to be modified to remove empty
  10914. elements or to fill in default values. It can also be
  10915. useful if the rcstemplate has changed in the repository
  10916. and the CVS/Template was not updated, but is able to be
  10917. adapted to the new format by the verification script
  10918. that is run by @file{verifymsg}.
  10919. An example of an update might be to change all
  10920. occurrences of 'BugId:' to be 'DefectId:' (which can be
  10921. useful if the rcstemplate has recently been changed and
  10922. there are still checked-out user trees with cached
  10923. copies in the CVS/Template file of the older version).
  10924. Another example of an update might be to delete a line
  10925. that contains 'BugID: none' from the log message after
  10926. validation of that value as being allowed is made.
  10927. The following is a little silly example of a
  10928. @file{verifymsg} file, together with the corresponding
  10929. @file{rcsinfo} file, the log message template and an
  10930. verification script. We begin with the log message template.
  10931. We want to always record a bug-id number on the first
  10932. line of the log message. The rest of log message is
  10933. free text. The following template is found in the file
  10934. @file{/usr/cvssupport/tc.template}.
  10935. @example
  10936. BugId:
  10937. @end example
  10938. The script @file{/usr/cvssupport/bugid.verify} is used to
  10939. evaluate the log message.
  10940. @example
  10941. #!/bin/sh
  10942. #
  10943. # bugid.verify filename
  10944. #
  10945. # Verify that the log message contains a valid bugid
  10946. # on the first line.
  10947. #
  10948. if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
  10949. exit 0
  10950. elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
  10951. # It is okay to allow commits with 'BugId: none',
  10952. # but do not put that text into the real log message.
  10953. grep -v '^BugId:[ ]*none$' > $1.rewrite
  10954. mv $1.rewrite $1
  10955. exit 0
  10956. else
  10957. echo "No BugId found."
  10958. exit 1
  10959. fi
  10960. @end example
  10961. The @file{verifymsg} file contains this line:
  10962. @example
  10963. ^tc /usr/cvssupport/bugid.verify
  10964. @end example
  10965. The @file{rcsinfo} file contains this line:
  10966. @example
  10967. ^tc /usr/cvssupport/tc.template
  10968. @end example
  10969. The @file{config} file contains this line:
  10970. @example
  10971. RereadLogAfterVerify=always
  10972. @end example
  10973. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10974. @node editinfo
  10975. @appendixsubsec Editinfo
  10976. @cindex editinfo (admin file)
  10977. @cindex Editor, specifying per module
  10978. @cindex Per-module editor
  10979. @cindex Log messages, editing
  10980. @strong{The @file{editinfo} feature has been
  10981. rendered obsolete. To set a default editor for log
  10982. messages use the @code{CVSEDITOR}, @code{EDITOR} environment variables
  10983. (@pxref{Environment variables}) or the @samp{-e} global
  10984. option (@pxref{Global options}). See @ref{verifymsg},
  10985. for information on the use of the @file{verifymsg}
  10986. feature for evaluating log messages.}
  10987. If you want to make sure that all log messages look the
  10988. same way, you can use the @file{editinfo} file to
  10989. specify a program that is used to edit the log message.
  10990. This program could be a custom-made editor that always
  10991. enforces a certain style of the log message, or maybe a
  10992. simple shell script that calls an editor, and checks
  10993. that the entered message contains the required fields.
  10994. If no matching line is found in the @file{editinfo}
  10995. file, the editor specified in the environment variable
  10996. @code{$CVSEDITOR} is used instead. If that variable is
  10997. not set, then the environment variable @code{$EDITOR}
  10998. is used instead. If that variable is not
  10999. set a default will be used. See @ref{Committing your changes}.
  11000. The @file{editinfo} file is often most useful together
  11001. with the @file{rcsinfo} file, which can be used to
  11002. specify a log message template.
  11003. Each line in the @file{editinfo} file consists of a
  11004. regular expression and a command-line template. The
  11005. template must include a program name, and can include
  11006. any number of arguments. The full path to the current
  11007. log message template file is appended to the template.
  11008. One thing that should be noted is that the @samp{ALL}
  11009. keyword is not supported. If more than one matching
  11010. line is found, the first one is used. This can be
  11011. useful for specifying a default edit script in a
  11012. module, and then overriding it in a subdirectory.
  11013. @cindex DEFAULT in editinfo
  11014. If the repository name does not match any of the
  11015. regular expressions in this file, the @samp{DEFAULT}
  11016. line is used, if it is specified.
  11017. If the edit script exits with a non-zero exit status,
  11018. the commit is aborted.
  11019. Note: when @sc{cvs} is accessing a remote repository,
  11020. or when the @samp{-m} or @samp{-F} options to @code{cvs
  11021. commit} are used, @file{editinfo} will not be consulted.
  11022. There is no good workaround for this; use
  11023. @file{verifymsg} instead.
  11024. @menu
  11025. * editinfo example:: Editinfo example
  11026. @end menu
  11027. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  11028. @node editinfo example
  11029. @appendixsubsubsec Editinfo example
  11030. The following is a little silly example of a
  11031. @file{editinfo} file, together with the corresponding
  11032. @file{rcsinfo} file, the log message template and an
  11033. editor script. We begin with the log message template.
  11034. We want to always record a bug-id number on the first
  11035. line of the log message. The rest of log message is
  11036. free text. The following template is found in the file
  11037. @file{/usr/cvssupport/tc.template}.
  11038. @example
  11039. BugId:
  11040. @end example
  11041. The script @file{/usr/cvssupport/bugid.edit} is used to
  11042. edit the log message.
  11043. @example
  11044. #!/bin/sh
  11045. #
  11046. # bugid.edit filename
  11047. #
  11048. # Call $EDITOR on FILENAME, and verify that the
  11049. # resulting file contains a valid bugid on the first
  11050. # line.
  11051. if [ "x$EDITOR" = "x" ]; then EDITOR=vi; fi
  11052. if [ "x$CVSEDITOR" = "x" ]; then CVSEDITOR=$EDITOR; fi
  11053. $CVSEDITOR $1
  11054. until head -1|grep '^BugId:[ ]*[0-9][0-9]*$' < $1
  11055. do echo -n "No BugId found. Edit again? ([y]/n)"
  11056. read ans
  11057. case $@{ans@} in
  11058. n*) exit 1;;
  11059. esac
  11060. $CVSEDITOR $1
  11061. done
  11062. @end example
  11063. The @file{editinfo} file contains this line:
  11064. @example
  11065. ^tc /usr/cvssupport/bugid.edit
  11066. @end example
  11067. The @file{rcsinfo} file contains this line:
  11068. @example
  11069. ^tc /usr/cvssupport/tc.template
  11070. @end example
  11071. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11072. @node loginfo
  11073. @appendixsubsec Loginfo
  11074. @cindex loginfo (admin file)
  11075. @cindex Storing log messages
  11076. @cindex Mailing log messages
  11077. @cindex Distributing log messages
  11078. @cindex Log messages
  11079. @c "cvs commit" is not quite right. What we
  11080. @c mean is "when the repository gets changed" which
  11081. @c also includes "cvs import" and "cvs add" on a directory.
  11082. The @file{loginfo} file is used to control where
  11083. @samp{cvs commit} log information is sent. The first
  11084. entry on a line is a regular expression which is tested
  11085. against the directory that the change is being made to,
  11086. relative to the @code{$CVSROOT}. If a match is found, then
  11087. the remainder of the line is a filter program that
  11088. should expect log information on its standard input.
  11089. Note that the filter program @strong{must} read @strong{all}
  11090. of the log information or @sc{cvs} may fail with a broken pipe signal.
  11091. If the repository name does not match any of the
  11092. regular expressions in this file, the @samp{DEFAULT}
  11093. line is used, if it is specified.
  11094. All occurrences of the name @samp{ALL} appearing as a
  11095. regular expression are used in addition to the first
  11096. matching regular expression or @samp{DEFAULT}.
  11097. The first matching regular expression is used.
  11098. @xref{commit files}, for a description of the syntax of
  11099. the @file{loginfo} file.
  11100. The user may specify a format string as
  11101. part of the filter. The string is composed of a
  11102. @samp{%} followed by a space, or followed by a single
  11103. format character, or followed by a set of format
  11104. characters surrounded by @samp{@{} and @samp{@}} as
  11105. separators. The format characters are:
  11106. @table @t
  11107. @item s
  11108. file name
  11109. @item V
  11110. old version number (pre-checkin)
  11111. @item v
  11112. new version number (post-checkin)
  11113. @end table
  11114. All other characters that appear in a format string
  11115. expand to an empty field (commas separating fields are
  11116. still provided).
  11117. For example, some valid format strings are @samp{%},
  11118. @samp{%s}, @samp{%@{s@}}, and @samp{%@{sVv@}}.
  11119. The output will be a space separated string of tokens enclosed in
  11120. quotation marks (@t{"}).
  11121. Any embedded dollar signs (@t{$}), backticks (@t{`}),
  11122. backslashes (@t{\}), or quotation marks will be preceded
  11123. by a backslash (this allows the shell to correctly parse it
  11124. as a single string, reguardless of the characters it contains).
  11125. For backwards compatibility, the first
  11126. token will be the repository subdirectory. The rest of the
  11127. tokens will be comma-delimited lists of the information
  11128. requested in the format string. For example, if
  11129. @samp{/u/src/master/yoyodyne/tc} is the repository, @samp{%@{sVv@}}
  11130. is the format string, and three files (@t{ChangeLog},
  11131. @t{Makefile}, @t{foo.c}) were modified, the output
  11132. might be:
  11133. @example
  11134. "yoyodyne/tc ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13"
  11135. @end example
  11136. As another example, @samp{%@{@}} means that only the
  11137. name of the repository will be generated.
  11138. Note: when @sc{cvs} is accessing a remote repository,
  11139. @file{loginfo} will be run on the @emph{remote}
  11140. (i.e., server) side, not the client side (@pxref{Remote
  11141. repositories}).
  11142. @menu
  11143. * loginfo example:: Loginfo example
  11144. * Keeping a checked out copy:: Updating a tree on every checkin
  11145. @end menu
  11146. @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  11147. @node loginfo example
  11148. @appendixsubsubsec Loginfo example
  11149. The following @file{loginfo} file, together with the
  11150. tiny shell-script below, appends all log messages
  11151. to the file @file{$CVSROOT/CVSROOT/commitlog},
  11152. and any commits to the administrative files (inside
  11153. the @file{CVSROOT} directory) are also logged in
  11154. @file{/usr/adm/cvsroot-log}.
  11155. Commits to the @file{prog1} directory are mailed to @t{ceder}.
  11156. @c FIXME: is it a CVS feature or bug that only the
  11157. @c first matching line is used? It is documented
  11158. @c above, but is it useful? For example, if we wanted
  11159. @c to run both "cvs-log" and "Mail" for the CVSROOT
  11160. @c directory, it is kind of awkward if
  11161. @c only the first matching line is used.
  11162. @example
  11163. ALL /usr/local/bin/cvs-log $CVSROOT/CVSROOT/commitlog $USER
  11164. ^CVSROOT /usr/local/bin/cvs-log /usr/adm/cvsroot-log
  11165. ^prog1 Mail -s %s ceder
  11166. @end example
  11167. The shell-script @file{/usr/local/bin/cvs-log} looks
  11168. like this:
  11169. @example
  11170. #!/bin/sh
  11171. (echo "------------------------------------------------------";
  11172. echo -n $2" ";
  11173. date;
  11174. echo;
  11175. cat) >> $1
  11176. @end example
  11177. @node Keeping a checked out copy
  11178. @appendixsubsubsec Keeping a checked out copy
  11179. @c What other index entries? It seems like
  11180. @c people might want to use a lot of different
  11181. @c words for this functionality.
  11182. @cindex Keeping a checked out copy
  11183. @cindex Checked out copy, keeping
  11184. @cindex Web pages, maintaining with CVS
  11185. It is often useful to maintain a directory tree which
  11186. contains files which correspond to the latest version
  11187. in the repository. For example, other developers might
  11188. want to refer to the latest sources without having to
  11189. check them out, or you might be maintaining a web site
  11190. with @sc{cvs} and want every checkin to cause the files
  11191. used by the web server to be updated.
  11192. @c Can we offer more details on the web example? Or
  11193. @c point the user at how to figure it out? This text
  11194. @c strikes me as sufficient for someone who already has
  11195. @c some idea of what we mean but not enough for the naive
  11196. @c user/sysadmin to understand it and set it up.
  11197. The way to do this is by having loginfo invoke
  11198. @code{cvs update}. Doing so in the naive way will
  11199. cause a problem with locks, so the @code{cvs update}
  11200. must be run in the background.
  11201. @c Should we try to describe the problem with locks?
  11202. @c It seems like a digression for someone who just
  11203. @c wants to know how to make it work.
  11204. @c Another choice which might work for a single file
  11205. @c is to use "cvs -n update -p" which doesn't take
  11206. @c out locks (I think) but I don't see many advantages
  11207. @c of that and we might as well document something which
  11208. @c works for multiple files.
  11209. Here is an example for unix (this should all be on one line):
  11210. @example
  11211. ^cyclic-pages (date; cat; (sleep 2; cd /u/www/local-docs;
  11212. cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1
  11213. @end example
  11214. This will cause checkins to repository directories
  11215. starting with @code{cyclic-pages} to update the checked
  11216. out tree in @file{/u/www/local-docs}.
  11217. @c More info on some of the details? The "sleep 2" is
  11218. @c so if we are lucky the lock will be gone by the time
  11219. @c we start and we can wait 2 seconds instead of 30.
  11220. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11221. @node rcsinfo
  11222. @appendixsec Rcsinfo
  11223. @cindex rcsinfo (admin file)
  11224. @cindex Form for log message
  11225. @cindex Log message template
  11226. @cindex Template for log message
  11227. The @file{rcsinfo} file can be used to specify a form to
  11228. edit when filling out the commit log. The
  11229. @file{rcsinfo} file has a syntax similar to the
  11230. @file{verifymsg}, @file{commitinfo} and @file{loginfo}
  11231. files. @xref{syntax}. Unlike the other files the second
  11232. part is @emph{not} a command-line template. Instead,
  11233. the part after the regular expression should be a full pathname to
  11234. a file containing the log message template.
  11235. If the repository name does not match any of the
  11236. regular expressions in this file, the @samp{DEFAULT}
  11237. line is used, if it is specified.
  11238. All occurrences of the name @samp{ALL} appearing as a
  11239. regular expression are used in addition to the first
  11240. matching regular expression or @samp{DEFAULT}.
  11241. @c FIXME: should be offering advice, somewhere around
  11242. @c here, about where to put the template file. The
  11243. @c verifymsg example uses /usr/cvssupport but doesn't
  11244. @c say anything about what that directory is for or
  11245. @c whether it is hardwired into CVS or who creates
  11246. @c it or anything. In particular we should say
  11247. @c how to version control the template file. A
  11248. @c probably better answer than the /usr/cvssupport
  11249. @c stuff is to use checkoutlist (with xref to the
  11250. @c checkoutlist doc).
  11251. @c Also I am starting to see a connection between
  11252. @c this and the Keeping a checked out copy node.
  11253. @c Probably want to say something about that.
  11254. The log message template will be used as a default log
  11255. message. If you specify a log message with @samp{cvs
  11256. commit -m @var{message}} or @samp{cvs commit -f
  11257. @var{file}} that log message will override the
  11258. template.
  11259. @xref{verifymsg}, for an example @file{rcsinfo}
  11260. file.
  11261. When @sc{cvs} is accessing a remote repository,
  11262. the contents of @file{rcsinfo} at the time a directory
  11263. is first checked out will specify a template which does
  11264. not then change. If you edit @file{rcsinfo} or its
  11265. templates, you may need to check out a new working
  11266. directory.
  11267. @c Would be nice to fix CVS so this isn't needed. For
  11268. @c example, a mechanism analogous to CVS/Entries, where
  11269. @c the client keeps track of what version of the template
  11270. @c it has.
  11271. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11272. @node taginfo
  11273. @appendixsec Taginfo
  11274. @cindex taginfo (admin file)
  11275. @cindex Tags, logging
  11276. @cindex Tags, verifying
  11277. The @file{taginfo} file defines programs to execute
  11278. when someone executes a @code{tag} or @code{rtag}
  11279. command. The @file{taginfo} file has the standard form
  11280. for trigger scripts (@pxref{Trigger Scripts}),
  11281. where each line is a regular expression
  11282. followed by a command to execute (@pxref{syntax}). The arguments passed
  11283. to the command are, in order, the @var{tagname},
  11284. @var{operation} (@code{add} for @code{tag},
  11285. @code{mov} for @code{tag -F}, and @code{del} for
  11286. @code{tag -d}), @var{repository}, and any remaining are
  11287. pairs of @var{filename} @var{revision}. A non-zero
  11288. exit of the filter program will cause the tag to be
  11289. aborted.
  11290. Here is an example of using the @file{taginfo} file
  11291. to log @code{tag} and @code{rtag}
  11292. commands. In the @file{taginfo} file put:
  11293. @example
  11294. ALL /usr/local/cvsroot/CVSROOT/loggit
  11295. @end example
  11296. @noindent
  11297. Where @file{/usr/local/cvsroot/CVSROOT/loggit} contains the
  11298. following script:
  11299. @example
  11300. #!/bin/sh
  11301. echo "$@@" >>/home/kingdon/cvsroot/CVSROOT/taglog
  11302. @end example
  11303. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11304. @node cvsignore
  11305. @appendixsec Ignoring files via cvsignore
  11306. @cindex cvsignore (admin file), global
  11307. @cindex Global cvsignore
  11308. @cindex Ignoring files
  11309. @c -- This chapter should maybe be moved to the
  11310. @c tutorial part of the manual?
  11311. There are certain file names that frequently occur
  11312. inside your working copy, but that you don't want to
  11313. put under @sc{cvs} control. Examples are all the object
  11314. files that you get while you compile your sources.
  11315. Normally, when you run @samp{cvs update}, it prints a
  11316. line for each file it encounters that it doesn't know
  11317. about (@pxref{update output}).
  11318. @sc{cvs} has a list of files (or sh(1) file name patterns)
  11319. that it should ignore while running @code{update},
  11320. @code{import} and @code{release}.
  11321. @c -- Are those the only three commands affected?
  11322. This list is constructed in the following way.
  11323. @itemize @bullet
  11324. @item
  11325. The list is initialized to include certain file name
  11326. patterns: names associated with @sc{cvs}
  11327. administration, or with other common source control
  11328. systems; common names for patch files, object files,
  11329. archive files, and editor backup files; and other names
  11330. that are usually artifacts of assorted utilities.
  11331. Currently, the default list of ignored file name
  11332. patterns is:
  11333. @cindex Ignored files
  11334. @cindex Automatically ignored files
  11335. @example
  11336. RCS SCCS CVS CVS.adm
  11337. RCSLOG cvslog.*
  11338. tags TAGS
  11339. .make.state .nse_depinfo
  11340. *~ #* .#* ,* _$* *$
  11341. *.old *.bak *.BAK *.orig *.rej .del-*
  11342. *.a *.olb *.o *.obj *.so *.exe
  11343. *.Z *.elc *.ln
  11344. core
  11345. @end example
  11346. @item
  11347. The per-repository list in
  11348. @file{$CVSROOT/CVSROOT/cvsignore} is appended to
  11349. the list, if that file exists.
  11350. @item
  11351. The per-user list in @file{.cvsignore} in your home
  11352. directory is appended to the list, if it exists.
  11353. @item
  11354. Any entries in the environment variable
  11355. @code{$CVSIGNORE} is appended to the list.
  11356. @item
  11357. Any @samp{-I} options given to @sc{cvs} is appended.
  11358. @item
  11359. As @sc{cvs} traverses through your directories, the contents
  11360. of any @file{.cvsignore} will be appended to the list.
  11361. The patterns found in @file{.cvsignore} are only valid
  11362. for the directory that contains them, not for
  11363. any sub-directories.
  11364. @end itemize
  11365. In any of the 5 places listed above, a single
  11366. exclamation mark (@samp{!}) clears the ignore list.
  11367. This can be used if you want to store any file which
  11368. normally is ignored by @sc{cvs}.
  11369. Specifying @samp{-I !} to @code{cvs import} will import
  11370. everything, which is generally what you want to do if
  11371. you are importing files from a pristine distribution or
  11372. any other source which is known to not contain any
  11373. extraneous files. However, looking at the rules above
  11374. you will see there is a fly in the ointment; if the
  11375. distribution contains any @file{.cvsignore} files, then
  11376. the patterns from those files will be processed even if
  11377. @samp{-I !} is specified. The only workaround is to
  11378. remove the @file{.cvsignore} files in order to do the
  11379. import. Because this is awkward, in the future
  11380. @samp{-I !} might be modified to override
  11381. @file{.cvsignore} files in each directory.
  11382. Note that the syntax of the ignore files consists of a
  11383. series of lines, each of which contains a space
  11384. separated list of filenames. This offers no clean way
  11385. to specify filenames which contain spaces, but you can
  11386. use a workaround like @file{foo?bar} to match a file
  11387. named @file{foo bar} (it also matches @file{fooxbar}
  11388. and the like). Also note that there is currently no
  11389. way to specify comments.
  11390. @c FIXCVS? I don't _like_ this syntax at all, but
  11391. @c changing it raises all the usual compatibility
  11392. @c issues and I'm also not sure what to change it to.
  11393. @node checkoutlist
  11394. @appendixsec The checkoutlist file
  11395. @cindex checkoutlist
  11396. It may be helpful to use @sc{cvs} to maintain your own
  11397. files in the @file{CVSROOT} directory. For example,
  11398. suppose that you have a script @file{logcommit.pl}
  11399. which you run by including the following line in the
  11400. @file{commitinfo} administrative file:
  11401. @example
  11402. ALL $CVSROOT/CVSROOT/logcommit.pl
  11403. @end example
  11404. To maintain @file{logcommit.pl} with @sc{cvs} you would
  11405. add the following line to the @file{checkoutlist}
  11406. administrative file:
  11407. @example
  11408. logcommit.pl
  11409. @end example
  11410. The format of @file{checkoutlist} is one line for each
  11411. file that you want to maintain using @sc{cvs}, giving
  11412. the name of the file, followed optionally by more whitespace
  11413. and any error message that should print if the file cannot be
  11414. checked out into CVSROOT after a commit:
  11415. @example
  11416. logcommit.pl Could not update CVSROOT/logcommit.pl.
  11417. @end example
  11418. After setting up @file{checkoutlist} in this fashion,
  11419. the files listed there will function just like
  11420. @sc{cvs}'s built-in administrative files. For example,
  11421. when checking in one of the files you should get a
  11422. message such as:
  11423. @example
  11424. cvs commit: Rebuilding administrative file database
  11425. @end example
  11426. @noindent
  11427. and the checked out copy in the @file{CVSROOT}
  11428. directory should be updated.
  11429. Note that listing @file{passwd} (@pxref{Password
  11430. authentication server}) in @file{checkoutlist} is not
  11431. recommended for security reasons.
  11432. For information about keeping a checkout out copy in a
  11433. more general context than the one provided by
  11434. @file{checkoutlist}, see @ref{Keeping a checked out
  11435. copy}.
  11436. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11437. @node history file
  11438. @appendixsec The history file
  11439. @cindex History file
  11440. @cindex Log information, saving
  11441. The file @file{$CVSROOT/CVSROOT/history} is used
  11442. to log information for the @code{history} command
  11443. (@pxref{history}). This file must be created to turn
  11444. on logging. This is done automatically if the
  11445. @code{cvs init} command is used to set up the
  11446. repository (@pxref{Creating a repository}).
  11447. The file format of the @file{history} file is
  11448. documented only in comments in the @sc{cvs} source
  11449. code, but generally programs should use the @code{cvs
  11450. history} command to access it anyway, in case the
  11451. format changes with future releases of @sc{cvs}.
  11452. @node Variables
  11453. @appendixsec Expansions in administrative files
  11454. @cindex Internal variables
  11455. @cindex Variables
  11456. Sometimes in writing an administrative file, you might
  11457. want the file to be able to know various things based
  11458. on environment @sc{cvs} is running in. There are
  11459. several mechanisms to do that.
  11460. To find the home directory of the user running @sc{cvs}
  11461. (from the @code{HOME} environment variable), use
  11462. @samp{~} followed by @samp{/} or the end of the line.
  11463. Likewise for the home directory of @var{user}, use
  11464. @samp{~@var{user}}. These variables are expanded on
  11465. the server machine, and don't get any reasonable
  11466. expansion if pserver (@pxref{Password authenticated})
  11467. is in use; therefore user variables (see below) may be
  11468. a better choice to customize behavior based on the user
  11469. running @sc{cvs}.
  11470. @c Based on these limitations, should we deprecate ~?
  11471. @c What is it good for? Are people using it?
  11472. One may want to know about various pieces of
  11473. information internal to @sc{cvs}. A @sc{cvs} internal
  11474. variable has the syntax @code{$@{@var{variable}@}},
  11475. where @var{variable} starts with a letter and consists
  11476. of alphanumeric characters and @samp{_}. If the
  11477. character following @var{variable} is a
  11478. non-alphanumeric character other than @samp{_}, the
  11479. @samp{@{} and @samp{@}} can be omitted. The @sc{cvs}
  11480. internal variables are:
  11481. @table @code
  11482. @item CVSROOT
  11483. @cindex CVSROOT, internal variable
  11484. This is the absolute path to the current @sc{cvs} root directory.
  11485. @xref{Repository}, for a description of the various
  11486. ways to specify this, but note that the internal
  11487. variable contains just the directory and not any
  11488. of the access method information.
  11489. @item RCSBIN
  11490. @cindex RCSBIN, internal variable
  11491. In @sc{cvs} 1.9.18 and older, this specified the
  11492. directory where @sc{cvs} was looking for @sc{rcs}
  11493. programs. Because @sc{cvs} no longer runs @sc{rcs}
  11494. programs, specifying this internal variable is now an
  11495. error.
  11496. @item CVSEDITOR
  11497. @cindex CVSEDITOR, internal variable
  11498. @itemx EDITOR
  11499. @cindex EDITOR, internal variable
  11500. @itemx VISUAL
  11501. @cindex VISUAL, internal variable
  11502. These all expand to the same value, which is the editor
  11503. that @sc{cvs} is using. @xref{Global options}, for how
  11504. to specify this.
  11505. @item USER
  11506. @cindex USER, internal variable
  11507. Username of the user running @sc{cvs} (on the @sc{cvs}
  11508. server machine).
  11509. When using pserver, this is the user specified in the repository
  11510. specification which need not be the same as the username the
  11511. server is running as (@pxref{Password authentication server}).
  11512. Do not confuse this with the environment variable of the same name.
  11513. @end table
  11514. If you want to pass a value to the administrative files
  11515. which the user who is running @sc{cvs} can specify,
  11516. use a user variable.
  11517. @cindex User variables
  11518. To expand a user variable, the
  11519. administrative file contains
  11520. @code{$@{=@var{variable}@}}. To set a user variable,
  11521. specify the global option @samp{-s} to @sc{cvs}, with
  11522. argument @code{@var{variable}=@var{value}}. It may be
  11523. particularly useful to specify this option via
  11524. @file{.cvsrc} (@pxref{~/.cvsrc}).
  11525. For example, if you want the administrative file to
  11526. refer to a test directory you might create a user
  11527. variable @code{TESTDIR}. Then if @sc{cvs} is invoked
  11528. as
  11529. @example
  11530. cvs -s TESTDIR=/work/local/tests
  11531. @end example
  11532. @noindent
  11533. and the
  11534. administrative file contains @code{sh
  11535. $@{=TESTDIR@}/runtests}, then that string is expanded
  11536. to @code{sh /work/local/tests/runtests}.
  11537. All other strings containing @samp{$} are reserved;
  11538. there is no way to quote a @samp{$} character so that
  11539. @samp{$} represents itself.
  11540. Environment variables passed to administrative files are:
  11541. @table @code
  11542. @cindex environment variables, passed to administrative files
  11543. @item CVS_USER
  11544. @cindex CVS_USER, environment variable
  11545. The @sc{cvs}-specific username provided by the user, if it
  11546. can be provided (currently just for the pserver access
  11547. method), and to the empty string otherwise. (@code{CVS_USER}
  11548. and @code{USER} may differ when @file{$CVSROOT/CVSROOT/passwd}
  11549. is used to map @sc{cvs} usernames to system usernames.)
  11550. @item LOGNAME
  11551. @cindex LOGNAME, environment variable
  11552. The username of the system user.
  11553. @item USER
  11554. @cindex USER, environment variable
  11555. Same as @code{LOGNAME}.
  11556. Do not confuse this with the internal variable of the same name.
  11557. @end table
  11558. @node config
  11559. @appendixsec The CVSROOT/config configuration file
  11560. @cindex config, in CVSROOT
  11561. @cindex CVSROOT/config
  11562. The administrative file @file{config} contains various
  11563. miscellaneous settings which affect the behavior of
  11564. @sc{cvs}. The syntax is slightly different from the
  11565. other administrative files. Variables are not
  11566. expanded. Lines which start with @samp{#} are
  11567. considered comments.
  11568. @c FIXME: where do we define comments for the other
  11569. @c administrative files.
  11570. Other lines consist of a keyword, @samp{=}, and a
  11571. value. Note that this syntax is very strict.
  11572. Extraneous spaces or tabs are not permitted.
  11573. @c See comments in parseinfo.c:parse_config for more
  11574. @c discussion of this strictness.
  11575. Currently defined keywords are:
  11576. @table @code
  11577. @cindex RCSBIN, in CVSROOT/config
  11578. @item RCSBIN=@var{bindir}
  11579. For @sc{cvs} 1.9.12 through 1.9.18, this setting told
  11580. @sc{cvs} to look for @sc{rcs} programs in the
  11581. @var{bindir} directory. Current versions of @sc{cvs}
  11582. do not run @sc{rcs} programs; for compatibility this
  11583. setting is accepted, but it does nothing.
  11584. @cindex SystemAuth, in CVSROOT/config
  11585. @item SystemAuth=@var{value}
  11586. If @var{value} is @samp{yes}, then pserver should check
  11587. for users in the system's user database if not found in
  11588. @file{CVSROOT/passwd}. If it is @samp{no}, then all
  11589. pserver users must exist in @file{CVSROOT/passwd}.
  11590. The default is @samp{yes}. For more on pserver, see
  11591. @ref{Password authenticated}.
  11592. @ignore
  11593. @cindex PreservePermissions, in CVSROOT/config
  11594. @item PreservePermissions=@var{value}
  11595. Enable support for saving special device files,
  11596. symbolic links, file permissions and ownerships in the
  11597. repository. The default value is @samp{no}.
  11598. @xref{Special Files}, for the full implications of using
  11599. this keyword.
  11600. @end ignore
  11601. @cindex TopLevelAdmin, in CVSROOT/config
  11602. @item TopLevelAdmin=@var{value}
  11603. Modify the @samp{checkout} command to create a
  11604. @samp{CVS} directory at the top level of the new
  11605. working directory, in addition to @samp{CVS}
  11606. directories created within checked-out directories.
  11607. The default value is @samp{no}.
  11608. This option is useful if you find yourself performing
  11609. many commands at the top level of your working
  11610. directory, rather than in one of the checked out
  11611. subdirectories. The @file{CVS} directory created there
  11612. will mean you don't have to specify @code{CVSROOT} for
  11613. each command. It also provides a place for the
  11614. @file{CVS/Template} file (@pxref{Working directory
  11615. storage}).
  11616. @cindex LockDir, in CVSROOT/config
  11617. @item LockDir=@var{directory}
  11618. Put @sc{cvs} lock files in @var{directory} rather than
  11619. directly in the repository. This is useful if you want
  11620. to let users read from the repository while giving them
  11621. write access only to @var{directory}, not to the
  11622. repository.
  11623. It can also be used to put the locks on a very fast
  11624. in-memory file system to speed up locking and unlocking
  11625. the repository.
  11626. You need to create @var{directory}, but
  11627. @sc{cvs} will create subdirectories of @var{directory} as it
  11628. needs them. For information on @sc{cvs} locks, see
  11629. @ref{Concurrency}.
  11630. @c Mention this in Compatibility section?
  11631. Before enabling the LockDir option, make sure that you
  11632. have tracked down and removed any copies of @sc{cvs} 1.9 or
  11633. older. Such versions neither support LockDir, nor will
  11634. give an error indicating that they don't support it.
  11635. The result, if this is allowed to happen, is that some
  11636. @sc{cvs} users will put the locks one place, and others will
  11637. put them another place, and therefore the repository
  11638. could become corrupted. @sc{cvs} 1.10 does not support
  11639. LockDir but it will print a warning if run on a
  11640. repository with LockDir enabled.
  11641. @cindex LogHistory, in CVSROOT/config
  11642. @item LogHistory=@var{value}
  11643. Control what is logged to the @file{CVSROOT/history} file (@pxref{history}).
  11644. Default of @samp{TOEFWUPCGMAR} (or simply @samp{all}) will log
  11645. all transactions. Any subset of the default is
  11646. legal. (For example, to only log transactions that modify the
  11647. @file{*,v} files, use @samp{LogHistory=TMAR}.)
  11648. @cindex RereadLogAfterVerify, in CVSROOT/config
  11649. @cindex @file{verifymsg}, changing the log message
  11650. @item RereadLogAfterVerify=@var{value}
  11651. Modify the @samp{commit} command such that CVS will reread the
  11652. log message after running the program specified by @file{verifymsg}.
  11653. @var{value} may be one of @samp{yes} or @samp{always}, indicating that
  11654. the log message should always be reread; @samp{no}
  11655. or @samp{never}, indicating that it should never be
  11656. reread; or @var{value} may be @samp{stat}, indicating
  11657. that the file should be checked with the file system
  11658. @samp{stat()} function to see if it has changed (see warning below)
  11659. before rereading. The default value is @samp{always}.
  11660. @strong{The `stat' mode can cause CVS to pause for up to
  11661. one extra second per directory committed. This can be less IO and
  11662. CPU intensive but is not recommended for use with large repositories}
  11663. @xref{verifymsg}, for more information on how verifymsg
  11664. may be used.
  11665. @cindex IgnoreUnknownConfigKeys, in CVSROOT/config
  11666. @item IgnoreUnknownConfigKeys=@var{value}
  11667. If @var{value} is @samp{yes}, then @sc{cvs} should
  11668. ignore any keywords in @file{CVSROOT/config} which it
  11669. does not recognize. This option is intended primarily
  11670. for transitions between versions of @sc{cvs} which
  11671. support more configuration options in an environment
  11672. where a read-only mirror of the current @sc{cvs} server
  11673. may be maintained by someone else who is not yet ready
  11674. to upgrade to the same version. It is recommended that
  11675. this option be used only for a short time so that
  11676. problems with the @file{CVSROOT/config} file will be
  11677. found quickly. The default is @samp{no}.
  11678. @end table
  11679. @c ---------------------------------------------------------------------
  11680. @node Environment variables
  11681. @appendix All environment variables which affect CVS
  11682. @cindex Environment variables
  11683. @cindex Reference manual for variables
  11684. This is a complete list of all environment variables
  11685. that affect @sc{cvs}.
  11686. @table @code
  11687. @cindex CVSIGNORE, environment variable
  11688. @item $CVSIGNORE
  11689. A whitespace-separated list of file name patterns that
  11690. @sc{cvs} should ignore. @xref{cvsignore}.
  11691. @cindex CVSWRAPPERS, environment variable
  11692. @item $CVSWRAPPERS
  11693. A whitespace-separated list of file name patterns that
  11694. @sc{cvs} should treat as wrappers. @xref{Wrappers}.
  11695. @cindex CVSREAD, environment variable
  11696. @cindex Read-only files, and CVSREAD
  11697. @item $CVSREAD
  11698. If this is set, @code{checkout} and @code{update} will
  11699. try hard to make the files in your working directory
  11700. read-only. When this is not set, the default behavior
  11701. is to permit modification of your working files.
  11702. @item $CVSUMASK
  11703. Controls permissions of files in the repository. See
  11704. @ref{File permissions}.
  11705. @item $CVSROOT
  11706. Should contain the full pathname to the root of the @sc{cvs}
  11707. source repository (where the @sc{rcs} files are
  11708. kept). This information must be available to @sc{cvs} for
  11709. most commands to execute; if @code{$CVSROOT} is not set,
  11710. or if you wish to override it for one invocation, you
  11711. can supply it on the command line: @samp{cvs -d cvsroot
  11712. cvs_command@dots{}} Once you have checked out a working
  11713. directory, @sc{cvs} stores the appropriate root (in
  11714. the file @file{CVS/Root}), so normally you only need to
  11715. worry about this when initially checking out a working
  11716. directory.
  11717. @item $CVSEDITOR
  11718. @cindex CVSEDITOR, environment variable
  11719. @itemx $EDITOR
  11720. @cindex EDITOR, environment variable
  11721. @itemx $VISUAL
  11722. @cindex VISUAL, environment variable
  11723. Specifies the program to use for recording log messages
  11724. during commit. @code{$CVSEDITOR} overrides
  11725. @code{$EDITOR}, which overrides @code{$VISUAL}.
  11726. See @ref{Committing your changes} for more or
  11727. @ref{Global options} for alternative ways of specifying a
  11728. log editor.
  11729. @cindex PATH, environment variable
  11730. @item $PATH
  11731. If @code{$RCSBIN} is not set, and no path is compiled
  11732. into @sc{cvs}, it will use @code{$PATH} to try to find all
  11733. programs it uses.
  11734. @cindex HOME, environment variable
  11735. @item $HOME
  11736. @cindex HOMEPATH, environment variable
  11737. @item $HOMEPATH
  11738. @cindex HOMEDRIVE, environment variable
  11739. @item $HOMEDRIVE
  11740. Used to locate the directory where the @file{.cvsrc}
  11741. file, and other such files, are searched. On Unix, @sc{cvs}
  11742. just checks for @code{HOME}. On Windows NT, the system will
  11743. set @code{HOMEDRIVE}, for example to @samp{d:} and @code{HOMEPATH},
  11744. for example to @file{\joe}. On Windows 95, you'll
  11745. probably need to set @code{HOMEDRIVE} and @code{HOMEPATH} yourself.
  11746. @c We are being vague about whether HOME works on
  11747. @c Windows; see long comment in windows-NT/filesubr.c.
  11748. @cindex CVS_RSH, environment variable
  11749. @item $CVS_RSH
  11750. Specifies the external program which @sc{cvs} connects with,
  11751. when @code{:ext:} access method is specified.
  11752. @pxref{Connecting via rsh}.
  11753. @cindex CVS_SSH, environment variable
  11754. @item $CVS_SSH
  11755. Specifies the external program which @sc{cvs} connects with,
  11756. when @code{:extssh:} access method is specified.
  11757. @pxref{Connecting via rsh}.
  11758. @item $CVS_SERVER
  11759. Used in client-server mode when accessing a remote
  11760. repository using @sc{rsh}. It specifies the name of
  11761. the program to start on the server side (and any
  11762. necessary arguments) when accessing a remote repository
  11763. using the @code{:ext:}, @code{:fork:}, or @code{:server:} access methods.
  11764. The default value for @code{:ext:} and @code{:server:} is @code{cvs};
  11765. the default value for @code{:fork:} is the name used to run the client.
  11766. @pxref{Connecting via rsh}
  11767. @item $CVS_PASSFILE
  11768. Used in client-server mode when accessing the @code{cvs
  11769. login server}. Default value is @file{$HOME/.cvspass}.
  11770. @pxref{Password authentication client}
  11771. @item $CVS_CLIENT_PORT
  11772. Used in client-server mode to set the port to use when accessing the server
  11773. via Kerberos, GSSAPI, or @sc{cvs}'s password authentication protocol
  11774. if the port is not specified in the CVSROOT.
  11775. @pxref{Remote repositories}
  11776. @cindex CVS_RCMD_PORT, environment variable
  11777. @item $CVS_RCMD_PORT
  11778. Used in client-server mode. If set, specifies the port
  11779. number to be used when accessing the @sc{rcmd} demon on
  11780. the server side. (Currently not used for Unix clients).
  11781. @cindex CVS_CLIENT_LOG, environment variable
  11782. @item $CVS_CLIENT_LOG
  11783. Used for debugging only in client-server
  11784. mode. If set, everything sent to the server is logged
  11785. into @file{@code{$CVS_CLIENT_LOG}.in} and everything
  11786. sent from the server is logged into
  11787. @file{@code{$CVS_CLIENT_LOG}.out}.
  11788. @cindex CVS_SERVER_SLEEP, environment variable
  11789. @item $CVS_SERVER_SLEEP
  11790. Used only for debugging the server side in
  11791. client-server mode. If set, delays the start of the
  11792. server child process the specified amount of
  11793. seconds so that you can attach to it with a debugger.
  11794. @cindex CVS_IGNORE_REMOTE_ROOT, environment variable
  11795. @item $CVS_IGNORE_REMOTE_ROOT
  11796. For @sc{cvs} 1.10 and older, setting this variable
  11797. prevents @sc{cvs} from overwriting the @file{CVS/Root}
  11798. file when the @samp{-d} global option is specified.
  11799. Later versions of @sc{cvs} do not rewrite
  11800. @file{CVS/Root}, so @code{CVS_IGNORE_REMOTE_ROOT} has no
  11801. effect.
  11802. @cindex COMSPEC, environment variable
  11803. @item $COMSPEC
  11804. Used under OS/2 only. It specifies the name of the
  11805. command interpreter and defaults to @sc{cmd.exe}.
  11806. @cindex TMPDIR, environment variable
  11807. @item $TMPDIR
  11808. @cindex TMP, environment variable
  11809. @itemx $TMP
  11810. @cindex TEMP, environment variable
  11811. @itemx $TEMP
  11812. @cindex Temporary files, location of
  11813. @c This is quite nuts. We don't talk about tempnam
  11814. @c or mkstemp which we sometimes use. The discussion
  11815. @c of "Global options" is semi-incoherent.
  11816. @c I'm not even sure those are the only inaccuracies.
  11817. @c Furthermore, the conventions are
  11818. @c pretty crazy and they should be simplified.
  11819. Directory in which temporary files are located.
  11820. The @sc{cvs} server uses
  11821. @code{TMPDIR}. @xref{Global options}, for a
  11822. description of how to specify this.
  11823. Some parts of @sc{cvs} will always use @file{/tmp} (via
  11824. the @code{tmpnam} function provided by the system).
  11825. On Windows NT, @code{TMP} is used (via the @code{_tempnam}
  11826. function provided by the system).
  11827. The @code{patch} program which is used by the @sc{cvs}
  11828. client uses @code{TMPDIR}, and if it is not set, uses
  11829. @file{/tmp} (at least with GNU patch 2.1). Note that
  11830. if your server and client are both running @sc{cvs}
  11831. 1.9.10 or later, @sc{cvs} will not invoke an external
  11832. @code{patch} program.
  11833. @end table
  11834. @node Compatibility
  11835. @appendix Compatibility between CVS Versions
  11836. @cindex CVS, versions of
  11837. @cindex Versions, of CVS
  11838. @cindex Compatibility, between CVS versions
  11839. @c We don't mention versions older than CVS 1.3
  11840. @c on the theory that it would clutter it up for the vast
  11841. @c majority of people, who don't have anything that old.
  11842. @c
  11843. The repository format is compatible going back to
  11844. @sc{cvs} 1.3. But see @ref{Watches Compatibility}, if
  11845. you have copies of @sc{cvs} 1.6 or older and you want
  11846. to use the optional developer communication features.
  11847. @c If you "cvs rm" and commit using 1.3, then you'll
  11848. @c want to run "rcs -sdead <file,v>" on each of the
  11849. @c files in the Attic if you then want 1.5 and
  11850. @c later to recognize those files as dead (I think the
  11851. @c symptom if this is not done is that files reappear
  11852. @c in joins). (Wait: the above will work but really to
  11853. @c be strictly correct we should suggest checking
  11854. @c in a new revision rather than just changing the
  11855. @c state of the head revision, shouldn't we?).
  11856. @c The old convert.sh script was for this, but it never
  11857. @c did get updated to reflect use of the RCS "dead"
  11858. @c state.
  11859. @c Note: this is tricky to document without confusing
  11860. @c people--need to carefully say what CVS version we
  11861. @c are talking about and keep in mind the distinction
  11862. @c between a
  11863. @c repository created with 1.3 and on which one now
  11864. @c uses 1.5+, and a repository on which one wants to
  11865. @c use both versions side by side (e.g. during a
  11866. @c transition period).
  11867. @c Wait, can't CVS just detect the case in which a file
  11868. @c is in the Attic but the head revision is not dead?
  11869. @c Not sure whether this should produce a warning or
  11870. @c something, and probably needs further thought, but
  11871. @c it would appear that the situation can be detected.
  11872. @c
  11873. @c We might want to separate out the 1.3 compatibility
  11874. @c section (for repository & working directory) from the
  11875. @c rest--that might help avoid confusing people who
  11876. @c are upgrading (for example) from 1.6 to 1.8.
  11877. @c
  11878. @c A minor incompatibility is if a current version of CVS
  11879. @c puts "Nfoo" into CVS/Tag, then CVS 1.9 or older will
  11880. @c see this as if there is no tag. Seems to me this is
  11881. @c too obscure to mention.
  11882. The working directory format is compatible going back
  11883. to @sc{cvs} 1.5. It did change between @sc{cvs} 1.3
  11884. and @sc{cvs} 1.5. If you run @sc{cvs} 1.5 or newer on
  11885. a working directory checked out with @sc{cvs} 1.3,
  11886. @sc{cvs} will convert it, but to go back to @sc{cvs}
  11887. 1.3 you need to check out a new working directory with
  11888. @sc{cvs} 1.3.
  11889. The remote protocol is interoperable going back to @sc{cvs} 1.5, but no
  11890. further (1.5 was the first official release with the remote protocol,
  11891. but some older versions might still be floating around). In many
  11892. cases you need to upgrade both the client and the server to take
  11893. advantage of new features and bug fixes, however.
  11894. @c Perhaps should be saying something here about the
  11895. @c "D" lines in Entries (written by CVS 1.9; 1.8 and
  11896. @c older don't use them). These are supposed to be
  11897. @c compatible in both directions, but I'm not sure
  11898. @c they quite are 100%. One common gripe is if you
  11899. @c "rm -r" a directory and 1.9 gets confused, as it
  11900. @c still sees it in Entries. That one is fixed in
  11901. @c (say) 1.9.6. Someone else reported problems with
  11902. @c starting with a directory which was checked out with
  11903. @c an old version, and then using a new version, and
  11904. @c some "D" lines appeared, but not for every
  11905. @c directory, causing some directories to be skipped.
  11906. @c They weren't sure how to reproduce this, though.
  11907. @c ---------------------------------------------------------------------
  11908. @node Troubleshooting
  11909. @appendix Troubleshooting
  11910. If you are having trouble with @sc{cvs}, this appendix
  11911. may help. If there is a particular error message which
  11912. you are seeing, then you can look up the message
  11913. alphabetically. If not, you can look through the
  11914. section on other problems to see if your problem is
  11915. mentioned there.
  11916. @menu
  11917. * Error messages:: Partial list of CVS errors
  11918. * Connection:: Trouble making a connection to a CVS server
  11919. * Other problems:: Problems not readily listed by error message
  11920. @end menu
  11921. @ignore
  11922. @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11923. @c @node Bad administrative files
  11924. @appendixsec Bad administrative files
  11925. @c -- Give hints on how to fix them
  11926. @end ignore
  11927. @node Error messages
  11928. @appendixsec Partial list of error messages
  11929. Here is a partial list of error messages that you may
  11930. see from @sc{cvs}. It is not a complete list---@sc{cvs}
  11931. is capable of printing many, many error messages, often
  11932. with parts of them supplied by the operating system,
  11933. but the intention is to list the common and/or
  11934. potentially confusing error messages.
  11935. The messages are alphabetical, but introductory text
  11936. such as @samp{cvs update: } is not considered in
  11937. ordering them.
  11938. In some cases the list includes messages printed by old
  11939. versions of @sc{cvs} (partly because users may not be
  11940. sure which version of @sc{cvs} they are using at any
  11941. particular moment).
  11942. @c If we want to start retiring messages, perhaps we
  11943. @c should pick a cutoff version (for example, no more
  11944. @c messages which are specific to versions before 1.9)
  11945. @c and then move the old messages to an "old messages"
  11946. @c node rather than deleting them completely.
  11947. @table @code
  11948. @c FIXME: What is the correct way to format a multiline
  11949. @c error message here? Maybe @table is the wrong
  11950. @c choice? Texinfo gurus?
  11951. @item @var{file}:@var{line}: Assertion '@var{text}' failed
  11952. The exact format of this message may vary depending on
  11953. your system. It indicates a bug in @sc{cvs}, which can
  11954. be handled as described in @ref{BUGS}.
  11955. @item cvs @var{command}: authorization failed: server @var{host} rejected access
  11956. This is a generic response when trying to connect to a
  11957. pserver server which chooses not to provide a
  11958. specific reason for denying authorization. Check that
  11959. the username and password specified are correct and
  11960. that the @code{CVSROOT} specified is allowed by @samp{--allow-root}
  11961. in @file{inetd.conf}. See @ref{Password authenticated}.
  11962. @item cvs @var{command}: conflict: removed @var{file} was modified by second party
  11963. This message indicates that you removed a file, and
  11964. someone else modified it. To resolve the conflict,
  11965. first run @samp{cvs add @var{file}}. If desired, look
  11966. at the other party's modification to decide whether you
  11967. still want to remove it. If you don't want to remove
  11968. it, stop here. If you do want to remove it, proceed
  11969. with @samp{cvs remove @var{file}} and commit your
  11970. removal.
  11971. @c Tests conflicts2-142b* in sanity.sh test for this.
  11972. @item cannot change permissions on temporary directory
  11973. @example
  11974. Operation not permitted
  11975. @end example
  11976. This message has been happening in a non-reproducible,
  11977. occasional way when we run the client/server testsuite,
  11978. bot