How to list the ClearCase versions including the author of each change ?
I tried lsvtree -all which doesn't give me this information.
Check the different options available with fmt_ccase, include "%n %u": %u is for user.
The doc mentions:
Note: In commands that output data on multiple versions, such as lshistory and lsvtree, formatting is applied to each version, not to the command output as a whole.
However, since lsvtree doesn't support fmt, you can fallback to lshistory:
cleartool lshistory -fmt "%n %u\n" afile
Related
I have a file
"N:\E123_view\ABC\XYZ\data.doc"
I want to get all the versions of the file and all the labels tagged to it.
One approach, in command line, is to use a version tree: cleartool lsvtree.
cd N:\E123_view\ABC\XYZ
cleartool lsvtree -all data.doc > afile.txt
lists all versions on a branch, not the selected versions only; annotates each version with all of its version labels.
Another approach is to use lshistory combined with fmt_ccase
cleartool lshistory -fmt "%n %l\n" data.doc
%n will print the version, as in /main/rel2_bugfix/1
%l will print the label (if present).
I have read this and run the below command :
cleartool lsact -r -in stream:aStream#\aPVob -fmt "%n %c"
After running this I got :
SOLNSxxxx Created automatically as a result of 'Work on' action in ClearQuest
I didn't get this as I am expecting the comment message against every activity and files checked-in in activity with commit message.
And will this change anything in clearquest too ?
Please let me know.
as I am expecting the comment message against every activity and files checked-in in activity with commit message.
No, that would return the name and comment of the activity only, not of its change set versions.
See "How to find files associated with a ClearCase UCM activity?": for each version return, you would need to apply a cleartool descr -fmt "%n %c"
Try (not tested)
cleartool describe -fmt "%[versions]CQp" activity-title#\aPVob |\
xargs cleartool descr -fmt "%n %c"
If the first describe list all versions on one line, use:
cleartool describe -fmt "%versionsCp\n" activity:<your activity>#<your pVOB> | perl -pe 's/\,\s?/\n/g'
# or
cleartool describe -fmt "%[versions]CQp\n" activity:<your activity>#<your pVOB> | perl -pe 's/\,\s?/\n/g'
I am often getting a request like this. " Find the list of files changed from particular day".
I got answer to this as example given below
"cleartool find <Vobtag> -version "{brtype(IntegrationStream) && created_since(13-Jan.8:30)}" -print"
But few people are asking "Find the list of files changed and by whom". So that they can pin down the developer name and assign him the task to resolve issues.
Is it possible to pipeline the above command and find the user who made that version also?
You should be able to add to your find query a created_by member.
See the query language man page.
created_by (login-name)
In all cases, TRUE if the object was created by the user login-name (as shown by the describe command).
So your query would look like:
cleartool find <Vobtag> -version "{brtype(IntegrationStream) && created_since(13-Jan.8:30) && created_by(aUser)}" -print
The OP comments:
The command you have given will find the list of files created by particular person.
But I would like to find all the files created_since and also by whom it was created
True, for that you need to add a format parameter to your query, following the fmt_ccase man page.
Since cleartool find has no -fmt parameter, what you do is to pipe the result of the find query to a cleartool describe command (which can use a -fmt directive).
cleartool find <Vobtag> -version "{brtype(IntegrationStream) && created_since(13-Jan.8:30)}" -exec "cleartool describe -fmt \"%Xn : %u\n\" \"%CLEARCASE_XPN%\"
The second part of the command is:
-exec "cleartool describe -fmt \"%Xn : %u\n\" \"%CLEARCASE_XPN%\"
The important parameters are:
%u
User/group information associated with the object's creation event (modifiers: F, G, L); see also %[owner]p and %[group]p.
\"%CLEARCASE_XPN%\"
It represents the extended pathname of a version found by the find query.
Is there a clearcase command to show me say all the files and the respective committers/activities that have changed in the last X hours/days? Something similar to svn/git/hg log?
Not directly, because ClearCase is file-centric, not repository centric.
So you can make your query for a component or a Stream (list of components+baselines).
For instance, to list all activities for a given stream, you can type (using the fmt option of lsact):
cleartool lsact -fmt "%n %d" -in aStream#\aPVob -user auser
But then, you need to filter on the date to get only the activities you want, and you can the describe each activities in order to get their changeset.
For the files, you can use a find query similar to "Find files in Clearcase view newer than a specific date?":
cleartool find <vobtag> -element "{created_since(target-data-time)}" -print
cleartool find <vobtag> -element "{created_since(target-data-time)}" -exec "cleartool desc -fmt \"%n %u %[activity]p\" \"%CLEARCASE_XPN%\""
Using -fmt options, you can display the user for that version, and the activity whose change set contains the specified version.
newbie for clearcase.
Since clearcase's config is rather different from other concept in git, I may mean logs for
any files with specified version/branch path.
Like I want to show log for all element match:
element * .../specified-lable-or-branch/
First you need to be aware of the differences between ClearCase and Git, ClearCase being file-centric (no notion of repository-wide revision or commit)
You can display logs for any visible file by typing:
cleartool lshistory /myView/myVob/path/to/myFile
See lshistory man page. (and also How do I understand about ClearCase event records in the VOB database)
The lshistory command lists event records in reverse chronological order, describing operations that have affected a VOB's data.
File system data history.
Lists events concerning elements, branches, versions, and VOB links.
This includes records for creation and deletion of objects, and records for attaching and removal of annotations: version labels, attributes, and hyperlinks.
Another kind of logs is the lsvtree (history of versions):
The lsvtree command lists part or all of the version tree of one or more elements.
By default, the listing includes all branches of an element's version tree except for obsolete branches.
alt text http://youtrack.jetbrains.net/_persistent/tree.PNG?file=74-3724&v=1&c=true
The OP adds:
How can I display all history for elements match a pattern like has new version under a branch?
You can combine almost any commands with a find query.
Windows syntax:
cleartool find . -name "apattern" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
cleartool find . -version "{created_since(target-data-time)}" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
Unix syntax:
cleartool find . -name "apattern" -exec 'cleartool lshistory "$CLEARCASE_PN"'
cleartool find . -version "{created_since(target-data-time)}" -exec 'cleartool lshistory "$CLEARCASE_PN"'
For the " like has new version under a branch?" specifically:
cleartool find . -version "brtype(mybranch)" -exec ...
should do it (any element which has no version created for that branch will not be listed).