About text modes for views
Text modes in DevOps Code ClearCase® views are necessary because lines in text files are terminated differently on different platform types. The text mode of a view determines how lines in text files under DevOps Code ClearCase control are processed, independent of the platform that the view storage, the VOB server, or the client runs on.
Line termination in text files on UNIX, Linux, and Windows®
Linux® and the UNIX system and Windows observe different conventions for terminating lines in text files. Typically, Linux and the UNIX system terminate lines with a single <LF> character (line feed or <NL>, new line), and Windows systems terminate lines with a two-character sequence <CR><LF> (carriage return, line feed). Some Windows applications can read and display files in either format, some always write files using <CR><LF> format, and some can be configured to determine which format to use. Some Linux and UNIX editors use Windows line termination, and some Windows text editors use Linux or UNIX line termination.
These different conventions typically cause line termination problems because different text editors are used to modify the same files on Linux, UNIX and Windows platforms. For example, a file whose contents are of the form:
abc
def
ghi
would look like this if it were created by a typical Windows editor and read by a typical Linux or UNIX editor (for example, 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 a typical Linux or UNIX editor and read by a typical Windows editor (for example, Notepad):
abcndefnghi
To better support parallel development in mixed operating system environments, a text mode setting for views is provided that controls how line terminators are handled when text files are presented to applications. This setting applies only to file elements whose element type is text_file or a subtype of type text_file. You determine a view text mode when you create the view. You cannot change the text mode of a view after the view has been created.
Text modes
These are DevOps Code ClearCase text modes:
- transparent (formerly unix)
- No line terminator processing is done.
- insert_cr (formerly msdos)
- A <CR> character is inserted before every <LF> character.
- strip_cr
- The <CR> character is stripped from every <CR><LF> sequence.
To see the text mode of a view, examine the properties of the view.
Sitewide property and DevOps Code ClearCase user option for text mode on Windows computers
On Windows computers, the sitewide property view_interop_text_mode in a DevOps Code ClearCase registry determines the default text mode when you create a view with the GUI. For details, see the setsite reference page. If view_interop_text_mode is set to TRUE, insert_cr text mode is the default. If view_interop_text_mode is set to FALSE, transparent text mode is the default. The cleartool lssite -inquire command lists the current value.
On Windows computers, in the View Options page in the ClearCase User Options window, you can specify a preference that determines the default text mode when you create a view with the GUI. If you set interop (MS-DOS) text mode, insert_cr text mode is the default. If you clear interop (MS-DOS) text mode, transparent text mode is the default. This preference can override the default for the site-wide property view_interop_text_mode.
View creation and text modes
You can create a view in any of the text modes. On Linux or UNIX workstations, views are created in transparent text mode by default. On Windows computers, if a different sitewide property default or DevOps Code ClearCase user view option is not specified, views are created in transparent text mode by default.
To explicitly create a view in transparent text mode regardless of the default, select Use interop (MS_DOS) text mode in the Advanced options of the View Creation wizard on Linux and the UNIX system or on Windows, or use the -tmode transparent option to the mkview command. Previous versions of DevOps Code ClearCase documentation and interfaces refer to transparent text mode as unix text mode.
To create a view in insert_cr text mode, select Use interop (MS_DOS) text mode in the Advanced options of the View Creation wizard GUI on Windows, or use the -tmode insert_cr option to the mkview command. Previous versions of DevOps Code ClearCase documentation and interfaces refer to this as interop text mode or msdos text mode.
To create a view in strip_cr text mode, use the (Windows) View Creation wizard or specify the -tmode strip_cr option to the mkview command on Linux and the UNIX system, and Windows.
In a snapshot view created in either insert_cr or strip_cr text mode, the <CR> characters are added or removed whenever the view is updated. In a dynamic view, the <CR> characters are added or removed as you open and read files. For both snapshot views and dynamic views, the <CR> manipulation is reversed (<CR> characters being added or removed as appropriate) during the checkin process.