1

I did some research on how to create a patch for a directory. For example, How to create a patch for a whole directory to update it?

But the first step is to ask you to create a separate directory that contains all your change.
But, since I made change under ClearCase, and I feel there should be a better to do this. Also, make a separate new directory can take huge chunk of storage space.

Any suggestions?

Community
  • 1
  • 1
xxks-kkk
  • 2,336
  • 3
  • 28
  • 48

1 Answers1

1

If you want to make patches from the current work in progress (the files that are checked out in the current folder), you can use cleartool lsco (or cleartool ls) combined with cleartool diff:

 cd /path/to/my/view/myfolder
 cleartool lsco -s -cview | xargs cleartool diff -pred -diff_format
# for all files:
 cleartool ls -s -view-only | xargs cleartool diff -pred -diff_format

The -diff_format option causes both the headers and differences to be reported in the style of the UNIX and Linux diff utility.

You can redirect the output to a file in order to get your patch.

Add -recurse to cleartool ls or cleartool lsco, to get the files in subfolders.

If you know the branch you are in, you can do a diff with a different version than "-pred":

| xargs -0 -i sh -c '`cleartool diff {} {}@@/main/yourBranch/0`'

"xargs : using same argument in multiple commands" proposes another syntax:

| xargs -n1 -I_afile -- sh -c '`cleartool diff _afile _afile@@/main/yourBranch/0`'
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How about the check in files? Do I need to do checkout first before I can use the command you suggested? Thanks! – xxks-kkk Jan 06 '16 at 08:26
  • @Jerry If you are interested in *all* files of the folder, use `cleartool ls` instead of `lsco`. I have edited the answer accordingly. – VonC Jan 06 '16 at 08:26
  • I'm only interested in the files that I have made changes. Does the command also cover the files under subdirectories? Thanks! – xxks-kkk Jan 06 '16 at 08:30
  • @Jerry it does, if you add the `-recurse` option. – VonC Jan 06 '16 at 08:32
  • Also it seems that the command only covers the predecessor of my file. I made multiple changes and checked in multiple times. But, I want to create patch only for, say between version 7 and 0, not version 7 and 6. Thanks! – xxks-kkk Jan 06 '16 at 08:35
  • 1
    @Jerry I have edited the answer (with a unix syntax though, assuming you are not on Windows) – VonC Jan 06 '16 at 08:48
  • I got the following error after trying your command: "cleartool: Error: At least two objects must be supplied to compare." Is there any symbol mismatching? I saw only one ` – xxks-kkk Jan 06 '16 at 09:04
  • @Jerry the `{}` is supposed to be replaced by the argument passed to xargs. Can you show the exact command you are typing? What OS are you on? What ClearCase version are you using? – VonC Jan 06 '16 at 09:15
  • @Jerry I have fixed the typo – VonC Jan 06 '16 at 20:28