About view text modes
Every ClearCase® view has a view text mode, which controls how line terminations are handled in text files.
Windows® and Linux and the UNIX systems observe different conventions when writing line terminations in text files. Linux and the UNIX utilities and applications typically terminate lines with a single <LF> (line feed, or new line) character; Windows utilities and applications terminate lines with a two-character <CR><LF> (carriage return, line feed) character sequence. Some Windows applications can read and display files in either format, some Windows applications always write files using <CR><LF> format, and some Windows applications can be configured to determine which format to use.
These different conventions can create problems in text files that are edited on both Windows and Linux and the UNIX systems platforms. For example, a file that contains
abc
def
ghi
would look like this if it were created by a Windows editor such as Notepad and read by a Linux or UNIX editor such as vi:
abc^M
def^M
ghi^M
The Linux or UNIX text editor renders the <CR> character as ^M. The same file would look like this if it were created by the Linux or UNIX editor and read by the Windows editor:
abcdefghi
To better support parallel development in mixed environments, a text mode setting for views is provided that controls how line terminators are handled when text files are presented to applications.
Text modes
Each ClearCase view is created with a text mode (line termination) setting that specifies how it handles line terminator sequences. This setting applies only to file elements whose element type is text_file or a subtype of type text_file. You must specify a view text mode when you create the view. You cannot change it after the view has been created.
The following line termination settings are supported by the View Creation wizard:
- transparent text mode. In a view created in transparent text mode, no line-terminator processing is performed. If all developers at your site use the same development platform (Windows or Linux or the UNIX systems) or use tools that are compatible with either line-termination convention, all views must be created in transparent text mode. To create a view in transparent text mode, select the Transparent radio button in the View text mode area of a create view page in the View Creation wizard.
- insert_cr text mode. In a view created in insert_cr text mode, a <CR> character is inserted before every <LF> character when files are loaded into the view and reverses the operation when files are checked in to the VOB. To create a view in insert_cr text mode, select the Insert CR radio button in the View text mode area of a create view page in the View Creation wizard.
- strip_cr text mode. In a view created in strip_cr text mode, the <CR> character is stripped from every <CR><LF> sequence when files are loaded into the view, and reverses the operation when files are checked in to the VOB. To create a view in strip_cr text mode, select the Strip CR radio button in the View text mode area of a create view page in the View Creation wizard.
Choosing a text mode for a view
No policy is enforced that governs access to VOBs based on a view's text mode. A user who edits a file in a view that has the "wrong" text-mode configuration can cause problems for other users who need to edit that file. Sites with both Windows and Linux or UNIX development platforms need to adopt a policy that allows users of the primary development platform to create views in transparent text mode and that limits the use of strip_cr or insert_cr text modes to those platforms that require different line-termination conventions. If the majority of developers are editing text files on the Linux or UNIX systems, Linux and UNIX clients need to use views created in transparent text mode. Windows clients should use views created in insert_cr text mode. If the majority of developers are editing text files on Windows, Windows clients need to use views created in transparent text mode. Linux and UNIX clients need to use views created in strip_cr text mode.
Regardless of the policy your project adopts, it is important to maintain a consistent combination of client platform, view text mode, and element. For example, if a user on a Linux or UNIX system creates a version of an element in a view that has a strip_cr or insert_cr text mode and another user on a Linux or UNIX system creates a version of the same element in a transparent text mode view, the two versions will be difficult to compare or merge.