27.01.2015 Views

CLI User's Guide - AccuRev

CLI User's Guide - AccuRev

CLI User's Guide - AccuRev

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

add<br />

Using Triggers to Control the Element Type and Exclusive File Locking State<br />

Setting of the element type or the exclusive file locking state (or both) can be automated with<br />

triggers. Settings made by triggers scripts override the add -E specifications, if any.<br />

• To set the element type based on file extensions and/or file content, set a pre-operation trigger<br />

with mktrig pre-create-trig. <strong>AccuRev</strong> ships with a sample trigger script, elem_type.pl. You<br />

can customize it to recognize new file suffixes.<br />

• To set the exclusive file locking state on a file-by-file basis, use the server-side pre-operation<br />

trigger, admin_preop_trig.<br />

These triggers are fully described in <strong>AccuRev</strong> Triggers on page 71 of the <strong>AccuRev</strong> Administrator’s<br />

<strong>Guide</strong>.<br />

How <strong>AccuRev</strong> Handles File Elements of Different Types<br />

<strong>AccuRev</strong> handles binary files very simply: when a new binary version is created (with add or<br />

keep), <strong>AccuRev</strong> simply copies the file from your workspace tree to the repository, creating a<br />

storage file. When you retrieve a binary file from the repository (for example, with co -v or<br />

update), <strong>AccuRev</strong> simply copies the storage file to your workspace tree.<br />

Handling of text files is more sophisticated. By default:<br />

• When a new version is created (add or keep), a new storage file is placed in the repository,<br />

with a single NL (or LF) character (hex character code x0A) at the end of each text line. This<br />

means that a version’s storage file may have different line terminators than the file you<br />

submitted to the add or keep command.<br />

• When a text file is copied into the workspace by an <strong>AccuRev</strong> command (e.g. update, pop), it<br />

gets the line terminators appropriate to the machine where the workspace is located: NL (x0A)<br />

for a UNIX/Linux machine, or CR-NL (x0D x0A) for a Windows machine.<br />

On the individual element level, you can override the manipulation of line terminators by<br />

specifying the “preserve text line terminators” element type, with the -E ptext option. Files of this<br />

type are copied to and from the repository with no change, just like binary files.<br />

On the workspace level, you can force the use of a particular line terminator when text files are<br />

copied to the workspace, using the -e option to mkws or chws. This applies to all elements of type<br />

text, but not to elements of type ptext.<br />

How <strong>AccuRev</strong> Converts Existing Links to Link Elements<br />

The add command converts existing link objects with (external) status to <strong>AccuRev</strong> elements as<br />

follows:<br />

• An existing hard link is always converted to an <strong>AccuRev</strong> file element.<br />

• An existing symbolic link (UNIX/Linux) or junction point (Windows) is converted to an<br />

<strong>AccuRev</strong> element-link element (elink) in these circumstances:<br />

• The target is a file element, directory element, or elink in your workspace, and you omit<br />

the -s command-line option. (If the target is an slink, you must use -s to convert the object<br />

to an slink. You cannot create an elink that points to an slink.)<br />

<strong>AccuRev</strong>® <strong>CLI</strong> User’s <strong>Guide</strong> 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!