relocate

Moves elements and directory trees from one VOB to another

Applicability

Product

Command type

ClearCase®

cleartool subcommand

Platform

UNIX

Linux

Windows

Synopsis

relocate [ –f/orce ] [ –qal/l ] [ –log log-pname ] [ –upd/ate ]
pname [ pname ... ] target-dir-pname

Description

The relocate command moves elements, including directory trees, from one VOB to another. All related VOB database entries and data containers are moved to the target VOB. relocate preserves the "move from" VOB's namespace by substituting VOB symbolic links for moved elements.

Note: You cannot relocate the contents of a VOB if ACLs are enabled on either the source or the target VOB.

The more common use of relocate involves splitting a piece from one VOB and moving it to a newly created VOB. However, you can move an arbitrary collection of elements from one VOB to a location in any other VOB. You cannot use relocate to move an element to a new location in the same VOB. Use cleartool mv for this purpose.

For a dynamic view, view-private files and nonversioned DOs are not relocated. If a relocated directory contains view-private files, they are stranded; DOs are removed.

Important: The relocate command makes irreversible changes to at least two VOBs and their event histories. Do not use this command routinely for minor adjustments. Furthermore, you must stop VOB update activity before and during a relocate operation.

Restrictions

Identities

You must have one of the following identities:

  • VOB owner (for both VOBs)
  • root (UNIX and Linux)
  • Member of the ClearCase administrators group (ClearCase on Windows)

Locks

An error occurs if one or more of these objects are locked in the source VOB: VOB, element. An error occurs if one or more of these objects are locked in the target VOB: VOB, element, branch type, element type, label type, hyperlink type, attribute type.

Mastership

(Replicated VOBs only) Your current replica must master any element to be relocated.

Guidelines for using update mode

Because relocate normally locks the elements on which it operates, users cannot access them while they are being relocated. If the elements must remain in use during the relocation, you can use relocate's update mode (relocate –update). You can also use update mode to update the target VOB incrementally with changes that have occurred since relocate was last run. However, we recommend that you use update mode sparingly.

You cannot switch from using update mode to not using it. We recommend you not use update mode if you plan to leave some elements in the original VOB. (If you do use it in this situation, you must clean up the original elements and create symbolic links manually.)

In update mode, relocate works as follows:
  • Does not create symbolic links in the source VOB to replace existing catalogs; it leaves the catalogs in place
  • Allows you to relocate the VOB root and lost+found directories
  • Does not stop relocation when it encounters a nonlocally mastered element; it relocates the element
  • Does not remove the elements from the source VOB
  • Does not check out or modify the source directory
  • Does not lock the elements in the relocate set

When you use update mode incrementally, relocate rescans all elements and updates the ones that have changed. In regular mode, relocate determines where it left off and continues, assuming that elements it has already relocated do not need further processing. In update mode, relocate does not make this assumption: because update mode is used incrementally and no locks are put on the original elements, the elements could have changed since relocate –update was last run.

There are certain changes (usually deletions of objects) that cause relocate to fail when updating existing elements. If you perform rmver, rmbranch, or rmelem operations on the original elements, these changes are not reflected in the target VOB.

In addition, a deletion combined with a replacement creation can cause an error. For example, if a branch named foo is removed in the original VOB and a new branch named foo is created to replace it, relocate fails when it tries to update the target element. Because relocate did not remove the old branch, it cannot create the new one. To work around this problem, remove the target element; on the next run of relocate, the element is re-created.

Other

The following restrictions apply:

  • relocate cannot be used when pname or target-dir-pname is part of UCM component.
  • relocate cannot move checked-out elements. It fails during the selection phase if it finds any checked-out files among the ones it is going to move.
  • relocate may fail if there are restrictive triggers on checkout, checkin, and rmelem commands. Because relocate runs these commands, triggers on these operations are also executed. If these triggers cause relocate to fail, you must disable the triggers or remove them from those operations and run relocate again.

Options and arguments

Suppressing the confirmation query

Default
After displaying the relocate set, relocate asks you to confirm that these are the elements you want to relocate.
–f/orce
Suppresses the confirmation step.

Controlling special case handling

