Author Topic: Choose directory for workspace tag files using environment variable?  (Read 4396 times)

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Hi:

Is it possible to use an environment variable for specifying where the workspace tag files are?

The reason I ask is that I would like to store the .vpw in source control, and each user may want to store the tag file in a different place. For example, one user may have more space on his c: drive, another user may have more space on his d: drive. Or in Linux, each user may want to store the tag file in their home directory, which will be different for each user.

How can multiple users use the same .vpw file stored in version control while having a different location for the tag files?

I talked about this in a previous thread:

http://community.slickedit.com/index.php/topic,8007.msg41598.html#msg41598

Thanks,
Rob

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2791
  • Hero Points: 422
Re: Choose directory for workspace tag files using environment variable?
« Reply #1 on: September 30, 2014, 12:21:44 am »
Yes, in the .vpw file, simply specify the "TagFileDir" using an environment variable, such as <Workspace ... TagFileDir="%(HOME)/tagfiles/v19/">

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #2 on: September 30, 2014, 12:44:10 am »
Thanks.

Since I would like to store my workspace file in source control, the name of the workspace will always be the same, and I may have multiple copies of it for different branches of the source code. I wonder if I will have collisions in the .vtg file name?

Now what happens if I check out 2 different branches of my source code, and the .vpw files inside the different "copies" of the source is the same?

I would be switching between different .vpw workspace files to work on different branches.

For example, I would have 2 .vpw in these directories:

/view/view1/source_code/workspace.vpw
/view/view2/source_code/workspace.vpw

Both workspace.vpw have it stored to save the tag files in $HOME/tagfiles/v19.

Each time I open the workspace, will it try to create "$HOME/tagfiles/v19/workspace.vtg"

So if I open view1's .vpw, then open view2's .vpw, will the workspace.vtg that was created for view1 get overwritten by the workspace.vtg that was created for view2?

Is there a way I could tell SE to apply the directory structure under the tagfiles directory.

For example, I would like the tag files to be stored as:

$HOME/tagfiles/v19/view/view1/source_code/workspace.vpw
$HOME/tagfiles/v19/view/view2/source_code/workspace.vpw

Then there will be no collision.

So maybe we SE could accept another entity like an environment variable, such as saying:

<Workspace ... TagFileDir="%(HOME)/tagfiles/v19/$(full_path_of_workspace)">

In Windows, $(full_path_of_workspace) would expand c:/dir1/dir2 to /c/dir1/dir2

How to solve the problem of having workspace stored in version control and multiple branches of version control have same workspace name?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2791
  • Hero Points: 422
Re: Choose directory for workspace tag files using environment variable?
« Reply #3 on: September 30, 2014, 06:08:16 pm »
How about %(HOME)/tagfiles/%(CLEARCASE_ROOT)/workspace.vtg

You can also use other SlickEdit % escapes, such as %wx (for the workspace path).

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #4 on: September 30, 2014, 06:09:51 pm »
That won't work for me because on my Windows machines I don't have clearcase installed, and I am syncing my clearcase view to my windows hard disk.

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #5 on: September 30, 2014, 06:10:41 pm »
Just read the 2nd part of your mail.

I can try the %wx

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #6 on: September 30, 2014, 07:17:14 pm »
Hi:

Just tried the %wx, it does not work as planned.

In my .vpw file, I have this:

<Workspace Version="10.0" VendorName="SlickEdit" TagFileDir="%(TAGFILES_DIR)/%wx">

where I have defined TAGFILES_DIR=c:\Users\rbresali\tagfiles

The full path of my workspace is: C:\sync\rbresali_l1misc_dev2\enodeb_modem\dspapp\tools\slickedit\prj

The tagfiles are getting saved into the following directory:

C:\Users\rbresali\tagfiles\prj

This is not sufficient because there will be collisions when I use different clearcase views.

I expected the tagfiles to be in this directory:

c:\Users\rbresali\tagfiles\C\sync\rbresali_l1misc_dev2\enodeb_modem\dspapp\tools\slickedit\prj

But only the last dir 'prj' is used, which will cause collisions if I open more than 1 clearcase view.

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #7 on: September 30, 2014, 07:19:47 pm »
I just tried it with %wp instead of %wx, and when I try to retag the workspace, I get the following error:

"Could not create tags database c:\Users\rbresali\tagfiles\C:\sync\rbresali_l1misc_dev2\enodeb_modem\dspapp\tools\slickedit\prj\soc.vtg"

Looks like this is adding a colon ":" character where the c: drive is.

Any way to solve this problem?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2791
  • Hero Points: 422
Re: Choose directory for workspace tag files using environment variable?
« Reply #8 on: October 01, 2014, 03:48:10 pm »
Try this:

<Workspace Version="10.0" VendorName="SlickEdit" TagFileDir="%(SLICKEDITCONFIG)/tagfiles/%(last-path 5 %wp)">

You may need to go ahead and put those directories into place first.  That will be fixed in the next drop.

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #9 on: October 01, 2014, 03:52:34 pm »
Thanks Dennis! I will try it.

Can you explain what %(last-path 5 %wp) means?

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 4896
  • Hero Points: 399
Re: Choose directory for workspace tag files using environment variable?
« Reply #10 on: October 01, 2014, 07:46:47 pm »
I think we documented this. I can't remember exactly. Help will hopefully have an example. Search for "build escape" in index. I think that works.

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #11 on: October 03, 2014, 07:29:03 pm »
I tried this out and it works well. A few comments:

1) I did need to create the directories - thanks for adding the directory creation into the next drop. This will be very useful.

2) I found the documentation in the index under "Escape sequences for build commands". Thanks for the hint.

3) With clearcase usage in Unix, it will work fine as long as I use my view with path /view/<viewname>/vobdirs. But if I use 'cleartool setview' instead then the view can be accessed with just /vobdirs, and the unique part of the pathname will be gone, so %(lastpath...) won't find anything useful and may even generate an error. So probably need to tell all my colleagues to open the workspace file from /view/<viewname>/vobdirs instead of /vobdirs (after setting the view). I guess if anyone insists on using /vobsdirs, then we would need a 2nd .vpw file that uses %(CLEARCASE_ROOT) instead.

I'm looking forward to using this! No more running my script to create the workspace each time!

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #12 on: October 03, 2014, 08:47:58 pm »
Found a usability flaw in this approach.

Since all .vpw files will be the same name in different views because it is stored in source control, when I go to open a workspace and I want to look at my recent workspaces to choose what to open, the unique part of the name will be missing.

See in the attached screenshot.

All I see in the list of recent workspaces is:

soc.vpw - c:\..\dspapp\tools\slickedit\prj\soc.vpw

The ".." is hiding the unique part of the path that I need to see to know which view's workspace I am opening.

With my script, each workspace gets the name of the clearcase view.

If the entire path could be shown in the most recent workspaces list, it would help the usability.

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 4896
  • Hero Points: 399
Re: Choose directory for workspace tag files using environment variable?
« Reply #13 on: October 04, 2014, 02:55:24 am »
Try setting the macro variable def_max_fhlen to something larger. You may need to restart SlickEdit or close and reopen the workspace.

rowbearto

  • Senior Community Member
  • Posts: 1468
  • Hero Points: 111
Re: Choose directory for workspace tag files using environment variable?
« Reply #14 on: October 04, 2014, 04:01:53 am »
Thanks Clark!

That works well.

One minor comment: I could not find def_max_fhlen in the Help index, so it seems undocumented.