annotate

indicate the origin of each line of a text file

Usage

accurev annotate [ -v <ver-spec> ] [ -f<format(s)> ] <element> 
[ -E <encoding> ]

Description

The annotate command lists the entire contents of a particular version of a text file. It prefixes each line with one or more of the following: the user who created the line, the transaction in which the line was added or most-recently modified, the timestamp of that transaction, the version-ID of the version created in that transaction.

By default, annotate lists the current version of the file in your workspace. Use the -v option to specify any other version. The -f option specifies which annotations to include, and in which order.

Options

-v <ver-spec>

Display a particular version of the element, instead of the version in your workspace stream. See Using a Specific Version of an Element of the AccuRev CLI Guide for a description of the forms that <ver-spec> can take.

-f <format(s)>

Use one or more of the following format letters:

t: (“transaction”) The transaction in which this line was added to the file, or was most recently modified.

u: (“user”) The user who performed that transaction.

d: (“date”) The timestamp of that transaction.

v: (“version”) The version-ID of the file version that was created in that transaction.

x: (“XML”) Display the output in XML format.

You can specify multiple format options. For example, -fut annotates the text lines with the user and transaction number, in that order. If you do not specify the -f option, AccuRev executes the command as if you had specified -ftud.

-E <encoding>

Indicates the encoding of the element against which you are executing the annotate command. Valid values include supported encodings, such as UTF-8, ISO-8859-1,
EUC-JP-MS, and CP932. See the "Code Page Support" appendix in the AccuRev Admin Guide for a complete list of supported encodings.

Note that the -E option is ignored unless -fx is also specified.

Examples

For each line in file factors.py, display the originating transaction and the user:

> accurev annotate -ftu factors.py
1 john            def gcf(big, small):
1 john                  """
1 john                  find the greatest common factor of two numbers
1 john                  """
1 john
1 john                  # special cases
1 john                  if big == small: return big
21 mary                  # oops, wrong order
1 john                  if big < small:
1 john                         big, small = small, big
1 john
13 mary                  # reduce, using the classic algorithm
1 john                  while big % small > 0:
1 john                         big, small = small, big % small
1 john
13 mary                  # return greatest common factor
1 john                  return small
1 john
1 john            def lcm(big, small):
1 john                  """
1 john                  find the least common multiple of two numbers
1 john                  """
13 mary                  return big * small / gcf(big,small)
1 john
1 john            def prime_factors(n):
1 john                  """
1 john                  return a list of the prime factors of a number
1 john                  """
21 mary                  factors = []

See Also

cat