Default
Uses built-in rules to determine how to handle borderline elements (elements that are cataloged in both a directory being relocated and a directory not being relocated). For more information, see the DevOps Code ClearCase Administrator's Guide .
–qal/l
Prompts user to affirm or reject relocate's handling of each borderline element. The default answer in an individual case depends on the element's visibility in the current view: yes if the view selects some version of the element; no otherwise.

If you reject these defaults, the result is nonfunctional links that you must repair. If a version of an element is visible in the current view and you indicate it is not to be relocated, the result is a bad link in the target VOB. If a version of an element is not visible in the view and you indicate that it is to be relocated, the result is a bad link in the source VOB.

Writing a log file

Default
relocate creates a log file in the current directory with the name relocate.log.date-time.
–log log-pname
Creates a relocate log file at location log-pname.

Relocating in update mode

Default
relocate removes the source elements after the target elements have been created.
–upd/ate
relocate leaves the source and target elements in place.
Note: Update mode is intended to support sites that need to test element relocation while leaving the source elements accessible for modification. When using update mode, do not modify or access the target elements. When update mode testing is complete, run relocate without the –update option to remove the source elements. For more information, see Guidelines for using update mode.

Specifying which files to relocate

Default
None.
pname ...
Specifies the elements to be relocated. A pname can be a file element, directory element, or VOB symbolic link.

Specifying a target VOB and directory

Default
None. You must supply a target directory in a second VOB.
target-dir-pname
Specifies the directory in the target VOB that will store the relocated elements. relocate checks out and modifies the version of this directory that is selected by your current view. The target directory must be in the same view as the source pathname (that is, you cannot specify a view-extended pathname for target-dir-pname).

On Windows, this pathname must be drive-relative:

Valid

Not valid

\foo\bar

m:\foo\bar

foo

f:foo

..\foo

g:..\foo

Examples

The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you might need to use different quoting and escaping conventions.

The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you might need to change the wildcards and quoting to make your command interpreter process the command appropriately.

In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.

  • Move subdirectory glib (and its one file, file.c) from /vobs/lib to the newly created VOB /vobs/gui. Query on borderline elements. To illustrate how relocate replaces element names with symbolic links in the source VOB, the example uses a relative pathname to specify the target VOB.

    After relocating glib, examine the RelocationVOB hyperlink added to /vobs/gui.

    % cd /vobs/lib
    cmd-context setcs –default
    cmd-context relocate -qall ./glib ../gui
    Logfile is "relocate.log.2007-04-09T14:11:37".
    Selected "glib".
    Selected "glib/file.c".
    Do you want to relocate these objects? [no]
    yes
    Checked out "." from version "/main/3".
    Checked out "/vobs/gui" from version "/main/0".
    Locking selected objects
    Locked "glib"
    Locked "glib/file.c"
    Recreating selected objects
    Created "glib"
    updated branch "/main"
        updated version "/main/0"
            created version "/main/1"
            Created "glib/file.c"
        updated branch "/main"
            updated version "/main/0"
            created version "/main/1"
    Cataloging new objects
        cataloged symbolic link "/vobs/lib/glib/.@@/main/2/glib" ->
    "../gui/glib"
        cataloged symbolic link "/vobs/lib/glib/.@@/main/3/glib" ->
    "../gui/glib"
        cataloged "/vobs/lib/.@@/main/CHECKEDOUT.32/glib"
        cataloged symbolic link "/vobs/lib/glib/.@@/main/1/file.c" ->
    "../gui/glib/file.c"
        cataloged symbolic link "/vobs/lib/glib/.@@/main/2/file.c" ->
    "../gui/glib/file.c"
        cataloged "/vobs/gui/glib@@/main/1/file.c"
    Removing original objects
        removed "glib/file.c"
        removed "glib"
    Checked in "/vobs/lib/." version "/main/4".
    Checked in "/vobs/gui/." version "/main/1".


    cmd-context  describe vob:/vobs/gui
    versioned object base "/vobs/gui"
      created 2007-04-09T13:50:16 by CCase Admin (clearadm.sys@propane)
      "relocate target for former directory /vobs/lib/gui"
      VOB storage host:pathname "propane:/usr1/vobstore/gui.vbs"
      VOB storage global pathname "/net/propane/usr1/vobstore/gui.vbs"
      VOB ownership:
        owner clearadm
        group sys
    Hyperlinks:
        RelocationVOB@33@/vobs/gui vob:/vobs/gui -> vob:/vobs/lib/

Files

relocate.log.date-time