Sun WorkShop TeamWare 2.1 User's Guide

Starting Merging from the Command Line

To start Merging from the command line without loading any input files (assuming that the Merging executable is in your search path), at a shell command prompt, type twmerge followed by the ampersand symbol (&):

demo% twmerge &

The twmerge command starts Merging (in the background) without loading any files.

The complete twmerge command is summarized below, with command options enclosed in square brackets.


twmerge [-b] [-r] [-a ancestor] [-f1 name1] [-f2 name2] [-l listfile] [ leftfile rightfile [outfile] ] [-V]

-b

Causes Merging to ignore leading blanks and tabs when comparing lines. 

-r

Starts Merging in read-only mode. When you specify this option, only the input file text panes are displayed, and the output text pane is absent. 

-a ancestor

Specifies an existing ancestor file of the two files to be merged (called descendants of the ancestor file). The merged file is based on this ancestor file and the changes to it that have been made in the descendants.

When used with the -l listfile option, ancestor is a directory of files, which you can load in succession from the File menu.

-f1 name1

Sets the file name displayed for the first (left) file. This option is useful when a list of files is being loaded (with the -l option), and you want to display a name for reference only in the Merging window.

For example, if you are loading files from two directories that correspond to two different revisions of a product, you could use the -f1 option to display the name Rev1 above the left pane and the -f2 option to display the name Rev2 above the right pane.

-f2 name2

Sets the file name displayed for the second (right) file. 

-l listfile

 

Specifies a file that contains a list of individual file names. This option is useful for merging entire project directories. 

Merging uses the names in listfile to successively load files from directories you name with the leftfile and rightfile arguments, placing the output files in the directory you name with the outfile argument. The names in listfile must match file names in the leftfile and rightfile directories. When used with the -a ancestor option, the ancestor argument must be a directory: Merging will look in the ancestor directory for files that have the same names as those in listfile and use those with matching names as ancestor files for each merge.

If you specify the character "-" for listfile, Merging reads the list of files from standard input.

leftfile

The name of the left file to be loaded for comparison. When used with the -l listfile option, leftfile is a directory of files, which you can load in succession from the File menu.

rightfile

The name of the right file to be loaded for comparison. When used with the -l listfile option, rightfile is a directory of files, which you can load in succession from the File menu.

outfile

 

 

Specifies the name of the merged output file. If you do not specify an outfile, the output file is given the default name filemerge.out. If you want to specify a different name when you save the file, use Save As from the File menu.

When used with the -l listfile option, outfile names the directory to be used when each merged output file is saved. Individual file names in the outfile directory are the same as the names listed in listfile.

-V

Does not start up Merging, but displays the version number of the application.  


Note -

If you use the -l listfile option, then all three input file names (ancestor, leftfile, and rightfile) must be directories. If you do not use the -l listfile option, then any two input file names can be directories, but one of the three must be a simple file name. In this case, Merging uses the file name to find a file with the same local name in each directory.


Loading Two Files at Startup

To load two files at the time you start Merging from the command line, change to the directory in which the files are stored and specify the file names on the command line. To merge two files named file_1 and file_2, use the following command:

demo% twmerge file_1 file_2 &

The first file listed appears in the left text pane; the second file appears in the right pane (see Figure 4-1).

Loading Three Files at Startup

To merge the same two files and at the same time compare them to a common ancestor named ancestor_file, change to the directory in which the files are stored and use the following command:

demo% twmerge -a ancestor_file file_1 file_2 &

The ancestor file is not displayed, but differences between the ancestor file and the two descendants are marked, and the merged output file is based on the ancestor file.

Loading Files from a List File

You can sequentially load files into Merging from a list of file names. For example, suppose ancestor versions of a project's source files are stored in a directory named /src. You have been editing the files file_1, file_2, and file_3 in your directory /usr_1, and another developer has been simultaneously editing the same files in the directory /usr_2. You have been given the responsibility of merging the changes to both sets of files, and you want to place the merged versions in a directory named /new_src.

To merge the /src, /usr_1, and /usr_2 directories, you first create a list file that contains only the names of the three files to be merged with each name on a separate line, as follows:


file_1
file_2
file_3

Name the file sourcelist and place it in the working directory where you plan to start Merging. Change to that directory (with the cd(1) command) and start Merging with the following command:

demo% twmerge -a /src -1 sourcelist /usr_1 /usr_2 /new_src &

This command causes Merging to load /usr_1/file_1 into the left text pane, /usr_2/file_1 into the right text pane, and compare both files to the common ancestor /src/file_1. After you have resolved the differences between the two files, choose Save from the File menu to automatically save the output file as /new_src/file_1.