Cleartool findmerger command not working - clearcase

I was trying to copy my ClearCase view from one server to another server.
But the command for findmerge is not working and gives error.
Can anyone help me out on this ?
Here is the error message in full:
/home/xkuldub 23>cleartool findmerge `cleartool find -avobs -ele 'brtype(xkuldub_vse_4.0_integration_sds_GIC)' -print -nxname`
cleartool: Error: Cannot get view info for current view: not a ClearCase object.
cleartool: Error: Pathname required.
Usage: findmerge -graphical
findmerge {pname ... | [pname ...] -all | -avobs}
{-ftag view-tag |-fversion version-selector | -flatest}
[-depth | -nrecurse | -directory] [-follow] [-visible]
<general options>
findmerge activity-selector ... -fcsets
[-ftag view-tag |-fversion version-selector | -flatest]
<general options>
[-user login-name] [-group group-name] [-type {f|d|fd}]
[-name 'pattern'] [-element query]
[-nzero] [-nback] [-whynot] [-log log-pname]
[-c checkout-comment | -cfile pname | -cq | -cqe | -nc]
[-unreserved [-nmaster]] [-query | -abort | -qall | -qntrivial]
[-serial] [{-btag | -fbtag } view-tag]
{-print [-long | -short | -nxname]
| {-merge | -okmerge} -blank_ignore
| {-gmerge | -okgmerge}
| -exec command-invocation
| -ok command-invocation
| -co
} ...

It really depends on:
what is your ClearCase version (7? 8? 9?)
what is your client OS? Your ClearCase server OS?
how you moved your view to another server (for instance, did you follow "Moving a view to a host with the same architecture or to a NAS device" or "Moving a view to a host with a different architecture"?)
Your view needs to be properly registered in order for the cleartool command to recognize the current folder as part of a view.

The main reason this isn't working is that your current directory is not in a clearcase view. Findmerge needs a view context to resolve the merges that need to be done.
Start with the embedded find command to get it working, and then branch out.
You also need an action for findmerge to perform, like -merge, -gmerge, or -print.
Be aware that passing a large changeset this way could fail depending on the maximum allowed command line length. If this is a UCM environment, you could do this cross-stream merge either through deliver or findmerge {activity list} -fcsets.

Related

Display ASCII graph of Cleartool ls commands

In git it is possible to show an ASCII graph of the log with git log --graph which outputs a commandline graph something like:
* 040cc7c (HEAD, master) Mannual is NOT built by default
* a29ceb7 Removed offensive binary file that was compiled on my machine
| * 901c7dd (cvc3) cvc3 now configured before building
| * d9e8b5e More sane Yices SMT solver caller
| | * 5b98a10 (nullvars) All uninitialized variables get zero inits
| |/
| * 1cad874 CFLAGS for cvc3 to work succesfully
|/
* d642f88 Option -aliasstat, by default stats are suppressed
Is this also possible with ClearCase / ClearTool when using the lsstream or lsvtree commands, without the need to open a GUI?
Since I couldn't find anything that suited me, I created my own python script with this ability. It is still a little rough, but works for me.
For anyone interested, it is available here as a github gist
With command line, you have cleartool lsvtree.
If you want the history to focus on the branch you currently are (instead of starting by default at /main), you need to use the -bra/nch branch-pname option.
Starts the version tree listing at the specified branch.
You can also use an extended name as the pname argument (for example, foo.c##\main\bug405) to start the listing at a particular branch.
But if you need additional information like the author, then you would need to fallback to cleartool lshistory: see "How to ask cleartool lsvtree to show the author's name"

ClearCase UCM: Branch created of file that is not part of an activity. What happened?

I have somehow created a branch of a file in clearcase UCM that is not part of an activity. I have no idea how to reproduce this, but my stream is showing many files with this symptom. How can I find these files, remove them, and prevent it from happening again in the future?
Here is an example of one such file, names redacted to protect the innocent:
xxxxxxxxxxx.cpp##/main/xxx-integration/xxxxxx-xxxxxxxx/0 Rule: .../xxx-xxxxxxx/LATEST
A ct lsact -long | grep <filename> returns no results.
Update:
I used a find command to track down all the files that are on the branch given (and redacted) above, though I still do not understand the issue.
Per VonC's answer, where is what I ended up doing:
cleartool find . -type f -version "version(.../xxx/LATEST)&&version(.../xxx/0)" -print | tee ~/tmp/files2
I then read through the list of files generated to make sure they made sense, then I verified they were not attached to an activity and removed the versions:
cat ~/tmp/files2 | while read
do
if [ -z "$(ct describe -fmt "%[activity]p" $REPLY)" ]
then
ct rmbranch -f ${REPLY%/0}
fi
done
That can happen ig those file were checkout in a base ClearCase view, ie a non-UCM view, withg a simple config spec:
element * .../xxx-integration/LATEST -mkbranch xxxxxx-xxxxxxxx
You can use a find command similar to "How can I find all elements on a branch with version LATEST that has no label applied?".
The difference is: for each version found, you need to describe it in order to check if there is an activity attached to it or not (with a fmt_ccase):
cleartool describe -fmt "%[activity]p" "$CLEARCASE_XPN"

cleartool: how to write the result from command find to a text file

I am trying to find all the files under gt.BridgeGov branch in my view
find \gtGov -all -version "brtype(gt.BridgeGov)" -print
This statement works fine and list all the files under branch gt.BridgeGov. I am getting the list on console, but I want to redirect result to text file.
I tried the following
find \gtGov -all -version "brtype(gt.BridgeGov)" > myFile.txt
find \gtGov -all -version "brtype(gt.BridgeGov)" >> myFile.txt
Its throwing me an error cleartool: Error: Extra arguments: ">"
How can redirect the result to a text file?
-Update:
find \gtGov -all -version "brtype(gt.BridgeGov)" -print > myFile.txt
Tried this also
Complete Error When I try
find \gtGov -all -version "brtype(gt.BridgeGov)" | tee myFile.txt
cleartool: Error: Extra arguments: "|"
Usage: find { pname ... [-depth | -nrecurse | -directory]
| [pname ...] -all [-visible | -nvisible]
| -avobs [-visible | -nvisible]
}
[-name 'pattern']
[-cview]
[-user login-name]
[-group group-name]
[-type {f|d|l}...]
[-follow]
[-kind object-kind]
[-nxname]
[-element query]
[-branch query]
[-version query]
{-print | -exec command-invocation | -ok command-invocation} ...
You are in a cleartool session.
Don't.
Go to a dos or shell session, in your ClearCase view, and type
cleartool find ... > res.txt
You won't have any issue redirecting the result of a cleartool command that way .
Note that if you are executing that cleartool find command in a dynamic View root directory (M:\myDynView, or /view/myView, ...), you won(t have the right to write directly in said root directory.
However, you can redirect your output to any file you want:
cd /view/MyView
cleartool find -all ... > /my/path/res.txt

How to get the contributing activity details on integration stream?

I need help in knowing how to get the details of when a particular contributing activity is delivered to integration stream.
I used to use diffbl -activity baseline1 baseline2 in cleartool to get the list of activities made from one baseline to another baseline.
Now the new need is that i need to get the date time of when some of the activities listed as an output of diffbl are delivered.
I tried using lsact, describe but i am getting the "Activity not found" error.
Probably because the activity I am querying at is a contributing activity.
Could somebody know how to get the date time of when a contributing activity is delivered or how to customize the output of "diffbl -activity baseline1 baseline2" to get the activity date time details as well?.
When I look at the cleartool diffbl man page, I don't see any formatting option.
That means you need to parse the result of that command, feeding each activity to a cleartool describe -fmt, using one of the fmt_ccase option to display what you want.
This thread gives you an idea of the process to follow, but it is in bash (unix), to be adapted for windows if you need it:
for act in $(ct diffbl -act bl1#/vobs/apvob bl2#/vobs/apvob | grep ">>" | grep -v "deliver." | cut -f2 -d " "); do echo "Activity: $act"; cleartool desc -fmt "%d\n" activity:$act; echo; done
In multiple line for readibility:
for act in $(ct diffbl -act bl1#/vobs/apvob bl2#/vobs/apvob
| grep ">>"
| grep -v "deliver."
| cut -f2 -d " ");
do
echo "Activity: $act"; cleartool desc -fmt "%d\n" activity:$act; echo;
done
Note that by excluding "deliver." activities, we are focusing only on contributing activities, as explained in "How to find files asssociated with a ClearCase UCM activity?".
The OP Lax reports having successfully managed to extract the names of the activities, with a:
desc -fmt "%Nd\n" "activity:myActivityId"
(#\pvob being already part of the result of the diffbl command. Lax is just parsing the activityid from the diffbl results and putting it to desc command)
He adds:
I am needing this in the context of C#, so parsing is just like parsing any other string: I am using a regex to seperate the output to my interested activities. ex:
Regex.Matches(diffBlOutput, "myInterestedPattern");
And for each match in regex result, I get the activity with
RegexMatch.Groups["activity"].ToString()
activityid is actually a substring of this string as the result is always "activtyid activityName" so, substring(0,result.indexOf(' ')); gets me the activity id.

clearcase ucm baseline

Is there any way to get the composte baseline information from the current view in command line .
I am using the comand in my script. It's displaying the list of the commands which include composite and ovverride component baselines in my view .
cleartool lsstream -fmt "%[found_bls]NXp\n" -view $VIEW_NAME
I need only the composite baseline as output for my command.
Is there any command to findout the composite baseline in current view ? pls help .
I guess your composite baselines are rootless components, so you can check the components and display only rootless. You can use cleartool describe for that.
A composite baseline can list its immediate dependencies, so as described in this script, you can attempt to list those for each baselines.
the one that does return an output (without error) is your composite baseline.
cleartool describe -fmt "%[depends_on]Np\n" {baseline selector}
However, building on my previous answer about "search the output line and save in variable", what you can do is describe each baseline, asking for its dependencies, and grepping for the line which contains an arobase '#':
Only composite baselines will return fully qualified baseline names, with arobase in it, as opposed to a non-composite baseline, which will return... nothing)
cleartool lsstream -fmt "%[found_bls]CXp" -view $VIEW_NAME | tr -s " " "\012" | xargs cleartool descr -fmt "%n %[depends_on]Cp" | grep "#" | sed -e "s/ .*//"
For more visibility:
cleartool lsstream -fmt "%[found_bls]CXp" -view $VIEW_NAME \
| tr -s " " "\012"
| xargs cleartool descr -fmt "%n %[depends_on]Cp"
| grep "#" | sed -e "s/ .*//"

Resources