# Management of the Acedb source code

The `AC package` is an internal set of scripts for managing the acedb source code. The Acedb code is under CVS management. For ease of use and safety several scripts have been written to control the cvs functions. The CVS system is only accessible on the local system to users in the 'acedb' user-group. For consistency reasons, users are being discouraged from using cvs commands directly.

## Operations on individual source files

All AC commands have a command line argument <file(s)>. It allows to perform the same action on multiple files. There are various ways is to specify the filename and its subdirectory, e.g. :

> aco w2/graphxt.c graph.h graphsubs.c

This will check out w2/graphxt.c wh/graph.h and w2/graphsubs.c. The subdirectory is optional. The script will first try to find the find the file in the current directory or look for it across all subdirectories (might take slightly longer).

### `aco` - checkout

aco <file(s)> checks out a file for editing.
First grabs the latest version from the repository, then registers the user as an editor and gives permission to edit the files locally.

### `aci` - checkin

aci <file(s)> checks in a file to the repository after editing.
The user is prompted for log information about the nature of the changes. The environment variable `$CVSEDITOR` specifies an editor to be used to enter the change-log text.
The modified user's copy is comitted to the repository and edit permissions are removed form the user's working directory. Other users editing this file at the same time are notified by mail about this action.

NOTE: Just in case the file was created in a DOS/Windows environment, all redundant PC-style control characters are removed prior to the "commit" action.

### `acu` - unedit

acu <file(s)> removes edit permissions on a file.
The user's local working copy is reverted back to the latest repository version and his edit permissions are revoked. Any modifications since checkout are therefor lost.

### `acg` - get latest

acg <file(s)> update/get new version of file from repository.
If the file already exists locally, the user's working copy is brought up to the date with the repository version. The user is warned if the file is being edited locally at the time.
If the file doesn't yet exist locally (another user has just recently created the file) the subdirectory in which it is supposed to appear has to be specified. Warnings are given if such file doesn't exist in the repository.

### `acr` - create

acr <file(s)> adds the new file to the repository.
The file is expected to already exist locally. A new repository entry is committed for the file with a default log message saying `"initial revision"`. The file is then set to read-only premissions locally. And from then on, `aco` has to be used to check out a editable copy of this file.

NOTE: Just in case the file was created in a DOS/Windows environment, all redundant PC-style control characters are removed prior to the "commit" action.

### `acx` - remove

acx <file(s)> removes the file locally and from the repository.
The user is queried for safety, and after a positive answer the file is removed in the user's working copy and then marked deleted from the repository.

NOTE: The files doesn't realy disappear. All its old changelogs will continue to reside in the so-called attic of the repository, but it won't show up in the active copy. `acetree` will remove a local copy of a dead file in another user's working copy to reflect that change throughout all copies of the source tree.

### `acd` - diff

acd <file(s)> reports the differences between the users local working copy of the file(s) and the repository version.

### `acm` - move/rename

amv <newpath> <file(s)> moves/renames the the file
This command behaves similarly to the UNIX command '`mv`', but the new path is specified first. This is slightly unusual, but it brings this command in line with all the others in term of the variable-length <file(s)> parameter list. If a file is to be renamed, only one filename is allowed in this parameter-list.

amv <wnew> file1.c w2/file2.c - finds which subdir file1.c is in and moves it to wnew, then moves w2/file2.c to wnew
amv <wnew/newfile.c> oldfile.c - finds the subdir of oldfile.c, then moves it to wnew and renames it. If no new directory is specified, oldfile.c is renamed within its present directory.

### `aclog` - log

aclog -d"timeformat" <file> will report all log reports for this file during the timeformat. If no timeformat then all log reports are given.

Example :
  `aprs -d">yesterday" call.c`
  gives all log reports since yesterday for file call.c

  `aprs -d"<10/19/97" call.c`
  gives all log reports before 19th October 1997 for file call.c

### `acw` - set watch

acw <file> sets a watch on the files.
Watches will cause the system to send out an email to the watcher if anything is being done about that file (e.g. a file is being edited, unedited, checked in etc.)
Although it does introduce some kind of ownership over a file it might be useful.
Any user who is trying to edit (check out) a watched file will be informed of who is watching it. Although the user is given the choice to abort the attempt to edit, it doens't impede anyone's right to edit a file anyway.

### `acwx` - remove watch

acx <file> removes the watch on the files.
This command will fail, if you are not currently watching the file.

## Operations spanning the whole tree

In addition to the AC commands which operate on single files there is a set of commands, that operate on entire directories or even the entire tree.

All ACE commands have an optional parameter list :-

<dir(s)>
  list of directories to include in operation, e.g.
  `aceinfo w1 w2 w4 wh`

  Use -a option as the <dir> parameter to include all system-defined directories in the operation.

  By default, the list specified in the user-defined file $ACEDB_SRC/DIRECTORIES is used.

  If no such user-defined default exists, the list in ~acedb/ALL_DIRECTORIES is used instead (as for the -a option)

### `acetree` - update

acetree [<dir(s)>] Updates user-copy of acedb-sourcetree from the CVS repository. Reports change-logs and gets new CVS master-versions. Lists currently checked out files.

Example :
  `mkdir ~/acedb`
  `setenv ACEDB_SRC ~/acedb`
  `acetree -a`
  Creates a local user copy of all source-tree directories in ~/acedb/. If specific directories are given on the command line instead of `-a`, only those directories will be copied locally.

### `aceinfo` - changelog

aceinfo [<dir(s)>] reports any differences between your version of the code and the repository's. It will also list who currently has checked out any of those files.

### `acegrep` - source-code search

acegrep <searchword> [<dir(s)>] performs global source-code search for in user-copy of acedb-sourcetree. In source-code directories, only C files will be considered (includes C++ and header files), but all files are searched in other directories (like whelp/).
If only lower-case letters are used in the searchword, grep is run with the -i flag (case-insensitivity). Upper-case letter force a case-sensitive search (similar to the regular search in emacs).
NOTE: for this command the optional <dir(s)> list starts with the second command line argument.

Example:
  `acegrep '\ main\ *(' -a`
  lists all files containing a main function over all directories in the local tree (overriding the personal DIRECTORIES list).

### `acewho` - who has what?

acewho [<searchword>] [<dir(s)>] - list the editors of all files.
The check-out signatures of all files in the specified (or all) directories are listed. Optionally the output list can be search for a string or regex (passed on to grep internally).
NOTE: If command line arguments are specified, the first one is takend to be the <searchword> parameter, if it isn't a local directory name.

Example:
  `acewho fw w2 wh`
  lists the files that are edited in w2/ and wh/ and only displays lines containing the string `fw`. It is just shorter for :
  `acewho w2 wh | grep fw`

  `acewho w1`
  lists all files in w1/ that being edited.

  `acewho edgrif -a`
  lists files edited by edgrif across all local directories (overriding the personal DIRECTORIES list).