Merging older versions of a file within Clearcase - clearcase

I have a file which has been checked out in a dynamic view and modified a certain time ago without being checked in, I'll call this version i. In the mean time the development branch has moved on and several newer versions (j, k and then l) of the same file have been checked in from other views. I need to merge the modifications of version i and l. I can't simply check version i in because that generates a "predecessor is not latest" error.
Is there a safe (and simple) way of doing that?

One safest way is to:
checkout l, and then
use a third-party merge tool (kdiff3 for instance) to merge i (source) with l (destination, checked out).
Then check in a new merged version m.
Finally, you can undo checkout i in the first dynamic view, allowing that version to update itself automatically (dynamically) to the latest version 'm' (result of the merge)

Related

How to merge changes from a specific UCM activity from one ClearCase stream to another

This should in theory be quite simple, i.e. merge the changes from a specific UCM activity from one stream to another.
I had thought that I might just be able to use the Deliver command in the GUI and then select just the required activity to deliver, but it seems that the target stream is set to not allow deliveries from other streams.
From searching the documentation it seems that I might instead be able to do this via the command line using the findmerge tool, but it's not at all clear from the rather sparse documentation how you do this. It seems like it might be a two stage process, i.e. first generate a "changeset", then merge that changeset ? Also I'd like to do the merge manually for each affected file, so I would need the graphical merge tool to be invoked if possible.
If someone can give me an example findmerge + whatever command line for merging an activity that would be a great start. Also any other suggestions for how to merge an activity would be welcome.
First, deliver in UCM are (usually) made to deliver all activities.
You can try to deliver only a subset, but you quickly comes to gripe with "timeline", which are linked artificially all the activities together, forcing you at the next deliver to deliver them (all).
findmerge tool, but it's not at all clear from the rather sparse documentation how you do this. It seems like it might be a two stage process, i.e. first generate a "changeset" then merge that changeset ?
cleartool findmerge activity: is the non-UCM way to merge all versions referenced by an activity from a stream (a branch actually here) to another branch.
ct findmerge activity:A1#\pvob activity:A3#\pvob -fcsets -c "report for delivery" -merge -gmerge
See "ClearCase : Making new baseline with old baseline activities" for more on timeline (activity dependencies) and findmerge.
This is documented in the technote swg21267316:
WORKAROUND:
From the target view:
Set to an activity (setact) or create a new activity (mkact). This activity is just like the Integration activity normally used/created during a deliver. It allows you to:
check the files in after the merge.
Run a findmerge using the following format:
cleartool findmerge activity-selector ... -fcsets [-gmerge | -merge]
Merge files as needed
Checkin files that were merged
Example:
M:\int\cvob1>cleartool findmerge activity:A#\pvob -fcsets -gmerge
Needs Merge "M:\int\cvob1\old folder\new name" [to \main\int\7 from \main\int\de
v\2 base \main\int\dev\1]
Checkout comments for this and any additional elements:
deliver dependencies work around
.
Checked out "M:\int\cvob1\old folder\new name" from version "\main\int\7".
Attached activities:
activity:int-merge#\pvob "int-merge"

ClearCase UCM - How to get only latest versions from latest baseline

How to get only latest versions from latest baseline -
For example, First time in ClearCase, developers check in for the first time, we would have a.zip, b.zip ; ClearCase does the incremental baseline baseline_1. Then the build tool comes in, does it gets artifact..and deploy it - everything looks good.
Second time in ClearCase, they check in c.zip and d.zip ; ClearCase does an incremental baseline again baseline_2... now how can I get the ClearCase snapshot view to only present the new files (c.zip and d.zip) so the buil tool can only get the latest files (or last baseline)
This will go on and on and on.. so baseline will change each time.. so would the file.... and the date will not work since we don;t know the schedule or cycle. The files name can also change from *.zip to whatever...
A baseline references all the files of a component, even if it is incremental.
Using an incremental baseline in a non-UCM snapshot view wouldn't work, because it applies a label only on the elements which are changing (which means the parent directories might not have that label, because they haven't changed, which results in a config spec incapable of selecting the changed files, since said parent directory isn't even selected).
If you are after a view able to show all the latest files, what you can do is:
a sub-stream ST to stream S which produce those baselines
a rebase of ST with the latest baseline from S:
cleartool lsbl -fmt "%[latest_bls]p" -component C -stream S
a diffbl with the previous baseline, in order to get all the new versions
But you also can:
list only the changed/new files:
cleartool diffbl -pred -ver latestBl#\aPVob
access those files through a dynamic view with the extended pathnames returned by the diffbl -pred -ver command.
That would allow to list/access only the new/changed versions between 'latestBl' and its previous baseline (with latestBl obtained from the lsbl command shown above).

Activity becomes undeliverable as folder in it was delivered. What could be the remedy?

