Palace Chan
Palace Chan

Reputation: 9183

Trying to undo a cleartool rm

I was trying to migrate a file from directory A to directory B in a branch, call it file.txt. What I did was:

cd A
cp file.txt ../B/
ct rm A
cd ../B
ct mkelem -ci -nc file.txt

Thereby losing all the history. I am trying to recover from this to do what I should have done which is simply ct mv file.txt ../B

I read that for this I should do something like this:

cd A
ct ln .@@/main/?/file.txt ./file.txt

where luckily, from another view, I've figured out ? should be 27. Unfortunately when I try to do the above I get:

cleartool: Error: Entry named "file.txt" already exists.
cleartool: Error: Unable to create link: "./file.txt".

and I try to do:

ct rmelem file.txt

but got:

cleartool: Error: Element "file.txt" has branches not created by user

though presumably that's not what I should be doing anyway. How do I get back that file? It was simply a ct rm. I even get the entry already exists error if I do ct rm on the new copy file I added to directory B..

Upvotes: 1

Views: 1455

Answers (1)

VonC
VonC

Reputation: 1324447

You are on the right track, but I would recommend a simple rmname, instead of a rmelem (which deletes the element with all its versions, branches and such).

That would remove file.txt from the latest version of the parent directory, and allows you to proceed with the symlink.

Next time, a cleartool mv might be easier, and keep the history of the file being moved.

Upvotes: 2

Related Questions