Next: rekey, Previous: diff, Up: Subcommands
ADDITIONAL OPTIONS: `-r', `-u', `-s'
Find differences between working files and those of the selected version of project, and (unless `-n' is specified) try to modify the working files to reconcile them. The default major and minor versions are `-r.@'.
More precisely, the comparison takes place between three versions of project: the working version (called PW in what follows), the common version (PC) and the selected version (PS).
PW is the working version specified in the checked-out descriptor and consists of all files listed therein. PS is the version against which prcs will reconcile changes, identified by the (possibly defaulted) `-r' option. A common version is chosen according to the following algorithm:
Each version, including the working version, has a list of parent versions. The parent versions establish an ancestry graph that is directed and contains no cycles. A version is an ancestor of another if it can be reached by following zero or more parents (see Parent-Version attribute and Merge-Parents attribute). PC is chosen from the set of all versions that are ancestors of PW and PS. If amongst this intersection, there exists a unique nearest common ancestor, then it is PC. If there is no such version, prcs will complain and ask the user for help.
Files in the three versions are matched up both by name and by internal-file family (see Files attribute). That is, prcs will assume that two files in 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.
A
prcs merge
will report discrepancies and (unless `-n' is specified) take actions as directed. The possible actions are as follows.
- n
- Do nothing.
- a
- Add the file from PS to PW.
- r
- Replace the working file with the file from PS.
- d
- Delete the file from PW.
- m
- Merge the file from PS with that from PW, inserting markers into the merged working file to show where the changes in PW (relative to PC) and those in the version from PS overlap. If the file from PC is missing, then an empty file is used for its contents. In general, you will have to edit the working file to resolve the discrepancies. If the versions in PS and PW are identical aside from keyword values, merging has no effect.
- ?
- Print summary of options.
- h
- Print explanatory help message.
- v
- View differences between PS, PC, and PW (there is further prompting for which you want compared).
The `-f' option causes default actions to each discrepancy (see below). Otherwise, prcs will ask the user to specify one of the possible actions. All of the actions except n modify the descriptor, either to remove the file from the Files list, or to modify its internal file identifier to the one from PS.
Like
prcs diff
,prcs merge
canonicalizes files to strip keyword values before comparing them for discrepancies (see diff). In the descriptions that follow, saying that files are “equivalent” means that they are identical when canonicalized.Prcs detects the following discrepancies:
- Files present in PC and absent in PW. The default action is n. That is, the files are assumed to be obsolete, regardless of their status in PS.
- Files present in PC and PW, and absent in PS. The default action is d. That is, the files are assumed to be obsolete.
- Files present in PC, PS, and PW, equivalent in PC and PW, and different in PS. The default action is r. That is, the version in PS is assumed to be most up-to-date.
- Files present in PC, PS, and PW, and different in all three. The default action is m. There have been independent changes in both PW and PS.
- Files absent in PC, and different in PW and PS. The default action is m.
- Files absent in PC and PW, and present in PS. The default action is a.
- Prcs takes no action in other cases, and does not prompt the user.
When prcs overwrites a working file that is a symbolic link, then (unless the
:symlink
option is specified for that file), it will overwrite the file that the link references, without changing the link itself. With the `-u' option, prcs will instead remove the link and create a new file.Whenever prcs is going to replace a working file as a result of one of the actions above, it first moves the original file into the `obsolete' directory and gives it a unique name.
A partial merge takes place when not all files in the three versions are considered for merging. This can happen if a merge is aborted or the file-or-dir option limits the files under consideration. When this happens, prcs records which files have been merged and their names in the working project's New-Merge-Parents attribute (see Merge-Parents attribute).
A merge is considered complete when each file in each version has been considered once. A complete merge may be achieved by several partial merges. To prevent reconsidering the same file more then once, prcs will not consider any set of files containing a file that was already considered in a previous merge against the same selected version unless the `-s' option is specified.
In general, the `-s' option allows the user to turn off all the safety features built into
prcs merge
. It will allow a user to merge files more than once, override the choice of an effective working version, restart a complete merge, and start a new merge without completing a previous merge.By default, prcs uses the GNU diff3 command to perform 2- or 3-way file merges when you choose the m action (see (diff)top). It is possible, however, to supply your own merge command. By setting the
PRCS_MERGE_COMMAND
environment variable to a program name, prcs will call the named command instead of diff3 (see Environment Variables).