home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / info / cvs.info-3 < prev    next >
Encoding:
GNU Info File  |  1996-10-13  |  43.1 KB  |  1,148 lines

  1. This is Info file cvs.info, produced by Makeinfo-1.64 from the input
  2. file /ade-source/fsf/cvs/doc/cvs.texinfo.
  3.  
  4.    Copyright (C) 1992, 1993 Signum Support AB Copyright (C) 1993, 1994
  5. Free Software Foundation, Inc.
  6.  
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.  
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided also
  13. that the section entitled "GNU General Public License" is included
  14. exactly as in the original, and provided that the entire resulting
  15. derived work is distributed under the terms of a permission notice
  16. identical to this one.
  17.  
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the section entitled "GNU General Public License"
  21. and this permission notice may be included in translations approved by
  22. the Free Software Foundation instead of in the original English.
  23.  
  24. 
  25. File: cvs.info,  Node: Recursive behavior,  Next: Adding files,  Prev: Merging,  Up: Top
  26.  
  27. Recursive behavior
  28. ******************
  29.  
  30.    Almost all of the subcommands of CVS work recursively when you
  31. specify a directory as an argument.  For instance, consider this
  32. directory structure:
  33.  
  34.            `$HOME'
  35.              |
  36.              +--tc
  37.              |   |
  38.                  +--CVS
  39.                  |      (internal CVS files)
  40.                  +--Makefile
  41.                  +--backend.c
  42.                  +--driver.c
  43.                  +--frontend.c
  44.                  +--parser.c
  45.                  +--man
  46.                  |    |
  47.                  |    +--CVS
  48.                  |    |  (internal CVS files)
  49.                  |    +--tc.1
  50.                  |
  51.                  +--testing
  52.                       |
  53.                       +--CVS
  54.                       |  (internal CVS files)
  55.                       +--testpgm.t
  56.                       +--test2.t
  57.  
  58. If `tc' is the current working directory, the following is true:
  59.  
  60.    * `cvs update testing' is equivalent to `cvs update
  61.      testing/testpgm.t testing/test2.t'
  62.  
  63.    * `cvs update testing man' updates all files in the subdirectories
  64.  
  65.    * `cvs update .' or just `cvs update' updates all files in the `tc'
  66.      module
  67.  
  68.    If no arguments are given to `update' it will update all files in
  69. the current working directory and all its subdirectories.  In other
  70. words, `.' is a default argument to `update'.  This is also true for
  71. most of the CVS subcommands, not only the `update' command.
  72.  
  73.    The recursive behavior of the CVS subcommands can be turned off with
  74. the `-l' option.
  75.  
  76.      $ cvs update -l         # Don't update files in subdirectories
  77.  
  78. 
  79. File: cvs.info,  Node: Adding files,  Next: Removing files,  Prev: Recursive behavior,  Up: Top
  80.  
  81. Adding files to a directory
  82. ***************************
  83.  
  84.    To add a new file to a directory, follow these steps.
  85.  
  86.    * You must have a working copy of the directory.  *Note Getting the
  87.      source::.
  88.  
  89.    * Create the new file inside your working copy of the directory.
  90.  
  91.    * Use `cvs add FILENAME' to tell CVS that you want to version
  92.      control the file.  If the file contains binary data, specify `-kb'
  93.      (*note Binary files::.).
  94.  
  95.    * Use `cvs commit FILENAME' to actually check in the file into the
  96.      repository.  Other developers cannot see the file until you
  97.      perform this step.
  98.  
  99.    You can also use the `add' command to add a new directory.
  100.  
  101.    Unlike most other commands, the `add' command is not recursive.  You
  102. cannot even type `cvs add foo/bar'!  Instead, you have to
  103.  
  104.      $ cd foo
  105.      $ cvs add bar
  106.  
  107.  - Command: cvs add [`-k' KFLAG] [`-m' MESSAGE] FILES ...
  108.      Schedule FILES to be added to the repository.  The files or
  109.      directories specified with `add' must already exist in the current
  110.      directory.  To add a whole new directory hierarchy to the source
  111.      repository (for example, files received from a third-party
  112.      vendor), use the `import' command instead.  *Note import::.
  113.  
  114.      The added files are not placed in the source repository until you
  115.      use `commit' to make the change permanent.  Doing an `add' on a
  116.      file that was removed with the `remove' command will undo the
  117.      effect of the `remove', unless a `commit' command intervened.
  118.      *Note Removing files::, for an example.
  119.  
  120.      The `-k' option specifies the default way that this file will be
  121.      checked out; for more information see *Note Substitution modes::.
  122.  
  123.      The `-m' option specifies a description for the file.  This
  124.      description appears in the history log (if it is enabled, *note
  125.      history file::.).  It will also be saved in the version history
  126.      inside the repository when the file is committed.  The `log'
  127.      command displays this description.  The description can be changed
  128.      using `admin -t'.  *Note admin::.  If you omit the `-m
  129.      DESCRIPTION' flag, an empty string will be used.  You will not be
  130.      prompted for a description.
  131.  
  132.    For example, the following commands add the file `backend.c' to the
  133. repository:
  134.  
  135.      $ cvs add backend.c
  136.      $ cvs commit -m "Early version. Not yet compilable." backend.c
  137.  
  138.    When you add a file it is added only on the branch which you are
  139. working on (*note Branches::.).  You can later merge the additions to
  140. another branch if you want (*note Merging adds and removals::.).
  141.  
  142. 
  143. File: cvs.info,  Node: Removing files,  Next: Tracking sources,  Prev: Adding files,  Up: Top
  144.  
  145. Removing files from a module
  146. ****************************
  147.  
  148.    Modules change.  New files are added, and old files disappear.
  149. Still, you want to be able to retrieve an exact copy of old releases of
  150. the module.
  151.  
  152.    Here is what you can do to remove a file from a module, but remain
  153. able to retrieve old revisions:
  154.  
  155.    * Make sure that you have not made any uncommitted modifications to
  156.      the file.  *Note Viewing differences::, for one way to do that.
  157.      You can also use the `status' or `update' command.  If you remove
  158.      the file without committing your changes, you will of course not
  159.      be able to retrieve the file as it was immediately before you
  160.      deleted it.
  161.  
  162.    * Remove the file from your working copy of the module.  You can for
  163.      instance use `rm'.
  164.  
  165.    * Use `cvs remove FILENAME' to tell CVS that you really want to
  166.      delete the file.
  167.  
  168.    * Use `cvs commit FILENAME' to actually perform the removal of the
  169.      file from the repository.
  170.  
  171.    When you commit the removal of the file, CVS records the fact that
  172. the file no longer exists.  It is possible for a file to exist on only
  173. some branches and not on others, or to re-add another file with the same
  174. name later.  CVS will correctly create or not create the file, based on
  175. the `-r' and `-D' options specified to `checkout' or `update'.
  176.  
  177.  - Command: cvs remove [`-lR'] FILES ...
  178.      Schedule file(s) to be removed from the repository (files which
  179.      have not already been removed from the working directory are not
  180.      processed).  This command does not actually remove the file from
  181.      the repository until you commit the removal.  The `-R' option (the
  182.      default) specifies that it will recurse into subdirectories; `-l'
  183.      specifies that it will not.
  184.  
  185.    Here is an example of removing several files:
  186.  
  187.      $ cd test
  188.      $ rm ?.c
  189.      $ cvs remove
  190.      cvs remove: Removing .
  191.      cvs remove: scheduling a.c for removal
  192.      cvs remove: scheduling b.c for removal
  193.      cvs remove: use 'cvs commit' to remove these files permanently
  194.      $ cvs ci -m "Removed unneeded files"
  195.      cvs commit: Examining .
  196.      cvs commit: Committing .
  197.  
  198.    If you change your mind you can easily resurrect the file before you
  199. commit it, using the `add' command.
  200.  
  201.      $ ls
  202.      CVS   ja.h  oj.c
  203.      $ rm oj.c
  204.      $ cvs remove oj.c
  205.      cvs remove: scheduling oj.c for removal
  206.      cvs remove: use 'cvs commit' to remove this file permanently
  207.      $ cvs add oj.c
  208.      U oj.c
  209.      cvs add: oj.c, version 1.1.1.1, resurrected
  210.  
  211.    If you realize your mistake before you run the `remove' command you
  212. can use `update' to resurrect the file:
  213.  
  214.      $ rm oj.c
  215.      $ cvs update oj.c
  216.      cvs update: warning: oj.c was lost
  217.      U oj.c
  218.  
  219.    When you remove a file it is added only on the branch which you are
  220. working on (*note Branches::.).  You can later merge the additions to
  221. another branch if you want (*note Merging adds and removals::.).
  222.  
  223. 
  224. File: cvs.info,  Node: Tracking sources,  Next: Moving files,  Prev: Removing files,  Up: Top
  225.  
  226. Tracking third-party sources
  227. ****************************
  228.  
  229.    If you modify a program to better fit your site, you probably want
  230. to include your modifications when the next release of the program
  231. arrives.  CVS can help you with this task.
  232.  
  233.    In the terminology used in CVS, the supplier of the program is
  234. called a "vendor".  The unmodified distribution from the vendor is
  235. checked in on its own branch, the "vendor branch".  CVS reserves branch
  236. 1.1.1 for this use.
  237.  
  238.    When you modify the source and commit it, your revision will end up
  239. on the main trunk.  When a new release is made by the vendor, you
  240. commit it on the vendor branch and copy the modifications onto the main
  241. trunk.
  242.  
  243.    Use the `import' command to create and update the vendor branch.
  244. After a successful `import' the vendor branch is made the `head'
  245. revision, so anyone that checks out a copy of the file gets that
  246. revision.  When a local modification is committed it is placed on the
  247. main trunk, and made the `head' revision.
  248.  
  249. * Menu:
  250.  
  251. * First import::                Importing a module for the first time
  252. * Update imports::              Updating a module with the import command
  253. * Binary files in imports::     Binary files require special handling
  254.  
  255. 
  256. File: cvs.info,  Node: First import,  Next: Update imports,  Up: Tracking sources
  257.  
  258. Importing a module for the first time
  259. =====================================
  260.  
  261.    Use the `import' command to check in the sources for the first time.
  262. When you use the `import' command to track third-party sources, the
  263. "vendor tag" and "release tags" are useful.  The "vendor tag" is a
  264. symbolic name for the branch (which is always 1.1.1, unless you use the
  265. `-b BRANCH' flag--*Note import options::.).  The "release tags" are
  266. symbolic names for a particular release, such as `FSF_0_04'.
  267.  
  268.    Suppose you use `wdiff' (a variant of `diff' that ignores changes
  269. that only involve whitespace), and are going to make private
  270. modifications that you want to be able to use even when new releases
  271. are made in the future.  You start by importing the source to your
  272. repository:
  273.  
  274.      $ tar xfz wdiff-0.04.tar.gz
  275.      $ cd wdiff-0.04
  276.      $ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
  277.  
  278.    The vendor tag is named `FSF_DIST' in the above example, and the
  279. only release tag assigned is `WDIFF_0_04'.
  280.  
  281. 
  282. File: cvs.info,  Node: Update imports,  Next: Binary files in imports,  Prev: First import,  Up: Tracking sources
  283.  
  284. Updating a module with the import command
  285. =========================================
  286.  
  287.    When a new release of the source arrives, you import it into the
  288. repository with the same `import' command that you used to set up the
  289. repository in the first place.  The only difference is that you specify
  290. a different release tag this time.
  291.  
  292.      $ tar xfz wdiff-0.05.tar.gz
  293.      $ cd wdiff-0.05
  294.      $ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
  295.  
  296.    For files that have not been modified locally, the newly created
  297. revision becomes the head revision.  If you have made local changes,
  298. `import' will warn you that you must merge the changes into the main
  299. trunk, and tell you to use `checkout -j' to do so.
  300.  
  301.      $ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
  302.  
  303. The above command will check out the latest revision of `wdiff',
  304. merging the changes made on the vendor branch `FSF_DIST' since
  305. yesterday into the working copy.  If any conflicts arise during the
  306. merge they should be resolved in the normal way (*note Conflicts
  307. example::.).  Then, the modified files may be committed.
  308.  
  309.    Using a date, as suggested above, assumes that you do not import
  310. more than one release of a product per day. If you do, you can always
  311. use something like this instead:
  312.  
  313.      $ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
  314.  
  315. In this case, the two above commands are equivalent.
  316.  
  317. 
  318. File: cvs.info,  Node: Binary files in imports,  Prev: Update imports,  Up: Tracking sources
  319.  
  320. How to handle binary files with cvs import
  321. ==========================================
  322.  
  323.    Use the `-k' wrapper option to tell import which files are binary.
  324. *Note Wrappers::.
  325.  
  326. 
  327. File: cvs.info,  Node: Moving files,  Next: Moving directories,  Prev: Tracking sources,  Up: Top
  328.  
  329. Moving and renaming files
  330. *************************
  331.  
  332.    Moving files to a different directory or renaming them is not
  333. difficult, but some of the ways in which this works may be non-obvious.
  334. (Moving or renaming a directory is even harder.  *Note Moving
  335. directories::.).
  336.  
  337.    The examples below assume that the file OLD is renamed to NEW.
  338.  
  339. * Menu:
  340.  
  341. * Outside::                     The normal way to Rename
  342. * Inside::                      A tricky, alternative way
  343. * Rename by copying::           Another tricky, alternative way
  344.  
  345. 
  346. File: cvs.info,  Node: Outside,  Next: Inside,  Up: Moving files
  347.  
  348. The Normal way to Rename
  349. ========================
  350.  
  351.    The normal way to move a file is to copy OLD to NEW, and then issue
  352. the normal CVS commands to remove OLD from the repository, and add NEW
  353. to it.  (Both OLD and NEW could contain relative paths, for example
  354. `foo/bar.c').
  355.  
  356.      $ mv OLD NEW
  357.      $ cvs remove OLD
  358.      $ cvs add NEW
  359.      $ cvs commit -m "Renamed OLD to NEW" OLD NEW
  360.  
  361.    This is the simplest way to move a file, it is not error-prone, and
  362. it preserves the history of what was done.  Note that to access the
  363. history of the file you must specify the old or the new name, depending
  364. on what portion of the history you are accessing.  For example, `cvs
  365. log OLD' will give the log up until the time of the rename.
  366.  
  367.    When NEW is committed its revision numbers will start at 1.0 again,
  368. so if that bothers you, use the `-r rev' option to commit (*note commit
  369. options::.)
  370.  
  371. 
  372. File: cvs.info,  Node: Inside,  Next: Rename by copying,  Prev: Outside,  Up: Moving files
  373.  
  374. Moving the history file
  375. =======================
  376.  
  377.    This method is more dangerous, since it involves moving files inside
  378. the repository.  Read this entire section before trying it out!
  379.  
  380.      $ cd $CVSROOT/MODULE
  381.      $ mv OLD,v NEW,v
  382.  
  383. Advantages:
  384.  
  385.    * The log of changes is maintained intact.
  386.  
  387.    * The revision numbers are not affected.
  388.  
  389. Disadvantages:
  390.  
  391.    * Old releases of the module cannot easily be fetched from the
  392.      repository.  (The file will show up as NEW even in revisions from
  393.      the time before it was renamed).
  394.  
  395.    * There is no log information of when the file was renamed.
  396.  
  397.    * Nasty things might happen if someone accesses the history file
  398.      while you are moving it.  Make sure no one else runs any of the CVS
  399.      commands while you move it.
  400.  
  401. 
  402. File: cvs.info,  Node: Rename by copying,  Prev: Inside,  Up: Moving files
  403.  
  404. Copying the history file
  405. ========================
  406.  
  407.    This way also involves direct modifications to the repository.  It
  408. is safe, but not without drawbacks.
  409.  
  410.      # Copy the RCS file inside the repository
  411.      $ cd $CVSROOT/MODULE
  412.      $ cp OLD,v NEW,v
  413.      # Remove the old file
  414.      $ cd ~/MODULE
  415.      $ rm OLD
  416.      $ cvs remove OLD
  417.      $ cvs commit OLD
  418.      # Remove all tags from NEW
  419.      $ cvs update NEW
  420.      $ cvs log NEW             # Remember the non-branch tag names
  421.      $ cvs tag -d TAG1 NEW
  422.      $ cvs tag -d TAG2 NEW
  423.      ...
  424.  
  425.    By removing the tags you will be able to check out old revisions of
  426. the module.
  427.  
  428. Advantages:
  429.  
  430.    * Checking out old revisions works correctly, as long as you use
  431.      `-rTAG' and not `-DDATE' to retrieve the revisions.
  432.  
  433.    * The log of changes is maintained intact.
  434.  
  435.    * The revision numbers are not affected.
  436.  
  437. Disadvantages:
  438.  
  439.    * You cannot easily see the history of the file across the rename.
  440.  
  441.    * Unless you use the `-r rev' (*note commit options::.) flag when
  442.      NEW is committed its revision numbers will start at 1.0 again.
  443.  
  444. 
  445. File: cvs.info,  Node: Moving directories,  Next: History browsing,  Prev: Moving files,  Up: Top
  446.  
  447. Moving and renaming directories
  448. *******************************
  449.  
  450.    If you want to be able to retrieve old versions of the module, you
  451. must move each file in the directory with the CVS commands.  *Note
  452. Outside::.  The old, empty directory will remain inside the repository,
  453. but it will not appear in your workspace when you check out the module
  454. in the future.
  455.  
  456.    If you really want to rename or delete a directory, you can do it
  457. like this:
  458.  
  459.   1. Inform everyone who has a copy of the module that the directory
  460.      will be renamed.  They should commit all their changes, and remove
  461.      their working copies of the module, before you take the steps
  462.      below.
  463.  
  464.   2. Rename the directory inside the repository.
  465.  
  466.           $ cd $CVSROOT/MODULE
  467.           $ mv OLD-DIR NEW-DIR
  468.  
  469.   3. Fix the CVS administrative files, if necessary (for instance if
  470.      you renamed an entire module).
  471.  
  472.   4. Tell everyone that they can check out the module and continue
  473.      working.
  474.  
  475.  
  476.    If someone had a working copy of the module the CVS commands will
  477. cease to work for him, until he removes the directory that disappeared
  478. inside the repository.
  479.  
  480.    It is almost always better to move the files in the directory
  481. instead of moving the directory.  If you move the directory you are
  482. unlikely to be able to retrieve old releases correctly, since they
  483. probably depend on the name of the directories.
  484.  
  485. 
  486. File: cvs.info,  Node: History browsing,  Next: Keyword substitution,  Prev: Moving directories,  Up: Top
  487.  
  488. History browsing
  489. ****************
  490.  
  491.    Once you have used CVS to store a version control history--what
  492. files have changed when, how, and by whom, there are a variety of
  493. mechanisms for looking through the history.
  494.  
  495. * Menu:
  496.  
  497. * log messages::                Log messages
  498. * history database::            The history database
  499. * user-defined logging::        User-defined logging
  500. * annotate::                    What revision modified each line of a file?
  501.  
  502. 
  503. File: cvs.info,  Node: log messages,  Next: history database,  Up: History browsing
  504.  
  505. Log messages
  506. ============
  507.  
  508.    Whenever you commit a file you specify a log message.
  509.  
  510.    To look through the log messages which have been specified for every
  511. revision which has been committed, use the `cvs log' command (*note
  512. log::.).
  513.  
  514. 
  515. File: cvs.info,  Node: history database,  Next: user-defined logging,  Prev: log messages,  Up: History browsing
  516.  
  517. The history database
  518. ====================
  519.  
  520.    You can use the history file (*note history file::.) to log various
  521. CVS actions.  To retrieve the information from the history file, use
  522. the `cvs history' command (*note history::.).
  523.  
  524. 
  525. File: cvs.info,  Node: user-defined logging,  Next: annotate,  Prev: history database,  Up: History browsing
  526.  
  527. User-defined logging
  528. ====================
  529.  
  530.    You can customize CVS to log various kinds of actions, in whatever
  531. manner you choose.  These mechanisms operate by executing a script at
  532. various times.  The script might append a message to a file listing the
  533. information and the programmer who created it, or send mail to a group
  534. of developers, or, perhaps, post a message to a particular newsgroup.
  535. To log commits, use the `loginfo' file (*note loginfo::.).  To log
  536. commits, checkouts, exports, and tags, respectively, you can also use
  537. the `-i', `-o', `-e', and `-t' options in the modules file.  For a more
  538. flexible way of giving notifications to various users, which requires
  539. less in the way of keeping centralized scripts up to date, use the `cvs
  540. watch add' command (*note Getting Notified::.); this command is useful
  541. even if you are not using `cvs watch on'.
  542.  
  543.    The `taginfo' file defines programs to execute when someone executes
  544. a `tag' or `rtag' command.  The `taginfo' file has the standard form
  545. for administrative files (*note Administrative files::.), where each
  546. line is a regular expression followed by a command to execute.  The
  547. arguments passed to the command are, in order, the TAGNAME, OPERATION
  548. (`add' for `tag', `mov' for `tag -F', and `del' for `tag -d'),
  549. REPOSITORY, and any remaining are pairs of FILENAME REVISION.  A
  550. non-zero exit of the filter program will cause the tag to be aborted.
  551.  
  552. 
  553. File: cvs.info,  Node: annotate,  Prev: user-defined logging,  Up: History browsing
  554.  
  555. Annotate command
  556. ================
  557.  
  558.  - Command: cvs annotate [`-lf'] [`-r rev'|`-D date'] FILES ...
  559.      For each file in FILES, print the head revision of the trunk,
  560.      together with information on the last modification for each line.
  561.      For example:
  562.  
  563.           $ cvs annotate ssfile
  564.           Annotations for ssfile
  565.           ***************
  566.           1.1          (mary     27-Mar-96): ssfile line 1
  567.           1.2          (joe      28-Mar-96): ssfile line 2
  568.  
  569.      The file `ssfile' currently contains two lines.  The `ssfile line
  570.      1' line was checked in by `mary' on March 27.  Then, on March 28,
  571.      `joe' added a line `ssfile line 2', without modifying the `ssfile
  572.      line 1' line.  This report doesn't tell you anything about lines
  573.      which have been deleted or replaced; you need to use `cvs diff'
  574.      for that (*note diff::.).
  575.  
  576.  
  577.    These standard options are available with `annotate' (*note Common
  578. options::., for a complete description of them):
  579.  
  580. `-D DATE'
  581.      Annotate the most recent revision no later than DATE.
  582.  
  583. `-f'
  584.      Only useful with the `-D DATE' or `-r TAG' flags.  If no matching
  585.      revision is found, annotate the most recent revision (instead of
  586.      ignoring the file).
  587.  
  588. `-l'
  589.      Local; run only in current working directory.  *Note Recursive
  590.      behavior::.
  591.  
  592. `-r TAG'
  593.      Annotate revision TAG.
  594.  
  595. 
  596. File: cvs.info,  Node: Keyword substitution,  Next: Binary files,  Prev: History browsing,  Up: Top
  597.  
  598. Keyword substitution
  599. ********************
  600.  
  601.    As long as you edit source files inside your working copy of a
  602. module you can always find out the state of your files via `cvs status'
  603. and `cvs log'.  But as soon as you export the files from your
  604. development environment it becomes harder to identify which revisions
  605. they are.
  606.  
  607.    RCS uses a mechanism known as "keyword substitution" (or "keyword
  608. expansion") to help identifying the files.  Embedded strings of the form
  609. `$KEYWORD$' and `$KEYWORD:...$' in a file are replaced with strings of
  610. the form `$KEYWORD:VALUE$' whenever you obtain a new revision of the
  611. file.
  612.  
  613. * Menu:
  614.  
  615. * Keyword list::                RCS Keywords
  616. * Using keywords::              Using keywords
  617. * Avoiding substitution::       Avoiding substitution
  618. * Substitution modes::          Substitution modes
  619. * Log keyword::                 Problems with the $Log$ keyword.
  620.  
  621. 
  622. File: cvs.info,  Node: Keyword list,  Next: Using keywords,  Up: Keyword substitution
  623.  
  624. RCS Keywords
  625. ============
  626.  
  627.    This is a list of the keywords that RCS currently (in release
  628. 5.6.0.1) supports:
  629.  
  630. `$Author$'
  631.      The login name of the user who checked in the revision.
  632.  
  633. `$Date$'
  634.      The date and time (UTC) the revision was checked in.
  635.  
  636. `$Header$'
  637.      A standard header containing the full pathname of the RCS file,
  638.      the revision number, the date (UTC), the author, the state, and
  639.      the locker (if locked).  Files will normally never be locked when
  640.      you use CVS.
  641.  
  642. `$Id$'
  643.      Same as `$Header$', except that the RCS filename is without a path.
  644.  
  645. `$Name$'
  646.      Tag name used to check out this file.
  647.  
  648. `$Locker$'
  649.      The login name of the user who locked the revision (empty if not
  650.      locked, and thus almost always useless when you are using CVS).
  651.  
  652. `$Log$'
  653.      The log message supplied during commit, preceded by a header
  654.      containing the RCS filename, the revision number, the author, and
  655.      the date (UTC).  Existing log messages are *not* replaced.
  656.      Instead, the new log message is inserted after `$Log:...$'.  Each
  657.      new line is prefixed with a "comment leader" which RCS guesses
  658.      from the file name extension.  It can be changed with `cvs admin
  659.      -c'.  *Note admin options::.  This keyword is useful for
  660.      accumulating a complete change log in a source file, but for
  661.      several reasons it can be problematic.  *Note Log keyword::.
  662.  
  663. `$RCSfile$'
  664.      The name of the RCS file without a path.
  665.  
  666. `$Revision$'
  667.      The revision number assigned to the revision.
  668.  
  669. `$Source$'
  670.      The full pathname of the RCS file.
  671.  
  672. `$State$'
  673.      The state assigned to the revision.  States can be assigned with
  674.      `cvs admin -s'--*Note admin options::.
  675.  
  676. 
  677. File: cvs.info,  Node: Using keywords,  Next: Avoiding substitution,  Prev: Keyword list,  Up: Keyword substitution
  678.  
  679. Using keywords
  680. ==============
  681.  
  682.    To include a keyword string you simply include the relevant text
  683. string, such as `$Id$', inside the file, and commit the file.  CVS will
  684. automatically expand the string as part of the commit operation.
  685.  
  686.    It is common to embed `$Id$' string in the C source code.  This
  687. example shows the first few lines of a typical file, after keyword
  688. substitution has been performed:
  689.  
  690.      static char *rcsid="$Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
  691.      /* The following lines will prevent `gcc' version 2.X
  692.         from issuing an "unused variable" warning. */
  693.      #if __GNUC__ == 2
  694.      #define USE(var) static void * use_##var = (&use_##var, (void *) &var)
  695.      USE (rcsid);
  696.      #endif
  697.  
  698.    Even though a clever optimizing compiler could remove the unused
  699. variable `rcsid', most compilers tend to include the string in the
  700. binary.  Some compilers have a `#pragma' directive to include literal
  701. text in the binary.
  702.  
  703.    The `ident' command (which is part of the RCS package) can be used
  704. to extract keywords and their values from a file.  This can be handy
  705. for text files, but it is even more useful for extracting keywords from
  706. binary files.
  707.  
  708.      $ ident samp.c
  709.      samp.c:
  710.           $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  711.      $ gcc samp.c
  712.      $ ident a.out
  713.      a.out:
  714.           $Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
  715.  
  716.    SCCS is another popular revision control system.  It has a command,
  717. `what', which is very similar to `ident' and used for the same purpose.
  718. Many sites without RCS have SCCS.  Since `what' looks for the
  719. character sequence `@(#)' it is easy to include keywords that are
  720. detected by either command.  Simply prefix the RCS keyword with the
  721. magic SCCS phrase, like this:
  722.  
  723.      static char *id="@(#) $Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
  724.  
  725. 
  726. File: cvs.info,  Node: Avoiding substitution,  Next: Substitution modes,  Prev: Using keywords,  Up: Keyword substitution
  727.  
  728. Avoiding substitution
  729. =====================
  730.  
  731.    Keyword substitution has its disadvantages.  Sometimes you might
  732. want the literal text string `$Author$' to appear inside a file without
  733. RCS interpreting it as a keyword and expanding it into something like
  734. `$Author: ceder $'.
  735.  
  736.    There is unfortunately no way to selectively turn off keyword
  737. substitution.  You can use `-ko' (*note Substitution modes::.) to turn
  738. off keyword substitution entirely.
  739.  
  740.    In many cases you can avoid using RCS keywords in the source, even
  741. though they appear in the final product.  For example, the source for
  742. this manual contains `$@asis{}Author$' whenever the text `$Author$'
  743. should appear.  In `nroff' and `troff' you can embed the null-character
  744. `\&' inside the keyword for a similar effect.
  745.  
  746. 
  747. File: cvs.info,  Node: Substitution modes,  Next: Log keyword,  Prev: Avoiding substitution,  Up: Keyword substitution
  748.  
  749. Substitution modes
  750. ==================
  751.  
  752.    Each file has a stored default substitution mode, and each working
  753. directory copy of a file also has a substitution mode.  The former is
  754. set by the `-k' option to `cvs add' and `cvs admin'; the latter is set
  755. by the -k or -A options to `cvs checkout' or `cvs update'.  `cvs diff'
  756. also has a `-k' option.  For some examples, *Note Binary files::.
  757.  
  758.    The modes available are:
  759.  
  760. `-kkv'
  761.      Generate keyword strings using the default form, e.g.  `$Revision:
  762.      5.7 $' for the `Revision' keyword.
  763.  
  764. `-kkvl'
  765.      Like `-kkv', except that a locker's name is always inserted if the
  766.      given revision is currently locked.  This option is normally not
  767.      useful when CVS is used.
  768.  
  769. `-kk'
  770.      Generate only keyword names in keyword strings; omit their values.
  771.      For example, for the `Revision' keyword, generate the string
  772.      `$Revision$' instead of `$Revision: 5.7 $'.  This option is useful
  773.      to ignore differences due to keyword substitution when comparing
  774.      different revisions of a file.
  775.  
  776. `-ko'
  777.      Generate the old keyword string, present in the working file just
  778.      before it was checked in.  For example, for the `Revision'
  779.      keyword, generate the string `$Revision: 1.1 $' instead of
  780.      `$Revision: 5.7 $' if that is how the string appeared when the
  781.      file was checked in.
  782.  
  783. `-kb'
  784.      Like `-ko', but also inhibit conversion of line endings between
  785.      the canonical form in which they are stored in the repository
  786.      (linefeed only), and the form appropriate to the operating system
  787.      in use on the client.  For systems, like unix, which use linefeed
  788.      only to terminate lines, this is the same as `-ko'.  For more
  789.      information on binary files, see *Note Binary files::.
  790.  
  791. `-kv'
  792.      Generate only keyword values for keyword strings.  For example,
  793.      for the `Revision' keyword, generate the string `5.7' instead of
  794.      `$Revision: 5.7 $'.  This can help generate files in programming
  795.      languages where it is hard to strip keyword delimiters like
  796.      `$Revision: $' from a string.  However, further keyword
  797.      substitution cannot be performed once the keyword names are
  798.      removed, so this option should be used with care.
  799.  
  800.      One often would like to use `-kv' with `cvs export'--*note
  801.      export::..  But be aware that doesn't handle an export containing
  802.      binary files correctly.
  803.  
  804. 
  805. File: cvs.info,  Node: Log keyword,  Prev: Substitution modes,  Up: Keyword substitution
  806.  
  807. Problems with the $Log$ keyword.
  808. ================================
  809.  
  810.    The `$Log$' keyword is somewhat controversial.  As long as you are
  811. working on your development system the information is easily accessible
  812. even if you do not use the `$Log$' keyword--just do a `cvs log'.  Once
  813. you export the file the history information might be useless anyhow.
  814.  
  815.    A more serious concern is that RCS is not good at handling `$Log$'
  816. entries when a branch is merged onto the main trunk.  Conflicts often
  817. result from the merging operation.
  818.  
  819.    People also tend to "fix" the log entries in the file (correcting
  820. spelling mistakes and maybe even factual errors).  If that is done the
  821. information from `cvs log' will not be consistent with the information
  822. inside the file.  This may or may not be a problem in real life.
  823.  
  824.    It has been suggested that the `$Log$' keyword should be inserted
  825. *last* in the file, and not in the files header, if it is to be used at
  826. all.  That way the long list of change messages will not interfere with
  827. everyday source file browsing.
  828.  
  829. 
  830. File: cvs.info,  Node: Binary files,  Next: Revision management,  Prev: Keyword substitution,  Up: Top
  831.  
  832. Handling binary files
  833. *********************
  834.  
  835.    There are two issues with using CVS to store binary files.  The
  836. first is that CVS by default convert line endings between the canonical
  837. form in which they are stored in the repository (linefeed only), and
  838. the form appropriate to the operating system in use on the client (for
  839. example, carriage return followed by line feed for Windows NT).
  840.  
  841.    The second is that a binary file might happen to contain data which
  842. looks like a keyword (*note Keyword substitution::.), so keyword
  843. expansion must be turned off.
  844.  
  845.    The `-kb' option available with some CVS commands insures that
  846. neither line ending conversion nor keyword expansion will be done.  If
  847. you are using an old version of RCS without this option, and you are
  848. using an operating system, such as unix, which terminates lines with
  849. linefeeds only, you can use `-ko' instead; if you are on another
  850. operating system, upgrade to a version of RCS, such as 5.7 or later,
  851. which supports `-kb'.
  852.  
  853.    Here is an example of how you can create a new file using the `-kb'
  854. flag:
  855.  
  856.      $ echo '$Id$' > kotest
  857.      $ cvs add -kb -m"A test file" kotest
  858.      $ cvs ci -m"First checkin; contains a keyword" kotest
  859.  
  860.    If a file accidentally gets added without `-kb', one can use the
  861. `cvs admin' command to recover.  For example:
  862.  
  863.      $ echo '$Id$' > kotest
  864.      $ cvs add -m"A test file" kotest
  865.      $ cvs ci -m"First checkin; contains a keyword" kotest
  866.      $ cvs admin -kb kotest
  867.      $ cvs update -A kotest
  868.      $ cvs commit -m "make it binary" kotest  # For non-unix systems
  869.  
  870.    When you check in the file `kotest' the keywords are expanded.  (Try
  871. the above example, and do a `cat kotest' after every command).  The `cvs
  872. admin -kb' command sets the default keyword substitution method for
  873. this file, but it does not alter the working copy of the file that you
  874. have.  The easiest way to get the unexpanded version of `kotest' is
  875. `cvs update -A'.  If you need to cope with line endings (that is, you
  876. are using a CVS client on a non-unix system), then you need to check in
  877. a new copy of the file, as shown by the `cvs commit' command above.
  878.  
  879.    However, in using `cvs admin -k' to change the keyword expansion, be
  880. aware that the keyword expansion mode is not version controlled.  This
  881. means that, for example, that if you have a text file in old releases,
  882. and a binary file with the same name in new releases, CVS provides no
  883. way to check out the file in text or binary mode depending on what
  884. version you are checking out.  There is no good workaround for this
  885. problem.
  886.  
  887.    You can also set a default for whether `cvs add' and `cvs import'
  888. treat a file as binary based on its name; for example you could say
  889. that files who names end in `.exe' are binary.  *Note Wrappers::.
  890.  
  891. 
  892. File: cvs.info,  Node: Revision management,  Next: Invoking CVS,  Prev: Binary files,  Up: Top
  893.  
  894. Revision management
  895. *******************
  896.  
  897.    If you have read this far, you probably have a pretty good grasp on
  898. what CVS can do for you.  This chapter talks a little about things that
  899. you still have to decide.
  900.  
  901.    If you are doing development on your own using CVS you could
  902. probably skip this chapter.  The questions this chapter takes up become
  903. more important when more than one person is working in a repository.
  904.  
  905. * Menu:
  906.  
  907. * When to commit::              Some discussion on the subject
  908.  
  909. 
  910. File: cvs.info,  Node: When to commit,  Up: Revision management
  911.  
  912. When to commit?
  913. ===============
  914.  
  915.    Your group should decide which policy to use regarding commits.
  916. Several policies are possible, and as your experience with CVS grows
  917. you will probably find out what works for you.
  918.  
  919.    If you commit files too quickly you might commit files that do not
  920. even compile.  If your partner updates his working sources to include
  921. your buggy file, he will be unable to compile the code.  On the other
  922. hand, other persons will not be able to benefit from the improvements
  923. you make to the code if you commit very seldom, and conflicts will
  924. probably be more common.
  925.  
  926.    It is common to only commit files after making sure that they can be
  927. compiled.  Some sites require that the files pass a test suite.
  928. Policies like this can be enforced using the commitinfo file (*note
  929. commitinfo::.), but you should think twice before you enforce such a
  930. convention.  By making the development environment too controlled it
  931. might become too regimented and thus counter-productive to the real
  932. goal, which is to get software written.
  933.  
  934. 
  935. File: cvs.info,  Node: Invoking CVS,  Next: Administrative files,  Prev: Revision management,  Up: Top
  936.  
  937. Reference manual for CVS commands
  938. *********************************
  939.  
  940.    This appendix describes how to invoke CVS, and describes in detail
  941. those subcommands of CVS which are not fully described elsewhere.  To
  942. look up a particular subcommand, see *Note Index::.
  943.  
  944. * Menu:
  945.  
  946. * Structure::                   Overall structure of CVS commands
  947. * ~/.cvsrc::                    Default options with the ~/.csvrc file
  948. * Global options::              Options you give to the left of cvs_command
  949. * Common options::              Options you give to the right of cvs_command
  950. * admin::                       Administration front end for rcs
  951. * checkout::                    Checkout sources for editing
  952. * commit::                      Check files into the repository
  953. * diff::                        Run diffs between revisions
  954. * export::                      Export sources from CVS, similar to checkout
  955. * history::                     Show status of files and users
  956. * import::                      Import sources into CVS, using vendor branches
  957. * log::                         Print out 'rlog' information for files
  958. * rdiff::                       'patch' format diffs between releases
  959. * release::                     Indicate that a Module is no longer in use
  960. * rtag::                        Add a tag to a module
  961. * status::                      Status info on the revisions
  962. * tag::                         Add a tag to checked out version
  963. * update::                      Bring work tree in sync with repository
  964.  
  965. 
  966. File: cvs.info,  Node: Structure,  Next: ~/.cvsrc,  Up: Invoking CVS
  967.  
  968. Overall structure of CVS commands
  969. =================================
  970.  
  971.    The overall format of all CVS commands is:
  972.  
  973.      cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
  974.  
  975. `cvs'
  976.      The name of the CVS program.
  977.  
  978. `cvs_options'
  979.      Some options that affect all sub-commands of CVS.  These are
  980.      described below.
  981.  
  982. `cvs_command'
  983.      One of several different sub-commands.  Some of the commands have
  984.      aliases that can be used instead; those aliases are noted in the
  985.      reference manual for that command.  There are only two situations
  986.      where you may omit `cvs_command': `cvs -H' elicits a list of
  987.      available commands, and `cvs -v' displays version information on
  988.      CVS itself.
  989.  
  990. `command_options'
  991.      Options that are specific for the command.
  992.  
  993. `command_args'
  994.      Arguments to the commands.
  995.  
  996.    There is unfortunately some confusion between `cvs_options' and
  997. `command_options'.  `-l', when given as a `cvs_option', only affects
  998. some of the commands.  When it is given as a `command_option' is has a
  999. different meaning, and is accepted by more commands.  In other words,
  1000. do not take the above categorization too seriously.  Look at the
  1001. documentation instead.
  1002.  
  1003. 
  1004. File: cvs.info,  Node: ~/.cvsrc,  Next: Global options,  Prev: Structure,  Up: Invoking CVS
  1005.  
  1006. Default options and the ~/.cvsrc file
  1007. =====================================
  1008.  
  1009.    There are some `command_options' that are used so often that you
  1010. might have set up an alias or some other means to make sure you always
  1011. specify that option.  One example (the one that drove the
  1012. implementation of the .cvsrc support, actually) is that many people
  1013. find the default output of the `diff' command to be very hard to read,
  1014. and that either context diffs or unidiffs are much easier to understand.
  1015.  
  1016.    The `~/.cvsrc' file is a way that you can add default options to
  1017. `cvs_commands' within cvs, instead of relying on aliases or other shell
  1018. scripts.
  1019.  
  1020.    The format of the `~/.cvsrc' file is simple.  The file is searched
  1021. for a line that begins with the same name as the `cvs_command' being
  1022. executed.  If a match is found, then the remainder of the line is split
  1023. up (at whitespace characters) into separate options and added to the
  1024. command arguments *before* any options from the command line.
  1025.  
  1026.    If a command has two names (e.g., `checkout' and `co'), the official
  1027. name, not necessarily the one used on the command line, will be used to
  1028. match against the file.  So if this is the contents of the user's
  1029. `~/.cvsrc' file:
  1030.  
  1031.      log -N
  1032.      diff -u
  1033.      update -P
  1034.      co -P
  1035.  
  1036. the command `cvs checkout foo' would have the `-P' option added to the
  1037. arguments, as well as `cvs co foo'.
  1038.  
  1039.    With the example file above, the output from `cvs diff foobar' will
  1040. be in unidiff format.  `cvs diff -c foobar' will provide context diffs,
  1041. as usual.  Getting "old" format diffs would be slightly more
  1042. complicated, because `diff' doesn't have an option to specify use of
  1043. the "old" format, so you would need `cvs -f diff foobar'.
  1044.  
  1045.    In place of the command name you can use `cvs' to specify global
  1046. options (*note Global options::.).  For example the following line in
  1047. `.cvsrc'
  1048.  
  1049.      cvs -z6
  1050.  
  1051.    causes CVS to use compression level 6
  1052.  
  1053. 
  1054. File: cvs.info,  Node: Global options,  Next: Common options,  Prev: ~/.cvsrc,  Up: Invoking CVS
  1055.  
  1056. Global options
  1057. ==============
  1058.  
  1059.    The available `cvs_options' (that are given to the left of
  1060. `cvs_command') are:
  1061.  
  1062. `-b BINDIR'
  1063.      Use BINDIR as the directory where RCS programs are located.
  1064.      Overrides the setting of the `$RCSBIN' environment variable and
  1065.      any precompiled directory.  This parameter should be specified as
  1066.      an absolute pathname.
  1067.  
  1068. `-T TEMPDIR'
  1069.      Use TEMPDIR as the directory where temporary files are located.
  1070.      Overrides the setting of the `$TMPDIR' environment variable and
  1071.      any precompiled directory.  This parameter should be specified as
  1072.      an absolute pathname.
  1073.  
  1074. `-d CVS_ROOT_DIRECTORY'
  1075.      Use CVS_ROOT_DIRECTORY as the root directory pathname of the
  1076.      repository.  Overrides the setting of the `$CVSROOT' environment
  1077.      variable.  *Note Repository::.
  1078.  
  1079. `-e EDITOR'
  1080.      Use EDITOR to enter revision log information.  Overrides the
  1081.      setting of the `$CVSEDITOR' and `$EDITOR' environment variables.
  1082.  
  1083. `-f'
  1084.      Do not read the `~/.cvsrc' file.  This option is most often used
  1085.      because of the non-orthogonality of the CVS option set.  For
  1086.      example, the `cvs log' option `-N' (turn off display of tag names)
  1087.      does not have a corresponding option to turn the display on.  So
  1088.      if you have `-N' in the `~/.cvsrc' entry for `log', you may need
  1089.      to use `-f' to show the tag names.
  1090.  
  1091. `-H'
  1092.      Display usage information about the specified `cvs_command' (but
  1093.      do not actually execute the command).  If you don't specify a
  1094.      command name, `cvs -H' displays a summary of all the commands
  1095.      available.
  1096.  
  1097. `-l'
  1098.      Do not log the cvs_command in the command history (but execute it
  1099.      anyway).  *Note history::, for information on command history.
  1100.  
  1101. `-n'
  1102.      Do not change any files.  Attempt to execute the `cvs_command',
  1103.      but only to issue reports; do not remove, update, or merge any
  1104.      existing files, or create any new files.
  1105.  
  1106. `-Q'
  1107.      Cause the command to be really quiet; the command will only
  1108.      generate output for serious problems.
  1109.  
  1110. `-q'
  1111.      Cause the command to be somewhat quiet; informational messages,
  1112.      such as reports of recursion through subdirectories, are
  1113.      suppressed.
  1114.  
  1115. `-r'
  1116.      Make new working files files read-only.  Same effect as if the
  1117.      `$CVSREAD' environment variable is set (*note Environment
  1118.      variables::.).  The default is to make working files writable,
  1119.      unless watches are on (*note Watches::.).
  1120.  
  1121. `-s VARIABLE=VALUE'
  1122.      Set a user variable (*note Variables::.).
  1123.  
  1124. `-t'
  1125.      Trace program execution; display messages showing the steps of CVS
  1126.      activity.  Particularly useful with `-n' to explore the potential
  1127.      impact of an unfamiliar command.
  1128.  
  1129. `-v'
  1130.      Display version and copyright information for CVS.
  1131.  
  1132. `-w'
  1133.      Make new working files read-write.  Overrides the setting of the
  1134.      `$CVSREAD' environment variable.  Files are created read-write by
  1135.      default, unless `$CVSREAD' is set or `-r' is given.
  1136.  
  1137. `-x'
  1138.      Encrypt all communication between the client and the server.  Only
  1139.      has an effect on the CVS client.  As of this writing, this is only
  1140.      implemented when using a Kerberos connection (*note Kerberos
  1141.      authenticated::.).  Encryption support is not available by
  1142.      default; it must be enabled using a special configure option,
  1143.      `--enable-encryption', when you build CVS.
  1144.  
  1145. `-z GZIP-LEVEL'
  1146.      Set the compression level.  Only has an effect on the CVS client.
  1147.  
  1148.