[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5. Commands


The nodes in this menu contains explanations about all the commands that you can use in PCL-CVS. They are grouped together by type.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.1 Entering PCL-CVS


Most commands in PCL-CVS require that you have a `*cvs*' buffer. The commands that you use to get one are listed below. For each, a `cvs' process will be run, the output will be parsed by PCL-CVS, and the result will be printed in the `*cvs*' buffer (see 3. Buffer contents, for a description of the buffer's contents).

M-x cvs-update
Run a `cvs update' command. You will be asked for the directory in which the `cvs update' will be run.

M-x cvs-examine
Run a `cvs -n update' command. This is identical to the previous command, except that it will only check what needs to be done but will not change anything. You will be asked for the directory in which the `cvs -n update' will be run.

M-x cvs-status
Run a `cvs status' command. You will be asked for the directory in which the `cvs status' will be run.

M-x cvs-checkout
Run a `cvs checkout' command. You will be asked for the directory in which the `cvs update' will be run and the module to be checked out.

M-x cvs-quickdir
Populate the `*cvs*' buffer by just looking at the `CVS/Entries' files. This is very much like cvs-examine except that it does not access the CVS repository, which is a major advantage when the repository is far away. But of course, it will not be able to detect when a file needs to be updated or merged.

The first four of those commands are also reachable from the menu bar under `Tools->PCL-CVS'. Finally, an alternative way is to visit the CVS administrative subdirectory in your work area with a simple prefix argument. For example C-u C-x C-f ~/my/work/CVS RET. This by default runs cvs-quickdir but the specific behavior can be changed with cvs-dired-action and cvs-dired-use-hook.

By default, the commands above will descend recursively into subdirectories. You can avoid that behavior by including `-l' in the flags for the command. These flags can be set by giving a prefix argument to the command (e.g., by typing C-u M-x cvs-update RET -l RET).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.2 Setting flags for CVS commands


This section describes the convention used by nearly all PCL-CVS commands for setting optional flags sent to CVS. A single C-u prefix argument is used to cause the command to prompt for flags to be used for the current invocation of the command only. Two C-u prefix arguments are used to prompt for flags which will be set permanently, for the current invocation and all that follow, until the flags are changed, or unless temporary flags are set which override them.

Perhaps an example or two is in order. Say you are about to add a binary file to the repository, and want to specify the flags `-kb' to `cvs add'. You can type C-u a -kb RET, and the file will be added. Subsequent `cvs add' commands will use the previously prevailing flags.

As a second example, say you are about to perform a diff and want to see the result in unified diff format, i.e. you'd like to pass the flag `-u' to both `cvs diff' and `diff'. You'd also like all subsequent diffs to use this flag. You can type C-u C-u = -u RET and the diff will be performed, and the default flags will be set to ("-u"). You can of course override this flag for a single diff by using a single C-u prefix argument.

In addition to this, some commands can take special prefix arguments. These work as follows: When called with a C-u prefix, the user is prompted for a new value of the special prefix and the special prefix is activated for the next command. When called without the C-u prefix, the special prefix is re-activated (with the same value as last time) for the next command. Calling the prefix command again when it's already activated deactivates it. Calling it with the C-u C-u prefix activates it for all subsequent commands until you deactivate it explicitly. The special prefixes are:

Toggles whether or not marks will be active in the next command.

Provide the next command with a branch (can be any version specifier) to work on.

Secondary branch argument. Only meaningful if b is also used. It can be used to provide a second branch argument to cvs-mode-diff or to cvs-mode-update.

Forces the next command to apply to every selected file rather than only to the ones PCL-CVS thinks are relevant.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.3 Updating the `*cvs*' buffer


The following commands can be used from within the `*cvs*' buffer to update the display:

Runs the command `cvs-update'.

Runs the command `cvs-examine'.

Runs the command `cvs-status'.

In addition to the above commands which operate on the whole module, you can run the equivalent CVS command on just a subset of the files/directories with these keys:

Runs cvs-mode-update on the selected files. When run on the top-level directory, this is equivalent to M-u.

Runs cvs-mode-examine on the selected files. When run on the top-level directory, this is equivalent to M-e.

Runs cvs-mode-status on the selected files. When run on the top-level directory, this is equivalent to M-s, except that CVS output will be shown in a `*cvs-info*' buffer that will be put in `cvs-status-mode'.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.4 Movement Commands


You can use most normal Emacs commands to move forward and backward in the buffer. Some keys are rebound to functions that take advantage of the fact that the buffer is a PCL-CVS buffer:

These keys move the cursor one file forward, towards the end of the buffer (cvs-mode-next-line).

This key moves one file backward, towards the beginning of the buffer (cvs-mode-previous-line).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.5 Marking files


PCL-CVS works on a set of selected files (see 節 4. Selected files). You can mark and unmark files with these commands:

This marks the file that the cursor is positioned on. If the cursor is positioned on a directory all files in that directory are marked. (cvs-mode-mark).

Unmark the file that the cursor is positioned on. If the cursor is on a directory, all files in that directory are unmarked. (cvs-mode-unmark).

Mark all files in the buffer (cvs-mode-mark-all-files).

Unmark all files (cvs-mode-unmark-all-files).

Unmark the file on the previous line, and move point to that line (cvs-mode-unmark-up).

Mark all files matching a regular expression (cvs-mode-mark-matching-files).

Mark all files in a particular state, such as "Modified" or "Removed". (cvs-mode-mark-on-state).

Toggle use of marks for the next command (cvs-mode-toggle-marks).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.6 Committing changes


Committing changes basically works as follows:

  1. After having selected the files you want to commit, you type either c or C which brings up a special buffer `*cvs-commit*'.

  2. You type in the log message describing the changes you're about to commit (see 節 6. Editing a Log Message).

  3. When you're happy with it, you type C-c C-c to do the actual commit.

There's no hidden state, so you can abort the process or pick it up again at any time.

The set of files actually committed is really decided only during the very last step, which is a mixed blessing. It allows you to go back and change your mind about which files to commit, but it also means that you might inadvertently change the set of selected files. To reduce the risk of error, C-c C-c will ask for confirmation if the set of selected files has changed between the first step and the last. You can change this last detail with log-edit-confirm.

As for the difference between c (i.e. cvs-mode-commit) and C (i.e. cvs-mode-commit-setup) is that the first gets you straight to `*cvs-commit*' without erasing it or changing anything to its content, while the second first erases `*cvs-commit*' and tries to initialize it with a sane default (it does that by either using a template provided by the CVS administrator or by extracting a relevant log message from a `ChangeLog' file).

If you are editing the files in your Emacs, an automatic `revert-buffer' will be performed. (If the file contains `$Id$' keywords, `cvs commit' will write a new file with the new values substituted. The auto-revert makes sure that you get them into your buffer). The revert will not occur if you have modified your buffer, or if `cvs-auto-revert' is set to `nil'.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.7 Editing files


There are currently three commands that can be used to find a file (that is, load it into a buffer and start editing it there). These commands work on the line that the cursor is situated at. They always ignore any marked files.

Find the file that the cursor points to (cvs-mode-find-file). If the cursor points to a directory, run dired on that directory; See Info file `emacs', node `Dired'.

Like f, but use another window (cvs-mode-find-file-other-window).

Invoke `add-change-log-entry-other-window' to edit a `ChangeLog' file. The `ChangeLog' file will be found in the directory of the file the cursor points to, or in a parent of that directory. (cvs-mode-add-change-log-entry-other-window).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.8 Getting info about files


Call the command cvs-mode-log which runs `cvs log' on all selected files, and show the result in a temporary buffer `*cvs-info*' (see 節 7. Browsing a Log of Changes).

Call the command cvs-mode-status which runs `cvs status' on all selected files, and show the result in a temporary buffer `*cvs-info*'.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.9 Adding and removing files


The following commands are available to make it easy to add files to and remove them from the CVS repository.

Add all selected files. This command can be used on `Unknown' files (see 節 3. Buffer contents). The status of the file will change to `Added', and you will have to use c (`cvs-mode-commit' see 節 5.6 Committing changes), to really add the file to the repository.

This command can also be used on `Removed' files (before you commit them) to resurrect them.

The command that is run is cvs-mode-add.

This command removes the selected files (after prompting for confirmation). The files are deleted from your directory and (unless the status was `Unknown'; see 節 3. Buffer contents) they will also be `cvs remove'd. If the files' status was `Unknown' they will disappear from the buffer. Otherwise their status will change to `Removed', and you must use c (`cvs-mode-commit', see 節 5.6 Committing changes) to commit the removal.

The command that is run is cvs-mode-remove-file.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.10 Undoing changes


If you have modified a file, and for some reason decide that you don't want to keep the changes, you can undo them with this command. It works by removing your working copy of the file and then getting the latest version from the repository (cvs-mode-undo-local-changes.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.11 Removing handled entries


This command allows you to remove all entries that you have processed. More specifically, the lines for `Up-to-date' files (see 節 3. Buffer contents) are removed from the buffer. If a directory becomes empty the heading for that directory is also removed. This makes it easier to get an overview of what needs to be done.

x invokes cvs-mode-remove-handled. If `cvs-auto-remove-handled' is set to non-nil, this will automatically be performed after every commit.

This command can be used for lines that `cvs-mode-remove-handled' would not delete, but that you want to delete (cvs-mode-acknowledge).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.12 Ignoring files


Arrange so that CVS will ignore the selected files. The file names are added to the `.cvsignore' file in the corresponding directory. If the `.cvsignore' file doesn't exist, it will be created.

The `.cvsignore' file should normally be added to the repository, but you could ignore it as well, if you like it better that way.

This runs cvs-mode-ignore.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.13 Viewing differences


d =
Display a `cvs diff' between the selected files and the version that they are based on. (cvs-mode-diff).

d b
If CVS finds a conflict while merging two versions of a file (during a `cvs update', see 節 5.3 Updating the `*cvs*' buffer) it will save the original file in a file called `.#file.version' where file is the name of the file, and version is the revision number that file was based on.

With the d b command you can run a `diff' on the files `.#file.version' and `file'.

d h
Display a `cvs diff' between the selected files and the head revision in the repository (the most recent version on the current branch) (cvs-mode-diff-head).

d r
Display a `cvs diff' between the base revision of the selected files and the head revision in the repository. This displays the changes anyone has committed to the repository since you last executed "checkout", "update" or "commit". (cvs-mode-diff-repository).

d v
Display a `cvs diff' between the selected files and the head revision of the vendor branch in the repository. (cvs-mode-diff-vendor).

d y
Display a `cvs diff' between the selected files and yesterday's head revision in the repository. (cvs-mode-diff-yesterday).

By default, `diff' commands ignore the marks. This can be changed with cvs-invert-ignore-marks.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.14 Running ediff


d e
This uses ediff (or emerge, depending on `cvs-idiff-imerge-handlers') to allow you to view diffs. If a prefix argument is given, PCL-CVS will prompt for a revision against which the diff should be made, else the default will be to use the BASE revision.

d E
This command use ediff (or emerge, see above) to allow you to do an interactive 3-way merge.

Please note: when the file status is `Conflict', CVS has already performed a merge. The resulting file is not used in any way if you use this command. If you use the q command inside `ediff' (to successfully terminate a merge) the file that CVS created will be overwritten.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.15 Updating files


Update all selected files with status `Need-update' by running `cvs update' on them. (cvs-mode-update).

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.16 Tagging files


Tag all selected files by running `cvs tag' on them (cvs-mode-tag). It's usually preferable to tag a directory at a time. Rather than selecting all files (which too often doesn't select all files but only the few that are displayed), clear the selection with M-DEL (cvs-mode-unmark-all-files), position the cursor on the directory you want to tag and hit t.

By default, `tag' commands ignore the marks. This can be changed with cvs-invert-ignore-marks. Also, by default `tag' can only be applied to directories, see cvs-force-dir-tag if you want to change this behavior.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [表紙] [目次] [索引] [検索] [上端 / 下端] [?]

5.17 Miscellaneous commands


M-x cvs-mode-byte-compile-files
Byte compile all selected files that end in `.el'.

M-x cvs-mode-delete-lock
This command deletes the lock files that the `*cvs*' buffer informs you about. You should normally never have to use this command, since CVS tries very carefully to always remove the lock files itself.

You can only use this command when a message in the `*cvs*' buffer tells you so. You should wait a while before using this command in case someone else is running a cvs command.

Also note that this only works if the repository is local.

Show a summary of common command key bindings in the echo area (cvs-help).

Quit PCL-CVS, killing the `*cvs*' buffer (cvs-mode-quit).

[ << ] [ >> ]           [表紙] [目次] [索引] [検索] [上端 / 下端] [?]