pop

copy files into a workspace or reference tree

Usage

accurev pop [ -O ] [ -R ]
[ -v <ver-spec> -L <location> [ -D ] [ --eol=<eol-type> ] ]
[ -t <time-spec> ] [ -fx ] { -l <list-file> | <element-list> }

Description

The pop (“populate”) command loads versions of elements into your workspace. This sounds like a useful and common operation, but in practice, you may never need to use this command.

It is appropriate to use pop when you accidentally delete files. There is nothing AccuRev can do if you delete files that you have been editing, but have not yet preserved with keep. (But the operating system may have an “undelete” facility, such as the Recycle Bin on the Windows desktop.) If you delete files that you have not modified, but still need (e.g. for searching, building, or testing), you can use pop to get “fresh copies” of the files from the depot.

For each element, pop retrieves a version from the workspace stream. It’s the version that should be in the workspace (but isn't because you deleted it), or would be in the workspace (but isn't because you hadn't previously loaded it):

  • For a file that you accidentally deleted after the workspace’s most recent update, it is the version that was loaded (or left alone) by that update.
  • For a file that you have modified and preserved with keep, but then accidentally deleted, it’s the most recently kept version.

    Note: If the pop command is used with the -v option, and any element specified in the <list-file> or <element-list> has status (defunct) in the stream’s default group, the command will fail. If you are using a script to generate a list of files to pop, check for this potential error condition.

Overwriting Existing Files

pop is designed to “fill in the blanks”, not to replace existing files. Thus, the pop default is to refuse to do anything if it would overwrite any file in the workspace. You can force pop to overwrite existing files with the -O option. It retrieves the version that was loaded (or left alone) by the most recent update.

Be very careful when using -O. If you have modified a file but not yet preserved it with keep, then pop -O overwrites what might be the only existing copy of the modified file.

Timestamps on Files Copied into the Workspace

By default, each file copied into your workspace by this command has its timestamp set to the current time. If environment variable ACCUREV_USE_MOD_TIME is set, the timestamp is set to the time the version was originally created. (Note: that’s the time the version was created in some user’s workspace stream, not the time it was subsequently promoted to the backing stream.) Setting this environment variable may defeat an optimization in the stat command. See Optimized Search for Modified Files.

Using “pop” Outside a Workspace

You can use pop to copy versions of one or more elements from depot storage to a non-workspace location. Use the -v option to specify the version to be copied; use the -L option to specify the destination of the copy operation. Use depot-relative pathnames to specify the elements to be copied. The current directory must not be within a workspace. Use the -D option to copy only an element, without recreating its directory structure. Use the --eol=unix option or the --eol=windows option to specify the type of line terminators to write into the copied versions. (The UNIX/Linux line terminator is NL, and the Windows line terminator is CR-NL.)

To select a specific version of a file for development use inside your workspace, use the co command.

Using "pop -t" to access an element from a particular time

Sometimes you want to grab an element from a particular point in time, and do not intend to modify or promote it—for example, to build a software package with a component from last week, to track down a build issue. The pop -t command allows you to do this easily, without the necessity of setting up a time-basis stream and then using pop -v to access a particular version.

Options

-O

Override: suppress the warning message that would appear, and overwrite existing files, even if they have been set to read-only by the operating system.

-R

Recurse into subdirectories.

-v <ver-spec>

Specify the version to be copied. The -v and -L options must be used together; and you must specify the elements using depot-relative pathnames.

-L <location>

Specify the full pathname of a directory that is not within any AccuRev workspace, where the copies of versions are to be made. The -v and -L options must be used together; and you must specify the elements using depot-relative pathnames.

-D

Pop just the specified element, without building its directory tree. Must be used with -v and -L.

--eol=<eol-type>

Specify the type of line terminators (unix or windows) to write into the copied versions. Must be used with -v and -L.

-t <time-spec>

Copy an element based on a point in time or a transaction number. A time-spec can be any of the following:

  • Time in <"YYYY/MM/DD HH:MM:SS"> format, "2007/08/07 20:27:15", for example. Note that you must use quotes when specifying time-spec as YYYY/MM/DD HH:MM:SS to ensure that the entire argument is interpreted by the command shell as a single token.
  • Time keyword: now
  • Transaction number as a positive integer: e.g. 146 or 23965
  • Transaction number keyword: highest

When using the –t option, take into account the possibility of a timewarp. The AC_SYNC environment variable (see AccuRev User Preferences) determines how a timewarp will be handled. See also System Clock Synchronization in the AccuRev Admin Guide.

-l <list-file>

Process the elements listed in <list-file>. This must be a text file, with one element name per line. Extra whitespace is not allowed; make sure there are no empty lines and no leading or trailing white space around the filenames. Wildcards are not expanded. There is no provision for comment lines in the file.

If you use this option, any <element-list> specified is silently ignored.

<element-list>

One or more element names, separated by whitespace. If you also specify a <list-file> using the -l option, this <element-list> is silently ignored.

You can include names of directory elements in the list. If you do, be sure to specify the -R option.

When using the -v and -L options, you must specify elements using depot-relative pathnames.

-fx

Display the results in XML format. For example:

 <AcResponse

        Command="pop"

        TaskId="1108">

        <message>Populating element \.\dir00\sub00\file06.txt</message>

        <element location="/dir00/sub00/file06.txt"/>

</AcResponse>

Examples

Copy foo.c from the workspace stream into the workspace:

> accurev pop foo.c

Copy versions from the workspace stream into the subdirectory tree starting at the current directory, replacing existing files as well as “filling in the blanks”:

> accurev pop -R -O .

Using versions from stream QA, copy the subdirectory tree starting at the directory src to C:\httpd\test_site:

> accurev pop -R -v QA -L C:\httpd\test_site \.\src

Copy only file.txt from stream my_stream to the current location, without creating the directory structure dir1/dir2/dir3/dir4:

> pop -L . -D -v my_stream dir1/dir2/dir3/dir4/file.txt

Copy only directory dir4 from stream my_stream to the current location, without creating the directory structure above it (dir1/dir2/dir3). dir4 will contain top-level elements. If dir4 contains subdirectories, they will be created, but empty.

> pop -L . -D -v my_stream dir1/dir2/dir3/dir4

Copy file1.txt from two different directories in stream my_stream, to the current location, without creating the directory structures above it. In this case, the second copy (from dir1) overwrites the first one (from dir1/dir2/dir3/dir4):

> pop -L . -D -v my_stream dir1/dir2/dir3/dir4/file1.txt dir1/file1.txt

Copy elements associated with transaction id 68456, overwriting existing files and using recursion:

> pop -t 68456 -R -O .

Copy elements modified on January 5, 2010 at 1:00, overwriting existing files and using recursion:

> pop -t "2010/01/05 01:00:00" -R -O .

See Also

update

Using a Specific Version of an Element