Next: , Previous: checkin, Up: Subcommands


6.8 Prcs diff

— Command: prcs diff [option ...] [project [file-or-dir ...]] [-- [diff-option ...]]

ADDITIONAL OPTIONS: ‘-r’ (once or twice), ‘-k’, ‘-N’, ‘-P

Compare the (partial) contents of two repository versions of a project or of a repository version and a working version. When file-or-dir arguments are present, they restrict comparison to the specified files or subdirectory trees. The project argument may be defaulted if there is a single file with extension .prj in the current working directory, in which case prcs takes its name (without .prj) as the project name.

The options may specify zero, one, or two versions (using ‘-r’ options). Specifying no ‘-r’ options is equivalent to supplying the single option ‘-r.’, the version from which the current working directory was checked out. A ‘-r’ option that specifies only a major version (leaving off the minor version and its preceding period) implicitly has a minor version of @. When one version specifier is given, the files in the indicated version are compared to the working files. The command's output notes any discrepancies in the contents of identically-named files, or in files present in one version but not the other. Two version specifiers cause the same comparison, but between two checked-in versions of the project.

Normally, diff canonicalizes keyword instances in the files it compares, removing the keyword values and leaving just the keyword name. As a result, two different versions of a file that differ only in their keyword values will compare as equal. The ‘-k’ option causes diff to compare keyword values as well.

If a file is present only in one of the project versions being compared, diff will normally just announce that such a file occurs only in one of the versions. With the ‘-N’ option, it will produce the same output it would if it instead treated the non-existent version as an empty file. This is useful when producing patch files that include new files as well as changed ones. Its effect is essentially the same as that of the same option in GNU diff when it compares directories.

Files in the two versions being compared are paired by their names and their internal-file families (see Files attribute, for a description of internal-file families). That is, prcs will assume that two files in the different versions correspond if they have the same name or the same internal-file family. This makes it possible to have conflicts (for example, when one switches the names of two files in a project descriptor); in those cases prcs will ask the user to resolve the conflict.

The diff-options, if provided, are any options acceptable to GNU diff. See (diff)Top. The environment variable PRCS_DIFF_OPTIONS, if set, supplies a default set of whitespace separated diff-options.

If the file-or-dir is defaulted and ‘-P’ is not supplied, or if file-or-dir contains the project descriptor, prcs outputs differences between project descriptors.

Returns a status code of 0 if there were no differences, 1 if there were differences, and 2 if there were problems.