问题
I am experiencing a problem with Clearcase. What happened was the following: I had a file ValidationScripts.js, and wanted to create another file in the same directory, MiscScripts.js. However, instead of creating a new file, I accidentally renamed ValidationScripts.js to MiscScripts.js. I tried to recreate the ValidationScripts.js file using merge, and now I am stuck with the same file, but with two different names: ValidationScripts.js and MiscScripts.js. So, whenever I try to change to contents of ValidationScripts.js, they are also reflected on MiscScripts.js. Is there any way to fix this?
TIA.
回答1:
It isn't completely clear what you did, but what you should have done is this, assuming that the file MiscScripts.js
already existed as a plain (view private) text file, and that 'ct
' is an alias for cleartool
:
cd /vobs/yourvob/directory
ct co -c 'Add MiscScripts.js' .
ct mkelem -c 'Miscellaneous JavaScript Script Fragments' MiscScripts.js
ct ci -nc .
ct ci -nc MiscScripts.js
Now we have to try and guess what you actually did.
I will assume you checked out the directory. You then said:
instead of creating a new file, I accidentally renamed ValidationScripts.js to MiscScripts.js
There are two possibilities:
mv ValidationScripts.js MiscScripts.js
ct mv ValidationScripts.js MiscScripts.js
To fix case 1, you should simply have run:
mv MiscScripts.js ValidationScripts.js
To fix case 2, you should either cancel the directory checkout or undo the move:
Either
ct unco -rm .
Or
ct mv MiscScripts.js ValidationScripts.js
You then go on to say:
I tried to recreate the
ValidationScripts.js
file using merge, and now I am stuck with the same file, but with two different names:ValidationScripts.js
andMiscScripts.js
.
And this has me puzzled...I can't see how merge would help. The latter comment sounds as if you did something like:
ct ln MiscScripts.js ValidationScripts.js
Without knowing exactly what you've done, it is a little difficult to know what to recommend. Key issues are:
- Did you use
ct mkelem
to create a new file?- If you did, then we have to worry about not creating a lost entry in the VOB's
lost+found
directory. - If you did not, then life is simpler.
- If you did, then we have to worry about not creating a lost entry in the VOB's
- Did you checkin the directory yet?
- If not, do not do so.
- If you did, then we will need to work out how to get you back to the previous revision (but we no longer have to worry about
lost+found
files.
- Did you checkin
MiscScripts.js
yet?- How much this matters depends in part on the answers to the prior questions.
回答2:
To add to Jonathan's answer, you need to check the history (cleartool lsvtree -graph
) of the parent directory of ValidationScripts.js
: you will see what has been added/removed in said directory.
A simple 'cleartool ls' in that directory can also show you if there is a symlink between ValidationScripts.js
and MiscScripts.js
.
That would be like you tried to restored a deleted file, as described in "Restore an element that has been rmnamed", but made the wrong 'cleartool ln
'.
来源:https://stackoverflow.com/questions/8423453/clearcase-renaming-issues