Switching between multiple ClearCase regions - version-control

I'm trying to figure out how can I switch between multiple ClearCase regions without going and modifying the ClearCase properties every time.
Any help would be appreciated.

Even in the latest ClearCase 9.0.1, changing the region does involve changing the ClearCase properties: see "Assigning a Rational ClearCase host's registry and region".
What you can do (if you don't want to fully switch region through registry/properties) is take advantage of the -reg/-region option for some command.
See for instance cleartool lsview -reg newtwork-region: you can list views of other regions without changing your current one.
But that remains limited to listing resources (Vobs, Views).
Once you are using commands within a view (lscheckout, checkout, ...), said commands are expected to work within the current region.
You might need to consider registering (cleartool register) a view from another region into the registry of this current region.
The alternative, as mentioned in the comments, is to modify the registry, as with this Javascript program REGION_SWITCHER.js from 2005.
Source code.
It modifies:
HKEY_LOCAL_MACHINE\SOFTWARE\Atria\ClearCase\CurrentVersion\Region

You can have multiple regions and share the views between them. The catch is that if you are in a mixed Unix/Windows environment, Unix can only use Unix views, while Windows can use both.
At my company, we have a Unix region and a Windows region. If I want to be able to use the same view in both regions, I create it on Unix and then use the Region Synchronizer (look for this on the Administration tab of ClearCase Home Base) to make the view available in Windows. The tool will take care of registering the view and creating its tag in the second region with the correct path needed to access it. (We share our Unix view storage locations with Windows using Samba.)
I'm not sure what you need to do to set ClearCase up in the first place so that it's able to see both regions, but as long as you can see both (and you can if the cleartool lsview -reg works), the Region Synchronizer is the tool you want to use to make it so you can easily check in and check out and otherwise use the view as if it were created in your own region.

Related

Project switching in emacs

I would like to associate sets of buffers/files in emacs with different projects, and switch from one to other. This would involve closing all the buffers associated with the present project and open the files corresponding to the switched-to-project. I tried setting up desktops using bookmarks+ as suggested in https://emacs.stackexchange.com/questions/315/using-desktop-for-basic-project-management but all buffers remain open. I also tried setting up workgroups using workgroups2 (https://github.com/pashinin/workgroups2), but had similar issues. Is there an existing emacs package that could be used for this?
There is an excellent package called Projectile that does exactly what you describe and more.
Alternative suggestion
I recommend that you don't look to emacs to manage buffers, frames, and editor state separately across projects.
Instead, use a desktop manager and create separate desktops for each project. This works well because not only can you have separate emacs instances (that you can be sure are truly separated), but you can also have separate web browsers open to documentation or other project-specific applications that collectively get swapped in and out when you switch between projects.
You say, "I tried setting up desktops using bookmarks+ as suggested in using-desktop-for-basic-project-management but all buffers remain open.".
I guess you mean that switching to a desktop does not kill buffers that existed before the switch. Not by itself, it doesn't. How can it guess which such pre-existing buffers you want killed?
Clearly you do not want to kill all buffers that existed prior to the desktop switch.
To get the behavior it seems you want, you would need to somehow decide, and specify, which such buffers you would like killed. You could, for example, choose to kill all that have a certain mode (perhaps using desktop-buffer-mode-handlers).
With Bookmark+ you can have bookmarks that do more than one thing. In particular, here, you could create a sequence bookmark that chains together (1) a function bookmark that kills all of the buffers you want to kill and (2) a desktop bookmark.
Or you can perhaps make use of desktop-after-read-hook or desktop-buffer-mode-handlers to do some cleanup.
(But it sounds like you have not really thought through exactly what behavior you want with respect to buffers that you do not want to "remain open", so that you can specify it clearly. If you can specify it then you can probably implement it fairly easily, using either desktop hooks or bookmarks or both. Just a guess.)

Clearcase find command prerequisites

How do I use cleartool find to search a bare vob? Must I always first define a view?
I typically use CCRC and in this case I am looking for a list of all files of a certain branch type.
EDIT:
This page says:
Typically, you start with all objects in a directory tree as seen in
your view. You can also start with all objects in one or more VOBs,
regardless of they are visible in a particular view.
I'm looking for information on the version of the command that the second sentence describes.
You cannot use cleartool in a CCRC setting.
CCRC (ClearCase Remote Client) is a light-weight ClearCase installation which communicates with a CCRC server (which, in turn, talk to a full ClearCase Vob server).
You can use rcleartool, the CCRC CLI, but it doesn't include a find comnand.
'cleartool find' itself is always used in a view, because it needs a path (to at least a Vob).
You can also start with all objects in one or more VOBs, regardless of they are visible in a particular view.
That doesn't mean you can use cleartool find outside a view.
The two pages giving a lot of examples are:
SAMECS find examples
IBM additional find examples
The SAMECS link and the cleartool man page are clear:
-avobs
By default, find starts with all the elements, branches, and versions in all the VOBs mounted on the local host.
In a snapshot view, find –avobs issues a warning if all mounted VOBs have not been loaded into the view.
This option depends on the MVFS and is ignored on hosts that do not support dynamic views.
You must be in a view context to use find –avobs.
If the CLEARCASE_AVOBS EV is set to a colon-separated list of VOB tags (in UNIX; in Windows, list items must be separated by semicolons), this set of VOBs is used instead.
In short, to access any vob content, they must be loaded (snapshot view) or mounted (dynamic view). In both cases, even though the find is not restricted by the view confi spec (especially in the case of the -avobs option), a view is still needed to run cleartool find.

Emacs modes/functions and xmonad

So I'm wondering if it's possible to take XMonad's ability to shift certain applications to specific workspaces a step further and apply it to specific modes/functions of Emacs?
For example I have mod+shift+u bound to spawn "emacs -f mu4e" which runs drops me into mu4e, the mail mode/function that i'm using to read mail. I'd like to bind that to a specific workspace instead of just opening in whatever workspace i'm in at present.
The problem (or not really a problem) is that I use Emacs extensively (mail, irc, etc.) and i'd like to have the specific modes/functions associated with workspaces and not have to move them there manually. I've looked at many XMonad.hs configurations and it seems that a huge majority use apps like pidgin, xchat, etc. and so it's trivial to setup the workspace association.
Maybe you could specify a specific window title for your Emacs frame and use it to setup the workspace association (instead of the window class, which I assume you'd use for pidgin or xchat)
emacs --title "mu4e" -f mu4e
I don't know xmonad, but if it is not able to provide workspace associations based on windows titles, you could use a tool like wmctrl instead. For example (assuming you want to move to the desktop number 4):
wmctrl -r mu4e -t 4

Accessing files in ClearCase through PowerShell

I am trying to copy some files out of ClearCase using PowerShell. I don't need to actually check them out - it's part of a build process, so I just want to be able to grab copies of them.
My guess is that I need to use cleartool, perhaps with "find", but I'm having trouble actually getting to the files that I want. No matter what "paths" I use I always get an error message. For example:
cleartool find My_VOB\A_Folder\A_Subfolder -print
gives me the error message, "No such file or directory."
I'm trying to make this script reusable by everyone in our development group, so I'd prefer not to have it tied to any specific view. Do I need to create a view on the fly to work with ClearCase?
If you want to copy files, you need a view to access them.
(That is what a ClearCase view, either dynamic or snapshot, is for: accessing specific versions of files)
Either that view exists (and its root path is passed as a parameter) or it don't (in which case I strongly recommend a dynamic view for those kind if reading access)
Even though a cleartool find can list versions not visible in the current view, it still needs a view as a starting point.
A lot of other find examples are available in this IBM article "Additional examples of the cleartool find command".
This thread lists some causes for the "no such file or directory" error message.
(like being in a private directory, as in "non-versionned directory")
This case shows an example of Powershell script using CAL (the ClearCase Automation Library)
You definitely need a view, and make sure the VOB is mounted.

PowerBuilder IDE Customization for SCC

Our PowerBuilder application is fairly large and has many objects in several PBLs for organizing our code. We often have 10 or more datawindows on one window, and these datawindows may be spread across two or three PBLs. For version control, we use exclusive check-out to avoid merge conflicts.
The situation is that when you right-click on a datawindow object from the Window painter you get a context-menu with options like "Script" and "Properties" and "Modify Datawindow...". We'd like to add one for "Check-out..." to avoid having to hunt for the datawindow in several PBLs.
Any ideas on how to do this, or something similar, would be greatly appreciated.
I think the best you can do is to create a temporary library at the top of your library list, locate your datawindows by jumping to them via "Modify Datawindow...", then saving them into your temporary library, and finally using the tools in your source control system to locate them by name and lock them.
One other trick that I use is to uncheck the tick box in the source control options that clears down the .srd etc files, then using your operating system's find tools to search on file name for these (since Powerbuilder still doesn't support searching for objects by name...). Of course if you don't have many objects, and if your objects don't have many references, you could always use Powerbuilder's search... but who do you know in the that fortunate position?!!
I think you've hit on a problem that a lot of people run into, which runs right through a loophole in PB that lets you start editing a DataWindow without warning you to check it out. Unfortunately, to the best of my knowledge there is no way to hook into the context menu.
However, you can hook into toolbar items. If that was the way I wanted to go, and I had plenty of time to spare, I'd write an app that I would launch from the toolbar, and here's what it would do:
Find the PowerBuilder window with APIs
Find the current sheet in PB
Get the object name out of the title
Get the current application (registry or PB.INI, depending on the version of PB, and may involve getting the workspace first, then the current target)
Get the library list (PB.INI or target file)
Do a LibraryExport() on the object that's open
Find all DataWindow controls (this may involve looking at ancestors to determine control types)
Identify dataobjects for these controls (again, you may need to look at ancestors)
Use LibraryDirectory() to get a list of all objects in all PBLs
Find the dataobjects' PBLs
Throw up a window listing the dataobjects and their PBLs
OTOH, if I had PBL Peeper (and, yes, this is biased advice), I'd
Launch the "PBL Peeper (Browse current application)" icon on my desktop (OK, that's a lie; I'd already have PBL Peeper open and would just switch to the Browse page)
Ctrl-Q (for QuickFind) and start typing the name of the object (if you pause, it will find a partial match on what you've typed)
Hit [Enter] once to accept QuickFind's selection
Hit [Enter] again to expand the object
Find the DataWindow control in question and RMB on it
Select "Go to Default DataWindow"
If it doesn't show the library and name in the microhelp (it's been a long time since I've released a version, and I can't keep track of what's in the released version), find the Up toolbar item to go up to the PBL
I know this doesn't achieve a checkout, but it does "avoid having to hunt for the datawindow in several PBLs". And, you can probably achieve this faster than my first suggestion.
Good luck,
Terry
The way I do it is to right-click and choose Modify DataWindow. When the painter opens you can just read the PBL from the title of the painter. Then close the DataWindow painter so PB will let you check out the DataWindow. For the more general case of locating an arbitrary user object, use Terry's PBL Peeper method.
You could separate the organization of PBLs used for development from those used for deployment.
As long as the PBL names don't conflict between the two views into the source code. The PBG files registered in source control won't clobber each other.
The downside is that when new objects are added or deleted, you will need to update both locations.
I would create a datawindow only PBL with all the related objects and put them in the same target. When I worked with that sub-system or report i could then check out all the objects in the same library.