Two checks performed by the add command help to prevent twins from being created:
In this situation, all the other twins in the set have (stranded) and
(twin) status. These elements are displayed by the Stranded search in the File Browser Outgoing Changes mode, and by the AccuRev CLI command
stat –i:
Tip: Twin elements are displayed in the File Browser Conflicts mode.
This flexibility stems from the fact that after an element Rename operation (CLI command:
move), the element’s former name becomes available for reuse immediately. (Previous releases “reserved” the former name, in case the change was purged from the workspace — see
When a Purge Operation Causes an Element to Disappear below.)
> accurev move brass.h util.h
Moving \.\src\brass.h to \.\src\util.h
>
copy c:\temp\temp_new_brass.h .\brass.h
1 file copied
>
accurev add brass.h
Added and kept element \.\src\brass.h
>
accurev promote util.h
Validating elements.
Promoting elements.
Promoted element \.\src\util.h
>
accurev promote brass.h
Validating elements.
Promoting elements.
Promoted element \.\src\brass.h
Note that util.h (formerly named
brass.h) must be promoted first, to “free” the name
brass.h in the parent stream. Then the new element named
brass.h can be promoted.
Stranded files are reported with the status flag (stranded). If a stranded file happens to be a twin of another element, it is also reported with the status flag
(twin).
Tip: Twin elements are displayed in the File Browser Conflicts mode.
The final case, “pathname cycle”, occurs when two sibling workspaces make contradictory changes to the depot’s directory hierarchy, then promote the changes to the common parent stream. For example, one workspace might move directory src under directory
util, while another workspace moves
util under
src. When both the changes are promoted to the parent stream, AccuRev won’t be able to determine the correct pathname for these directories and the elements under them. The two directories assume
(stranded) status, and the elements under these directories become inaccessible.
The CLI provides tools for relieving situations involving stranded elements. The move,
defunct, and
undefunct commands support the
–e option, which enables you to specify an element by its element-ID, rather than by its pathname. This is necessary for situations in which the desired element does not
have a pathname in the workspace or stream.
For example, suppose that file element commands.java resides in directory
cmd_interface. A colleague changes the name of the directory to
cli in her workspace, then promotes the change to the parent stream. When you update your workspace, the pathname of the file changes from
.../cmd_interface/commands.java to
.../cli/commands.java, as a “side effect” of the change to the parent directory. Note that this is not a change to the
commands.java file element itself.
On the other hand, if the colleague moves file commands.java to another directory, say
.../cmd_interface/utils/commands.java, this
is a change to the file element. When you update your workspace, the pathname of the file changes accordingly (unless you have made a namespace-related change to the file, in which case a merge is required).
The algorithm used by the Merge command (both in the GUI and the CLI) uses the analysis described in the preceding section.
Merge may perform two separate namespace-related steps:
Often, either or both of these steps will be performed automatically by Merge. If only
one of the two contributors differs from the versions’ closest common ancestor, then that contributor’s change is applied automatically.
(Note that Merge may also need to perform a third step — a content merge — for a file element.)
The following example of the CLI merge command involves both kinds of namespace-related changes: (1) a file’s simple name has been changed by two users,
john and
mary; (2) each user has moved the file to different sibling directory.
> accurev merge file01.mary
Current element: \.\dir02\sub03\file01.mary
most recent workspace version: 4/2, merging from: 5/5
common ancestor: 5/3
Both “path” and “element name” conflicts must be resolved manually, but
the contributors’ contents can be merged automatically.
Path merge will be required.
Element name merge will be required.
Automatic merge of contents successful. No merge conflicts in contents.
Path conflict for \.\dir02\sub03\file01.mary
John moved the file from directory sub02 to directory sub01 (which has element-ID 68).
Mary moved the file from directory sub02 to directory sub03 (which has element-ID 82).
Resolve path conflict by choosing path from:
(1) common ancestor: \.\dir02\sub02\ [eid=75]
(2) backing stream : \.\dir02\sub01\ [eid=68]
(3) your workspace : \.\dir02\sub03\ [eid=82]
Actions: (1-3) (s)kip (a)bort (h)elp
action ? [3] 2
John renamed the file from from file01.txt to file01.john.
Mary renamed the file from from file01.txt to file01.mary.
Resolve name conflict by choosing name from:
(1) common ancestor: \.\dir02\sub01\file01.txt
(2) backing stream : \.\dir02\sub01\file01.john
(3) your workspace : \.\dir02\sub01\file01.mary
Actions: (1-3) (s)kip (a)bort (h)elp
action ? [3] 3
The content merge is performed automatically.
Actions: keep, edit, merge, over, diff, diffb, skip, abort, help
action ? [keep]
Moving \.\dir02\sub03\file01.mary to \.\dir02\sub01\file01.mary
Kept element \.\dir02\sub01\file01.mary