2

I'm using ClearCase. I checked out several files under a directory, some of files in its sub-directory, some in sub-sub-directory.

What I want is to list the diff of all my modifications on these checked out files under this certain directory recursively.

What I currently do is:

for file in $(cleartool lsco -recurse -me -cview -fmt "%n\n"); do 
    cleartool diff -serial_format -pred $file; 
done

I use a bash for loop, but I perhaps it can be done with a simple ClearCase command.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
Qiu Yangfan
  • 871
  • 11
  • 25

1 Answers1

2

The OP suggests using the list of checked out files, but there is no way to find the diff in one cleartool command.
An xargs (used here) might be easier

cleartool lsco -recurse -me -cview -fmt "%n\n" | xargs -n 1 cleartool diff -serial_format -pred 
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your help, but there seems to be some issues. Clearcase diff doesn't have a -nc options, maybe it's a version issue? and diff asks for at least two objects to compare. – Qiu Yangfan Oct 23 '14 at 02:49
  • @user3093552 I have fixed the find command, and suggested an alternative to the bash loop. – VonC Oct 23 '14 at 05:27
  • Thanks again. For the find case, I got some errors like:`cleartool: Error: Unable to access "./ncs_trace.h@@": Is a directory.` For the xargs, seems the trailing `$file` should be removed. While even with it removed, as I tested, it dumped many lines which are far more than my modifications, don't know why. – Qiu Yangfan Oct 23 '14 at 06:08
  • @user3093552 I have limited the find to files only (not directories). And I have removed the `$file` (typo) – VonC Oct 23 '14 at 06:22
  • for the find case, I still got the errors like:`cleartool: Error: Unable to access "./ncs_trace.h@@": Is a directory.`, even with `-type f`; for the xargs case, it diff all the files together,like this: `******************************** <<< file 1: /nec01_core/cmw/noss/src/ncbmain.c@@/main/vz_int_rl50/dev_rh45_tomix_sdm/0 >>> file 2: ncbmain.c >>> file 3: necqueue.c ******************************** ` – Qiu Yangfan Oct 23 '14 at 06:35
  • @user3093552 regarding xargs, I found more ideas in https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000013788115: I have edited the answer to use `xargs -n 1` and add the final `"{}"` as a placeholder for the xargs argument. – VonC Oct 23 '14 at 06:43
  • For xargs, with the trailing `{}`, I got this `cleartool: Error: Pathname not found: "{}".`. Remove `{}` and preserve the `-n 1`, it works. As for the find case, if we cannot find out the cause, I think we'd better remove it then close this question. – Qiu Yangfan Oct 23 '14 at 07:21
  • @user3093552 ok, I have edited the xargs option, and removed the fnid option. – VonC Oct 23 '14 at 07:21