Clearcase Technical blog

General musings on Clearcase

Clearcase : Restore an element that has been rmnamed

Question : What procedures can be use to restore an IBM® Rational® ClearCase® element whose name has been removed (rmname)?

Cause : A directory used to have a full compliment of file elements, and along the way, some elements had the name removed from the directory using the cleartool rmname command. Note: The Delete operation from within ClearCase Explorer also executes a cleartool rmname, not a cleartool rmelem or cleartool rmver. For example, from within your view, right-click a file or directory element, select Delete, and read the details in the dialogue that appears, then click Cancel.

Answer : There are a few different ways to get the element names back into the directory in question.

Prerequisites: Determine which files are invisible. Here are three methods which can be used to help determine the needed directory version for the next steps:
a. On the branch that your view is set to run the following command to list out all the versions that are not visible (excludes those that are visible).
cleartool find . -all -nvisible -print

b. Within ClearCase Explorer, right click the directory where the element is missing and select Compare with Previous Version to see if the element existed in the previous version of the directory.

The ClearDiff window that is displayed will show the missing element in the left pane of the window. On top of that window you will see a path like the following that identifies version 4 of the directory named "directory" on the main branch: Note: You will need this path information after the version extended syntax (@@) as this is to be used in the link command. From the example, @@\main\4 can be used to find the missing element at the path .@@\main\4\
c. Run the cleartool lshistory command or the History Browser GUI on the directory to find which version of the directory the file was rmnamed which will indicate that it existed in the prior directory version prior to its removal. Note: You will need the previous version of the directory for the next step. For example, say lshistory reports the following:

M:\view\my_test_vob>cleartool lshistory -d -minor -since today
17-May.07:31 user1 create directory version ".@@\main\43"
"Uncataloged file element "cs.txt"."

You will need to use version \main\42 for the next steps.

Restoring the elements

1. Checkout the directory where the element is missing.
2. Use one of the following procedures to restore the element name back to the LATEST version of the directory:
• Create a link using the cleartool ln operation for each element. For example, the missing element is called test.txt

cleartool> ls
foo.c@@\main\13 Rule: \main\LATEST

cleartool> ln .@@\main\4\test.txt .\test.txt
Link created: ".\test.txt".

cleartool> ls
foo.c@@\main\13 Rule: \main\LATEST
test.txt@@\main\7 Rule: \main\LATEST

• Merge the directory graphically from the version tree browser:
1. Start the version tree browser for the directory by right-clicking on the file directory, then select Version Tree.
2. After the version tree browser appears, right-click on a version of the directory known to contain the missing file and select Merge to... and select the current version of the directory in use.
3. When the dialog box appears, select Yes, and also select the option Merge the element graphically. Once the merge GUI appears, manually step through the differences between the current version and the selected prior version with the files.
Note: If you need assistance, you can use the Help available from within the Merge Manager tool.
4. Undo the difference resolution for the removed element names and then select the correct contributor you wish to use.
5. Save the results, and close the graphical merge window.
You may need to Refresh your view for the element names to reappear in the directory version that they were just restored to.
6. If the results are correct, then right-click the directory and click Checkin.
• Merge the directory using cleartool merge -delete to "undo" the rmname operation (this option is somewhat more complicated).

Caution: If more than one change was made to the directory in this version, those changes could be reverted as well. Use the cleartool lshistory command to determine what other changes were made to that directory version.
1. Determine the version where the element was rmnamed.
2. Use cleartool merge -delete to remove the changes applied in that version of the directory.
For example:
cleartool merge-to . -delete -version \main\17
3. If the only change made in this version was the removal of the desired element, the change should automatically be made (see about caution).

1 comments:

Thanks for sharing with us that awesome article you have amazing blog.....
Online Data Scientist

 

Post a Comment