For one or more versions, the findmerge command determines whether a merge is required from a specified version to the version in your view, then executes one or more actions:
findmerge works as follows:
Keep in mind that nontrivial merge capability is guaranteed to work only for versions whose type manager implements the merge or xmerge methods. For more information, see the type_manager reference page.
To use findmerge with UCM activities, you specify one or more activities and the option –fcsets. (The activity-selector arguments must precede the –fcsets option.) Each version listed in a change set becomes the from-version in a merge operation. As always, the to-version is the one in your view.
For other versions—for example, those of type file—the type manager may or may not be able to merge the data in the versions that findmerge identifies. For some versions, you may need to perform the merge manually, as follows:
If you specify –print as the action (and you do not also specify any of the merge actions), findmerge does not actually perform any merges. Instead, it shows what merge activity would be required:
Needs Merge "proj.c" [to /main/41 from /main/v2_plus/6 base /main/v2_plus/3] Log has been written to "findmerge.log.16-Nov-98.17:39:18" . . .
In addition, it writes a set of shell commands to perform the required merges to a log file. At some later point, you can execute the commands in the log file—all at once, or a few at a time.
If the directory version from which you are merging contains new files or subdirectories, findmerge –print does not report on those files or directories until you merge the directory versions. Therefore, you may want to run findmerge twice: once to merge the directory versions and again with the –print option to report which files need to be merged. You can then cancel the checkout of the directories if you do not want to save the directory merge.
Under some circumstances, findmerge –print does not detect all the required merges (that is, all the merges that findmerge –print would perform). This occurs when one or more directory merges are required, but are not performed.
By default, findmerge merges a directory before determining merge requirements for the versions cataloged within the directory. Thus, if merging directory srcdir makes a newly created file version, patch.c, appear, findmerge proceeds to detect that patch.c itself also needs to be merged. But if the only specified action is –print, findmerge can determine only that srcdir must be merged; it cannot determine that patch.c must also be merged.
This incomplete reporting also occurs in these situations:
You can use the following procedure to guarantee that the log file produced by findmerge –print includes all the required file-level merges within the directory tree under srcdir:
Executing the log file produces results identical to entering the single command findmerge srcdir –merge.
The findmerge command uses one of two algorithms to locate and examine versions. When the number of versions to be examined is below a certain threshold (approximately 100), findmerge uses the algorithm that uses the VOB's metadata. When the number of versions exceeds the threshold, findmerge uses the algorithm that requires walking through the VOB's directory structure. The directory walkthrough method is slower than the metadata method.
If the specified action involves checking out and/or merging files, the restrictions for the checkout and merge commands apply.
findmerge performs additional work after processing the VOB directory tree if you use –all or –avobs in combination with –ftag; in this case, it issues a warning message for each version that does not appear in the to-view, but does appear in the from-view.
Use the following options to select a subset of the versions specified by pname arguments and the –all or –avobs option.
If a merge is required from a version that happens to be version 0 on its branch, findmerge performs the merge and issues a warning message:
More often, findmerge determines that no merge is required from a zeroth version; it handles this case as any other no-merge-required case.
The following option overrides this default behavior.
findmerge flags this special case with a warning message:
This situation arises in these cases:
In this case, findmerge performs the merge by checking out the version (which creates the subbranch at the to-version), then overwriting the checked-out version with the from-version.
The following option overrides this default behavior.
findmerge does the following:
The following options override this default behavior.
If you have findmerge perform the merges, you can specify the following options, which work exactly as they do in the merge command. (–abort and –qall are mutually exclusive.)
Specifying –short reduces the listing to version-extended pathnames of the to- and from-versions:
Makefile@@/main/7 Makefile@@/main/br1/1
Specifying –long adds to the default listing a description (describe command output) of the from-version:
Needs Merge "Makefile" [to /main/7 from /main/br1/1 base /main/6]
version "Makefile@@/main/br1/1"
created 09-Nov-98.11:18:39 by Allison K. Pak (akp.user@neptune)
element type: text_file
predecessor version: /main/br1/0
Specifying –nxname reduces the listing to the standard pathname of the version:
(Valid only for versions whose type manager implements the merge method. See the type_manager reference page for more information.) Performs a merge for each version that requires it.
Three kinds of interfaces can be used: the –merge option performs a character-oriented merge, the –graphical option invokes the Merge Manager, and the –gmerge option invokes the graphical merge utility. All these actions attempt to check out the to-version, if it is not already checked out to your view.
The ok variants pause for verification on each version, thus allowing you to process some versions and skip others.
Special Case: Specifying –merge –gmerge causes findmerge to perform a character-oriented merge in –abort mode; if the merge aborts (because it could not proceed completely automatically), the interactive graphical merge tool is invoked.
Like the find command, findmerge sets the following variables in the specified command's environment:
Windows—If you invoke a command built in to the Windows shell (for example, cd, del, dir, or copy), you must invoke the shell with cmd /c. For example:
If a path within command-invocation contains spaces, you must enclose it in quotation marks. For example, in cleartool single-command mode (note the backslash used to escape the second quotation mark):
In cleartool interactive mode (no escape character needed):
The UNIX examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.
The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the UNIX shell or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
cmd-context findmerge msg.c –fversion /main/rel2_bugfix/LATEST –print
Needs Merge "msg.c" [to /main/2 from /main/rel2_bugfix/1
base /main/1]
A 'findmerge' log has been written to "findmerge.log.04-Feb-99.10:01:23"
cmd-context cat findmerge.log.04-Feb-99.10:01:23
cleartool findmerge msg.c@@/main/2 –fver /main/rel2_bugfix/1 –log /dev/null -merge
cmd-context findmerge . –ftag rel2_bugfix_view –whynot –print
No merge ".\Makefile" [\main\3 descended from \main\2]
No merge ".\cm_add.c" [element not visible in view rel2_bugfix_view]
No merge ".\hello.c" [to \main\4 from version zero \main\rel2_bugfix\0]
. . .
A 'findmerge' log has been written to "findmerge.log.04-Feb-99.11:00:59"
type findmerge.log.04-Feb-99.11.00.59
cleartool findmerge .\msg.c@@\main\2 -fver \main\rel2_bugfix\1 -log nul -merge
cmd-context findmerge . –fversion \main\rel2_bugfix\LATEST –merge
Needs Merge ".\util.c" [to \main\3 from \main\rel2_bugfix\2
base \main\rel2_bugfix\1]
Comment for all listed objects:
Merge from rel2_bugfix branch.
. Checked out "util.c" from version "\main\3".
********************************
<<< file 1: M:\view1\george_fig_hw\src\util.c@@\main\rel2_bugfix\1
>> file 2: .\util.c@@\main\rel2_bugfix\2
>> file 3: .\util.c
********************************
-------[changed 7-8 file 1]--------|------[changed to 7-12 file 3]-----
if (user_env) | if (user_env) {
return user_env; | if ( strcmp(user_env,"root") == + .
.
.
Moved contributor ".\util.c" to ".\util.c.contrib".
Output of merge is in ".\util.c".
Recorded merge of ".\util.c".
A 'findmerge' log has been written to "findmerge.log.24-Mar-99.13.23.05"
type findmerge.log.24-Mar-99.13.23.05
#cleartool findmerge .\util.c@@\main\3 -fver \main\rel2_bugfix\2 -log nul -merge -c "Merge from rel2_bugfix branch."
cmd-context findmerge . –fol –fversion \main\bugfix\LATEST –print
Needs Merge "\usr2\home\ktessier\testvobs\testvob\testdir\beta\foo.c"
[to \main\4 from \main\bugfix\1 base \main\3]
Needs Merge ".\update [to \main\4 from \main\bugfix\1 base \main\2]
Log has been written to "findmerge.log.02-Jul-99.14:07:49".
Copyright© 2003 Rational Software. All Rights Reserved.