ClearCase, Mapping specific folders into Drives, u

2020-02-15 02:18发布

问题:

I need to map a directory into it's own drive, (i know it's achivable using windows tools like "Map network drive", "subst"), but using these tools, the mapped drives aren't MVFS anymore...

I'm looking for a way to map MVFS folders in some dynamic view to it's own drive, or alternativly, configure a config spec to filter everything except a specific folder, for example, configure a config spec so that:

M:\some_dynamic_view\some_folder\some_nested_folder would be mapped to :

K:\some_nested_folder

Any ideas?

Thanks in advance, Erik.

(The need to map folders into drives is because of the clearcase path length limitation on windows).

回答1:

I just tested:

 subst N: M:\some_dynamic_view\some_folder\some_nested_folder

and N: would display the content of some_nested_folder, as a dynamic view would.
Its type is a MVFS filesystem drive (named CCase by default)

Now, to have only the directory (and not directly its content) in N:\, you would need a config spec like:

element /some_folder/some_nested_folder/... /main/LATEST
element /some_folder/* -none
element * /main/LATEST

(supposing a simple non-UCM view, with only the main branch to see. Adapt the config spec to your configuration and branch on which you need to read/modify files.
For a UCM view, that would be trickier, since those rules would have to be place before all the other generated UCM selection rules, meaning they would disappear at the next view config spec synchronization with its stream.)
(note: no need to use '\' in config spec, '/' works just fine, for Windows or Unix config spec)

Then, a:

subst N: M:\some_dynamic_view\some_folder

would only display some_nested_folder (and its content) in N:



回答2:

I mainly use snapshot views so I don't think I can use the m:\path_to_view solution. After many years of shouting "doh" at my monitor I wrote this batch file to save me having to change directory back to the original location of the view every time I wanted to run a cleartool command.

@echo off
rem ct.bat by Paul Douglas
setlocal
setlocal enabledelayedexpansion
set currentDirectory=%cd:~2,8189%
set currentDrive=%cd:~0,1%

for /f "delims=" %%a in ('subst') do (
set thisDrive=%%a
set thisDrive=!thisDrive:~0,1!
set targetFolder=%%a
set targetFolder=!targetFolder:~8,8183!
if "!thisDrive!"=="%currentDrive%" (
  pushd !targetFolder!%currentDirectory% 
  call cleartool %1 %2 %3 %4 %5 %6 %7 %8 %9 
  popd 
  goto :eof
)
)

call cleartool %1 %2 %3 %4 %5 %6 %7 %8 %9


标签: clearcase