Working with cleartool under UNIX, if I have a file in a snapshot view that is unmodified (e.g. still checked in, not checked out, not hijacked), I can successfully get its predecessor version with this:
$ cleartool describe -predecessor -short file.c
/main/ABC_int/ABC_STAGING/user_ABC_STAGING_dev1/9
No problem in that case.
However, if the file happens to be hijacked (which happens very often with the way I work), cleartool describe refuses to give me its predecessor version:
a) The following two lines simulate an hijack:
$ chmod 666 file.c
$ touch file.c
b) Then at that point if I try the same command line again on the same file:
$ cleartool describe -predecessor -short file.c
cleartool: Error: -predecessor invalid for non file system objects: "file.c".
How can I get the changeset predecessor version path of the file when it is hijacked?
Is there a different way to do this than:
- Take a backup of the hijacked file (
"cp file.c file.c.backup"
), - Run
"cleartool update -overwrite <file>"
to un-hijack it, - Re-run the cleartool describe command line on it to get the predecessor on the un-hijacked file (
"cleartool describe -predecessor -short file.c"
), - Then re-hijack it again (
"chmod 666 file.c"
), - And finally move the backup on top of it ("
mv file.c.backup file.c
")?
Thanks!
One simple solution is to have a dynamic view with the same config spec as your current snapshot view.
While the file state in the snapshot view might not allow to get its predecessor version, the same file referenced in the dynamic view will.
You would still work as usual in the snapshot view, but you would rely on the dynamic view to get the information you need.
The OP confirms in the comments: