I'm doing some scripting with ClearCase and I have to provide a pvob name.
I'm in a context of a view (dynamic or snapshot) and I have an element name (e.g. <path>\filename.cpp) or specific element and file version (<path>\filename.cpp##\main\versioname\2)
How do I get its pvob?
Seems like I have to figure out the vob name and then find its linkage to a pvob?
Thank you
There is no direct link between a vob element and a PVob (which contains reference to UCM objects)
What you can do is, within the current path of your element:
cleartool lsstream -cview
That will give you the name of the Stream of the view, which is attached to a PVob.
However, your element could be part of a component from another pvob.
Another option is to list all the components for all pvobs, with their root directory, and check the one with a root directory similar to the path of your element.
Note: one other link is in the activity: a cleartool descr -l yourElement would display the activity (and its pvob).
But again, that pvob can be different of the component one from which your element is part of.
A bit more direct link: do a dump of your element
cleartool dump -l /path/to/your/element
[...]
derived objects:
hyperlinks to object:
arrow=1249731306
type=27209
hlink vob=90b77fed.efb24bb6.8312.8e:09:7f:84:65:a1
hlink obj=64856a02.8d9d4624.abae.09:94:b0:e7:9c:2e
from vob=90b77fed.efb24bb6.8312.8e:09:7f:84:65:a1 <=====
from obj=20b6c0e8.270e4354.91f5.02:5c:6f:ed:41:54
to vob=60efb222.0e034a34.aa4b.80:65:c3:9c:d4:ca <=====
to obj=eb7ec24a.510e4e03.8403.0b:e8:dd:3d:5c:db
Your element is linked to two vobs:
The actual Vob (which contains files)
The PVob (which is an 'ucmvob', ie a pvob)
You can list all your vobs, asking for their oid:
ct descr -fmt "%On %[plevels]p" vob:\avob
You can check if its oid matches one of the hyperlinks of your element.
Note: I use %[plevels]p because it is only valid on a pvob!
Related
I have created a symbolic link (see below) to a version controlled file from a different vob (VOB_II) and the file is visible from a dynamic view whereas it’s not visible from the UCM snapshot view.
A.txt --> ..\..\..\VOB_II\SampleDir\A.txt
I have the following selection and load rules.
element \VOB_II\SampleDir\A.txt ...\branch1\LATEST
load \VOB_II\ SampleDir
Any ideas why the file is not getting loaded in the snapshot view? I could not figure out what’s wrong. Any help or inputs are much appreciated.
First, do a cleartool ls in C:\path\to\my\view\VOB_II\SampleDir
The status can explain why the element is not loaded.
Typically, you need selections rules that selects also the parent folders (SampleDir and Vob_II) before being able to select A.txt.
I would recommend at least adding an element * /main/LATEST (stop rule)
element \VOB_II\SampleDir\A.txt ...\branch1\LATEST
element * /main/LATEST
load \VOB_II\ SampleDir
Second, it looks like you are trying to load the actual A.txt (the one in VOB_II\SampleDir\A.txt), and not the symbolic link one the A.txt pointing to ..\..\..\VOB_II\SampleDir\A.txt
I don't know where is that symbolic link A.txt. In Vob_I?
Third, see "Symbolic links in snapshot views"
Snapshot views created from Linux or the UNIX system maintain standard symbolic link behavior.
In the context of loading a snapshot view, links are treated as:
VOB links (those that point to objects inside the VOB) and
non-VOB links (those that point outside the VOB).
Hard VOB links are followed; symbolic links are copy-created.
If a VOB link cannot be resolved, an error results.
Non-VOB links are resolved, if possible, but it is not an error if they cannot be resolved.
Snapshot views created from a Rational ClearCase host running Windows software do not support links.
VOB symbolic link behavior is approximated in the following ways:
If a load rule selects a symbolic link, the link target is copied into the view at the link path.
I have a file in lost+found which is checkedout but I do not see any viewreference. How can i remove the file?
I'm Checking in windows system. When I do a version tree, I see a view that was created in some unix system. I'm not able to get the uuid of the same.
How can I delete such file?
For the checked out state, You should be able to get the view uuid in the same way as in the previous question "How do I delete check-outs from a particular view in clearcase?".
That lost+found folder is part of a vob and a cleartool describe -b vob:\Avob should list the uuid of the unix view.
But if you are not sure which uuid matches the actual name of the old view you see in the version tree, you can check for that name directly in the registry server.
There are different option:
cleartool rgy_check -views
But also, since I have access to the registry server, I can do a simple grep of the name in the var/rgy folder where view_tag is:
<user>#<server> /path/to/ClearCase/var/rgy
$ grep -i <view_name> view_*
view_object:-entry=view_object;-hostname=server;-local_path=path/to/<view_name>.vws;-owner=<name>;-view_uuid=e670fe8a.fb0540e5.83f4.7f:82:a6:s8:e1:1a;-attributes=sumview;
view_tag:-entry=view_tag;-tag=<view_name>;-title=<title_View>;-hostname=server;-global_path=\\server\views\path\to\<view_name>.vws;-region=<region>;-view_uuid=e670fe8a.fb0540e5.83f4.7f:82:a6:s8:e1:1a;
That way, from then name, you get back the uuid and can remove the checked out state from the vob.
Regarding the file itself (in lost+found), see technote "About the lost+found directory", that I mentioned in "How do I retrieve a file if I undid a folder checkout in ClearCase?".
There are two possible ways to remove an object from the root of the lost+found:
The object can be moved to a new location in the VOB using the cleartool mv command
The object can be permanently deleted from the VOB.
Be careful with the second option (which involves rmelem), especially in UCM (where that object could have in previous versions baseline labels attached to them)
I need to get a list of user names for every version listed in the version tree of an element, and then repeat for every element in the directory.
So far, I have come up with the following:
> cd M:\path\to\folder
> cleartool find . -version "created_since(01-January-1979.00:00:00)" -exec "cleartool describe -fmt ""%Lu\t%Fu\t%n\n"" %CLEARCASE_XPN%"
I chose a really old date thinking our VOB is younger than that date.
This gives me the same information for every version of an element because it's looking at the element owner, not the individual that contributed a specific version.
I'm using the following pages for reference:
http://www.ipnom.com/ClearCase-Commands/describe.html
http://www.ipnom.com/ClearCase-Commands/fmt_ccase.html
http://www.ipnom.com/ClearCase-Commands/find.html
http://www.ipnom.com/ClearCase-Commands/query_language.html
This might be a simple case of RTFM. Any help is appreciated.
You need to check if %n (used in the -fmt_case directive) returns the element name of the version name:
if it is the element name (without any extended path information, as in ##/main/.../x), then it would be normal for the cleartool describe to return always the same information.
if it is the extended path, as I would expect with %CLEARCASE_XPN%, then %u should be the user associated with the event (the version), and not the "element owner)
%u
Login name of the user associated with the event.
Small note, I always prefer using double-quotes around %CLEARCASE_XPN%, in case the path filename has a space in it.
-exec "cleartool describe -fmt ""%Lu\t%Fu\t%n\n"" \"%CLEARCASE_XPN%\""
Upon closer inspection, it looks like the command I posted above is sufficient. I saw a bunch of user names that were the same and thought they were all the same, but that's not true. I'm seeing different user names for different versions of the same element as I originally wanted.
If you work on a multisited VOB, do not forget that the owner of an object created on another site will be the VOB owner on your site. Therefore, if an object was created and modified only in a remote site, all of its tree and version would be owned by the VOB owner.
Of course, I assume you are in non preserving mode for identities for your replica synchronization (see the Changing preservation mode for mode infos). In most cases, you would not want replication to preserve identities, because each site has its own set of users.
When I execute a "cleartool ls filename##specificVersion", I see
filename [not loaded]
What does this mean?
For background information, I was trying to also execute a cleartool mkbranch, and was a "Element not found" error. So, for a sanity check, I tried a cleartool ls.
"not loaded" means the file:
is selected (by the selection rules element * ...) but:
not loaded by the load rules (load /xx/yy...)
You can see both sets of rules by doing a cleartool catcs anywhere within your view (or cleartool edcs to edit said rules)
This is typical of a snapshot view, which is the only one having "load rules" (as opposed to a dynamic view)
See:
"Before accessing files not loaded into snapshot views":
A snapshot view contains only the set of elements that you specify in the load rules of your view. (In UCM, by default, your view loads all of your project source files.)
When you restrict the scope of a view, it contains only a subset of elements in the VOB. During the course of a development cycle, you may need to see a version of an element that is not loaded into your snapshot view.
You can view nonloaded files or copy them into your view for build purposes, but you cannot check them out. Only file elements that are loaded into your view can be checked out.
"To copy a nonloaded element into a snapshot view"
cleartool get -to filename path
cleartool get -to prog.c.previous.version prog.c##/main/v3.1_fix/10
In Clearcase I have a VOB with a path like this:
\Department\ProductGroup\Product1\Development
I have a view with a Config Spec like this:
element * CHECKEDOUT
element * .../mybranch/LATEST
element * /main/LATEST -mkbranch mybranch
load \Department\ProductGroup\Product1
All the source code for Product1 is in the Development directory. Nothing I care about exists outside this directory. All references in the code are relative to this directory.
I have created the above Clearcase view in the directory c:\dev
Presently the above setup creates a directory:
c:\dev\Department\ProductGroup\Product1\Development
All the parent directories to Development are empty. I'd rather have just the following directories.
c:\dev\Product1
Where c:\dev\Product1 mapped to the VOB path \Department\ProductGroup\Product1\Development. Is this possible?
1/ Why not only load \Department\ProductGroup\Product1\Development ?
load /Department/ProductGroup/Product1/Development
Note: you can use '/', easier than '\' and Windows config spec does interpret it correctly.
1bis/ If you want to keep a general rule, you could use some "cleaning rules"
Consider this config spec
(test it in a dynamic view first, to check quickly -- that is without endless update reloading steps -- if the result does match what you need: files under Development and no files anywhere else)
element * CHECKEDOUT
# read/write selection rule for the directory and sub-directory
# where you need to work
element /Department/ProductGroup/Development/... .../mybranch/LATEST
element /Department/ProductGroup/Development/... /main/LATEST -mkbranch mybranch
# specific selection rule for the parent directories of Development
# those rules do not contain a mkbranch directive
element /Department/ProductGroup .../mybranch/LATEST
element /Department/ProductGroup /main/LATEST
element /Department .../mybranch/LATEST
element /Department /main/LATEST
# cleaning rule right there: anything outside /Department/ProductGroup/Development
# will not be selected, hence not loaded
element /Department/* -none
load \Department
That way, you always keep the same load rule load \Department, and your selection rules do the cleaning for you.
2/ Regarding your path issue, you can use Symlink but the easiest way is to use a subst
subst X: c:\dev\Department\ProductGroup\Product1\Development
And you could go on using your snapshot view within X:\
BUT that would not work because ClearCase needs:
view.dat (the hidden file indicating a directory tree is in fact a snapshot view)
a vob (which is Department in your case. ProductGroup\Product1\Development is a path within the Vob Department)
X:>ct lsview -l -full -pro -cview
cleartool: Error: Cannot get view info for current view: not a ClearCase object.
X:>ct ls
cleartool: Error: Pathname is not within a VOB: "."
For those same reasons, a hardlink with Junction on windows will not work:
c:\dev>junction Product1 Department\ProductGroup\Product1
Junction v1.05 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2007 Mark Russinovich
Systems Internals - http://www.sysinternals.com
Created: C:\dev\Product1
Targetted at: C:\dev\Department\ProductGroup\Product1
C:\cc\xxx>ct ls
cleartool: Error: Pathname is not within a VOB: "."
So what you can do is:
subst X: c:\dev
That combined with the specific load rules from 1/ or the cleaning rules from 1bis/ will give you:
a slightly shorter path
no extra empty sub-directories
2bis/ "Devious" solution:
From the ClearCase explorer, move Development from Department\ProductGroup\Product1 to Department! That move will be recording within 'mybranch' version tree, and will not be visible for anyone else working in /main/LATEST.
Then with the subst from above, you will work within 'mybranch' in Department\Development.
X:\Department\Development
When you want to go public, make the inverse move.