1

I'm working in a Windows dynamic view.
I am trying to create a tool shortcut using the ClearCase Menu Editor to automatically perform a 'mkelem' on all private files in my view.

I'm aware of 'cleartool lsprivate -other' to get a full path listing of all private files but I don't know how to feed that resulting list into the 'mkelem' command.
I'm also aware of the 'find' command and that at the end you can specific '-exec' to cause it to perform the additional action to be performed on the resulting list but once again I don't know what arguments to give to 'find' in order for it to only find view private files.

Can anyone help me with this?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
EricB
  • 21
  • 3

2 Answers2

1

Another approach I would consider/test is one I mentioned in "How can I use ClearCase to “add to source control …” recursively?", with clearfsimport.

I suspect clearfsimporting the view folder into the view itself should automatically add the private files, while keeping the existing files untouched. But, as commented, you would need to import in a new dynamic view (with same config spec) for that to work.

The problem with cleartool find is that it find versioned elements.
It can use %CLEARCASE_PN% or %CLEARCASE_XPN% as argument in its exec clause: that reference the pathname or extended pathname of already versioned element.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for that feedback VonC. I did look into using clearfsimport however the new "view private" files will already be in the view under their appropriate folder and clearfsimport required them not to already reside in their file destination in the view. Is there no argument that I can supply to cleartool find to just show me unversioned files (view private ones)? I've researched the command highly but can't seem to figure out all the options to give me this resulting list. – EricB Aug 17 '16 at 17:49
  • @Eric yes, you would need to clearfsimport into a new dynamic view with same config spec. As for listing private files, I know mainly of cleartool lsprivate. I would try and redirect its output to a text file, process it to add the cleartool mkelem command, and run it as a script file. – VonC Aug 17 '16 at 17:53
  • '@VonC thanks for that suggestion. I'll keep working towards that end. – EricB Aug 17 '16 at 17:55
0

Well, it's complicated, because you would need to check out the parent directories before creating the elements.

Have you tried a command similar to this:

for /f "delims==" %x ('cleartool lsprivate -other') do @cleartool co -nc "%~px" & cleartool mkelem -mkpath -ci -c "autoadd" "%x" & cleartool ci -nc "%~px"

-mkpath makes any missing parts of the path to the elements at the same time the element is created. That should -- with appropriate massaging to make it work in a "cmd /c" or batch job do the basics... Of course, this also goves you 1 new version of the parent directory per new element.

If you're not averse to Perl, you can expand upon this by taking that list, making any needed directories, and them making the elements.

Brian Cowan
  • 1,048
  • 6
  • 7
  • Yes, I'm assuming Windows. if you need unix, check out "xargs" – Brian Cowan Aug 17 '16 at 18:25
  • Brian, that's a great suggestion. Actually, I've noticed that new directories are automatically created when the file elements below are created. It's a nice side effect so no need to manually create the new folders in ClearCase. Thanks for the recommendation – EricB Aug 17 '16 at 21:41