www.delorie.com/gnu/docs/gnats/gnats_82.html   search  
Buy GNU books!

Keeping Track

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.8.4 The edit-pr driver

pr-edit does the background work for edit-pr, including error-checking and refiling newly edited Problem Reports, handling file and database locks and deletion of PRs. It can be called interactively, though it has no usable editing interface.

The usage for pr-edit is:

pr-edit   [ -l username | --lock=username ] [ -u | --unlockdb ]
          [ -L | --lockdb ] [ -U | --unlockdb ] [ -c | --check ]
          [ -C | --check-initial ] [ -s | --submit ]
          [ -a field | --append field=field ]
          [ -r field | --replace=field ] [ --delete-pr ]
          [ -R reason | --reason=reason ]
          [ -p process-id | --process=process-id ]
          [ -d databasename | --database=databasename ]
          [ -f filename | --filename=filename ]
          [ -V | --version ]
          [ -h | --help ] [ -v username | --user=username ]
          [ -w passwd | --passwd=passwd ]
          [ -H host | --host=host ]
          [ -P port | --port=port ]
          [ -D | --debug ] [ PR number ]

A lock is placed on a Problem Report while the PR is being edited. The lock is simply a file in the `locks' subdirectory of the `gnats-adm' directory of the database, with the name `gnats-id.lock', which contains the name of the user who created the lock. user then "owns" the lock, and must remove it before the PR can be locked again, even by the same user(3). If a PR is already locked when you attempt to edit it, pr-edit prints an error message giving the name of the user who is currently editing the PR.

If you do not specify PR number, pr-edit reads from standard input. You must specify PR number for the functions which affect PR locks, `--lock=username' and `--unlock'.

Locks the database specified with the --database or -d option. No PRs may be edited, created or deleted while the database is locked. This option is generally used when editing the index file.

Unlocks the specified database. No check is made that the invoking user actually had locked the database in the first place; hence, it is possible for anyone to steal a database lock.

The --check options are used to verify that a proposed PR's field contents are valid. The PR is read in (either from stdin or a file specified with --filename), and its fields are compared against the rules specified by the database configuration of the selected database. Warnings are given for enumerated fields whose contents do not contain one of the required values or fields that do not match required regexps. --check-initial is used to verify initial PRs, rather than proposed edits of existing PRs.

Used to submit a new PR to the database. The PR is read in and verified for content; if the PR is valid as an initial PR, it is then added to the database. A zero exit code is returned if the submission was successful. Otherwise, the reason(s) for the PR being rejected are printed to stdout, and a non-zero exit code is returned.

The following options require a PR number to be given.

Deletes the specified PR from the database. The PR must be in a closed state, and not locked. Only the user gnats (or the user name specified instead of gnats during the building of GNATS) is permitted to delete PRs.

-l username
Locks the PR. username is associated with the lock, so the system administrator can determine who actually placed the lock on the PR. However, anyone is permitted to remove locks on a PR. If the optional --process or -p option is also given, that process-id is associated with the lock.

Unlocks the specified PR.

-a field
-r field
--append and --replace are used to append or replace content of a specific field within a PR. The new field content is read in from stdin (or from the file specified with the --filename option), and either appended or replaced to the specified field. The field contents are verified for correctness before the PR is rewritten. If the edit is successful, a zero exit status is returned. If the edit failed, a non-zero exit status is returned, and the reasons for the failure are printed to stdout.

-R reason
Certain PR fields are configured in the database configuration to require a short text describing the reason of every change that happens to them, See section 4.3 The dbconfig file. If you edit a problem and change any of such fields, you must issue a short text, the reason of the change, through this option. If the option is used and no change-reason requiring field is actually changed, the option has no effect.

PR number
If only a PR number is specified with no other options, a replacement PR is read in (either from stdin or the file specified with --filename). If the PR contents are valid and correct, the existing PR is replaced with the new PR contents. If the edit is successful, a zero exit status is re turned. If the edit failed, a non-zero exit status is returned, and the reasons for the failure are printed to stdout.

-d database
Specifies the database which is to be manipulated. If no database is specified, the default database name set when GNATS was built is used (usually default). This option overrides the database specified in the GNATSDB environment variable.

-f filename
For actions that require reading in a PR or field content, this specifies the name of a file to read. If --filename is not specified, the PR or field content is read in from stdin.

Prints the usage for pr-edit.

Prints the version number for pr-edit.

pr-edit can edit PRs across a network, talking to a remote gnatsd. The following options relate to network access:

-H host
Hostname of the GNATS server.

-P port
The port that the GNATS server runs on.

-v username
Username used to log into the GNATS server.

-w password
Password used to log into the GNATS server.

Used to debug network connections.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003