We are having 2 development stream and an integration stream in our project.
Following are the streams
ProjName-Int-Stream
Bangalore-Dev-Team
Madurai-Dev-Team
Bangalore-Dev-Team member deleted a folder and created a new folder with the same name(Uncataloged the folder and created the same). Then he added more files into it and delivered it to integration stream.
Madurai team member was working in the same folder and unaware that Bangalore member deleted it. Now his activity is not listed while he is about to deliver his changes.
Has any one faced this scenario? If so what did you do as remedy action and how did you prevent it from happening ?
Yes, those are called evil twins (see an example here: two elements -- here a directory -- created, that is "add to source control" twice, meaning they have different oid.
If the history of that directory isn't too important, the easiest way to go forward is for Madurai team to:
rebase first
accept the version of directory from Bangalore during the rebase (his own file will disappear)
redo its works on the files as newly created by Bangalore
deliver
The other (cleaner) option would be for Bengalore to:
restore removed directory "D" with its original content. The way you do that is by:
display the version tree of the parent directory of "D"
look for the previous version in that version tree which still referenced "D" in it (do some "compare with another version" between the current latest version of that parent directory and a previous version in the version tree)
right-click on that previous version (the one which stil references "D" and select "merge to", click to the current version (it will ask you to check out it)
select a graphical merge, and then, in the merge window, select the right version of the "D" (ie the one coming from the older version instead of the one re-created)
check-in the parent directory
If Bangalore did his modifications in a single activity, he could also reverse that activity, which is simpler to do.
- do the modifications in the (now present again) directory "D"
- deliver again
- then Madurai rebases, and delivers too

SQL Server merge statement source and target issue

I am using SQL Server 2008 Enterprise and using the new Merge statement. From my experiment, I find source is always read only (table content not modified, i.e. no record is deleted/inserted/updated)? Is that correct understanding?
thanks in advance,
George
Yes you're understanding is correct. You have a source and a target, and you check for each row in the source whether or not it exists in the target.
What gets updated is always the target - depending on your setup, you can insert new row, update or delete existing ones - whichever you choose.
But the source never gets touched - only read. That is the case, and it's by design (and it's a good thing, IMHO).

How to order project solution content in SQL Server Management Studio

In SQL Server Management Studio (SSMS) running against SQL Server 2005, I have a solution which contains a number of views.
These views are not sorted alphabetically.
Can anyone provide either an explanation of why, or a solution to order them alphabetically ?
I just came across this forum post. It doesn't get any simpler.
Just edit the ssmssqlproj file.
The file for my project (SQL Main) is
located in "My Documents\SQL Server
Management Studio\Projects\SQL
Main\SQL Main\SQL Main.ssmssqlproj".
Its just an xml file. Change the
following line
<LogicalFolder Name="Queries" Type="0" Sorted="true">
to
<LogicalFolder Name="Queries" Type="0" Sorted="false">
It will revert back to true so you
need to repeat this if you make
changes. THere is probably a better
way Smile
There is a tool that you can install to sort the contents of a SQL Server Solution project.
See the following reference.
http://web.archive.org/web/20121019155526/http://www.sqldbatips.com/showarticle.asp?ID=78
Please ensure you save your work, before attempting a sort.
When you add new item to the project they are added to the end of the list. They are kept in the order that they were added to the project because this order is preserved in the corresponding *.ssmssqlproj file. To change this order, close the project/solution, then locate the *.ssmssqlproj file and edit it with Notepad or your favorite XML editor (always make a backup first!). Reorder the FileNode elements along with their children to reorder the items appearance in the Solution Explorer.
Here's the solution I took. Up votes for the recommendation of the source code, however I don't have .NET installed here, so I had to go for a manual approach.
finish working on any project or solution files you have checked out, and check these edits in.
get latest version on everything in the solution.
Check everything out
Backup the whole folder structure
open the .ssmssqlproj file in notepad
maximise notepad full screen and turn word-wrapping off
edit the .ssmssqlproj file, reordering the XML nodes in the required order
save the .ssmssqlproj file
check everything back in.
That seems to have fixed my issue.
The stored procedure listed in the following post can do it as well:
http://beyondrelational.com/blogs/jacob/archive/2009/08/22/xquery-lab-48-sorting-query-files-in-sql-server-management-studio-ssms-solution-project.aspx
Please note that the sorting is case-sensitive.
So "B..sql" will come before "a...sql".
Remember to start all your scripts with the same casing (be it lower or upper).
Another easier (I think) way to edit the ssmssqlprog is to do so with MS XML Notepad 2007. With that I could drag the nodes around to order them. Make a copy of course. 2007 appears to be the latest version and is available at ...
http://www.microsoft.com/en-us/download/details.aspx?id=7973
Another way to handle this is to start with a new query from Management Studio (not by selecting 'New Query' in the solution).
Save the query file into the solution folder with a good name.
Then 'Add Existing Item' into the solution.
It adds with your chosen name, sorted correctly instead of creating the file initially as 'SQLQuery1'.
Maybe not much better, but another option to editing the project file and reopening.
Building on the previous answer, you can add it as a new query in the solution, and when you are done, just remove it from the solution and then Add existing item to the solution, and select your new query. Doing it this way adds the new query to the correct solution folder for you before you remove and add back in.
And yet another way... while one of these ways worked for me several times... sometimes it becomes stubborn. Find the location where it is broken. Take a screenshot of the file names.
Select all the file names you need to remove before the glitch.
in other works, if it sorts a - f and then sorts b - z
Remove all the a-f (don't delete them) that occur before the b-z, then save the project.
Now add them back in and save the project again. Presto.
So far this has worked very well for me and is fairly easy to do.

Resources