Topic
7 replies Latest Post - ‏2013-07-17T18:01:41Z by brcowan
skr3ch
skr3ch
4 Posts
ACCEPTED ANSWER

Pinned topic More info about ClearCase views

‏2013-07-09T15:05:19Z |

Hi all.

My question is: how ClearCase recognize that a Windows folder, is a view?

Is there a particular/special invisible file in the folder, that "mark" it as view, to CC?

 

For example, if I execute in cmd:

"clearexplorer C:\view" -> it open the GUI in which I can see the view content.

If i excecute:

"clearexplorer C:\not_a_view" -> it open the GUI, but showing a message that it can't find a view in that path.

 

Thanks!

  • Dilip.J.Mansukhani
    Dilip.J.Mansukhani
    98 Posts
    ACCEPTED ANSWER

    Re: More info about ClearCase views

    ‏2013-07-09T18:46:56Z  in response to skr3ch

    Hi,

    one way is to do cleartool lsview view_name

    which can tell you if this is dynamic view or snapshotview.

    if the view is dynamic view then generally it is map to M: drive and if it is snapshot view then it will have root folder which has files inside which cleracase

    can recongnize this is use for view.

     

    Thanks

    Dilip

     

    • skr3ch
      skr3ch
      4 Posts
      ACCEPTED ANSWER

      Re: More info about ClearCase views

      ‏2013-07-10T07:29:10Z  in response to Dilip.J.Mansukhani

      Ok, thanks for the answer.

      I haven't premised that I use only snapshot type.

      Now, if I launch that, it show me the full network path of the view directory on the server, so, yes, its root folder.

      But isn't relative to the local path, for allow me to launch a "clearexplorer ...".

  • Dave-Robinson
    Dave-Robinson
    116 Posts
    ACCEPTED ANSWER

    Re: More info about ClearCase views

    ‏2013-07-11T00:22:05Z  in response to skr3ch

    For snapshot views on Windows, ClearCase looks for the file "view.dat", which has the "hidden" attribute set in the Windows file sytem.

    If the snapshot view was created on a UNIX machine (and you are accessing from Windows over SAMBA, say) it shall instead have a file called ".view.dat"  and ClearCase on Windows shall not recognize it as a snapshot view.

     

     

    There is a second mechanism for ClearCase on Windows also: it looks for the directory to be registered in the Windows registry under "HKEY_CURRENT_USER\Software\Atria\ClearCase\CurrentVersion\Workspaces". I am not sure that this key has any relevence to ClearCase Explorer, but it is important to the Windows Explorer integration.

    C:\Snapshots\drobin_CodeGen_Int>reg query HKCU\Software\Atria\ClearCase\CurrentVersion\Workspaces

    HKEY_CURRENT_USER\Software\Atria\ClearCase\CurrentVersion\Workspaces
        C:\Snapshots\DJR_default    REG_SZ    C:\Snapshots\DJR_default
        C:\Snapshots\DJR_Main_Int    REG_SZ    C:\Snapshots\DJR_Main_Int
        C:\Snapshots\drobin_CodeGen_Int    REG_SZ    C:\Snapshots\drobin_CodeGen_Int

     

    This gets put there at view creation.

    Note that the key is under HKEY_CURRENT_USER, not HKEY_LOCAL_MACHINE - different users logging in to the same machine do not share this.

    If you try to access a snapshot view from a different machine over a UNC path, say, this will not be set up.

    If you right click on a snapshot root in Windows Explorer and it is not already in this key, it gets added - because it sees the "view.dat" file.

     

    • skr3ch
      skr3ch
      4 Posts
      ACCEPTED ANSWER

      Re: More info about ClearCase views

      ‏2013-07-12T13:37:43Z  in response to Dave-Robinson

      Thanks Dave, this is the perfect answer I was searching.

      The only problem is that the output of reg command isn't manageable, and I need only the first or the third "column".

      But probably, this isn't the right website for resolve it.

      Thanks a lot

      • Dave-Robinson
        Dave-Robinson
        116 Posts
        ACCEPTED ANSWER

        Re: More info about ClearCase views

        ‏2013-07-12T14:36:51Z  in response to skr3ch

        >for /f "skip=2 tokens=1" %v in ('reg query HKCU\Software\Atria\ClearCase\CurrentVersion\Workspaces') do @echo %v

        • skr3ch
          skr3ch
          4 Posts
          ACCEPTED ANSWER

          Re: More info about ClearCase views

          ‏2013-07-12T14:52:34Z  in response to Dave-Robinson

          I also found this solution, but if the path contains spaces it doesn't work.

          • brcowan
            brcowan
            721 Posts
            ACCEPTED ANSWER

            Re: More info about ClearCase views

            ‏2013-07-17T18:01:41Z  in response to skr3ch

            Well, you could use Perl to open the registry, there is some sample code you can look at in ...\ClearCase\config\scheduler\tasks\mvfs_log_scrubber.pl that uses Win32::TieRegistry;

            Using C or VB has all kinds of examples on MSDN.

            Windows batch files are harder to tweak using reg QUERY... Reg EXPORT doesn't work well with CMD because CMD wants ASCII and reg export outputs UTF-16 unicode.

            Everything depends on what you're trying to accomplish...