create a new reference tree


accurev mkref -r <reftree-name> -b <backing-stream> -l <location>
[ -e <eol-type> ]


The mkref command creates a reference tree, a directory tree containing copies of all the versions in a stream. A reference tree is very similar to a workspace. You use a reference tree for building, testing, data export, and similar activities; you use a workspace for creation of new versions (source-code development). See Entity Names for information on naming reference trees.

mkref fills the directory tree with read-only files. You can work with these files using such accurev commands as hist and diff. But you cannot use any AccuRev command that would modify these files: co, add, defunct, keep, merge, move, promote, purge, or undefunct.

The only AccuRev commands you can use to modify the files in a reference tree are update and pop. To do so:

  • use update -r <reftree> to update the reference tree from any location
  • use update or pop after navigating to the reference tree location

If the stream’s contents have changed since you created the reference tree, update overwrites some files with the new versions.

You can create any number of reference trees for a given stream, on the same machine or on different machines. You can base a reference tree only on a dynamic stream or a snapshot, not on a workspace.

Note: You cannot create a reference tree with the same name as an existing workspace.

If you rename an existing reference tree with the chref command, you can then create a new reference tree with the original name.

Streams and Reference Trees

A stream does not actually contain files — it contains the version-IDs of a set of elements. (More precisely, a stream’s specifications enable AccuRev to rapidly construct the list of elements and version-IDs.) mkref builds a directory tree on your disk, containing copies of the files indicated by those version-IDs.

For example, a stream named gizmo_rls2_dvt (stream #32 in its depot) might contain:

gizmo.readme      32/8
src/gizmo.c 1/14
src/cmd.c 1/5
doc/gizmo.doc 1/19
doc/relnotes.doc 32/12

Only two elements, gizmo.readme and relnotes.doc, are under active development in this stream. For all the other elements, this stream uses a version that was promoted to the depot’s base stream (stream #1). mkref creates a directory tree containing five files:

in the reference tree’s top-level directory, a copy of version 8 in the gizmo_rls2_dvt stream of element gizmo.readme

in subdirectory src, a copy of version 14 in the base stream of element gizmo.c, and a copy of version 5 in the base stream of element cmd.c

in subdirectory doc, a copy of version 19 in the base stream of element gizmo.doc, and a copy of version 12 in the gizmo_rls2_dvt stream of element relnotes.doc


-r <reftree-name>

Specify the name of the reference tree to be created. The name may begin with a digit (provided there is at least one non-digit in the name), must not begin with a dot (.), must not include either a slash (/) or a backslash (\) and must not be a name of digits.

-b <backing-stream>

Specify the stream to be the backing stream of the reference tree. You must specify a dynamic stream or a snapshot — you cannot specify a workspace.

-l <location>

Specify the full pathname where the reference tree is to be created.

-e <eol-type>

Specify the line terminator to be used when an AccuRev command (e.g. update, co) copies a version of a text file from depot storage to the reference tree. (In depot storage, all text files are stored with the AccuRev-standard line terminator, NL.) The <eol-type> can be d (default: use the standard line terminator for the client machine’s operating system), u (use the UNIX/Linux line terminator, NL), or w (use the Windows line terminator, CR-NL).


Create a reference tree named gizmo_snapl, based on stream gizmo, at a particular location:

> accurev mkref -r gizmo_snap1 -b gizmo -l /depot/gizmo/gizmo_snap1

See Also

mkstream, show, update