While rebasing the development stream in clear case, there are some times where a file needs to be merged because the local version is out of sync with one in the recommended baseline.
Now intuitively, I was thinking that merge tool will offer two options :file 1(local) and file 2:(in recommended baseline).
But in reality, I am being asked to choose from 3 files. What are these 3 files?
The 3 files are:
common ancestor (or "base contributor")
source (or "source contributor")
destination
This is a three-way merge. See "What are the basic clearcase concepts every developer should know?"
(and the fourth screen is the end result)
See also "How files and directories are merged"
Related
I want to find out which types of files are associated with Microsoft Word on my System. All these file types should be handled in a special way by my application. How do i get a list of all files types that are associated with an application like Ms-Word? I know there is a dialog to set the default programs. But there is no entry for Ms-Word and i need a mapping in the other direction. I am not sure if this is a programming question at all. This is what I need:
Ms-Word:
.docx
.doc
.odt
That takes a slog through the registry that's not guaranteed to be unambiguous. Startup Regedit.exe to follow along, open the HKCR hive and look at the registry keys whose name starts with . Quickest way to find relevant ones is by using Edit > Find and type "word".
First one you are likely to find is .doc. Note the default value of the key, that's the ProgId. It is "Word.Document.8" on my machine, I have Office 2013 installed.
The ProgIds are registry keys themselves. Navigate to HKCR\Word.Document.8 to see what it looks like. Expand the node to see the sub-keys, the one that matters is CLSID. It is "{00020906-0000-0000-C000-000000000046}". That has been the guid for Word for the past 20 years. Whether it will be for the next 20 years is anybody's guess.
You can continue to search but the fidelity start to drop off. The CLSID is a registry key itself, you can find it back in HKLM\SOFTWARE\Wow6432Node\Classes\CLSID. The LocalServer32 subkey's default value contains the path to the executable. "C:\PROGRA~2\MIF5BA~1\Office15\WINWORD.EXE" on my machine. A short name in MS-Dos 8.3 format, yours is pretty likely to read differently.
So, for now, I'd recommend to go from HKCR\.ext => HKCR\ProgId\CLSID and compare with the anointed guid. It is likely to work for a while, not forever. Hard-coding the extensions isn't terribly wrong either. Do note the ambiguity you'll discover when you search, filename extensions like .htm, .pdf, .xml can be opened with Word as well but is not the default association. And some are not documents, like .wll
Thanks i did find another workaround. At my german version of windows i search for "Dateityp" or "file association" and selected "Dateityp immer mit einem bestimmten Programm oeffnen" or "Make a file type always open in a specific program". The dialog shows the file types mapped to programs. Then i just collected the types that are mapped to Ms-Word.
I want to get list of files and directories affected by specific commit. I have no problem getting the commit itself but I rather don't know how to get affected files and directories.
Just to make it clear I need something like this:
file x - deleted
file y - added
file z - modified
Git is snapshot-based; each commit includes a full list of files and their state. Any notion of "affected" files needs another commit to compare it to. This is commonly done against its parents, which seems to be what you're asking about. You can figure out which files are different between two commits (or more exactly, their trees) by using the git_diff family of functions.
You can find an example of doing so in the examples listing for libgit2. There is also a more general annotated diff example. The second link also shows how to list individual files as well as their contents, if you need that. Check the reference for a a full listing of available function to work with diffs.
Note that this won't give you affected directorires by itself, as Git does not track directories, but only files.
You're looking for git diff.
The same function exists in libgit2, and the documentation for it is here.
If you're analyzing older commits, "git diff [commit1] [commitAfterCommit1]" will give you a list of changes that the second commit made from the first. You could prune this output to get yourself just the changed file names.
I have checked in the same file (filename) twice in 2 different branches (say, development and release).
This breaks just about anything, so I want to take 1 version and "properly" copy/merge it to the other branch, later merging in the lost changes manually (from a backup). Then I would lose history for 1 file but at least the 2 files would be connected again.
How to do it?
Also note, since the connection is broken, I cannot mere, also, when doing a Version Tree, both files have different version trees. (It is not 2 views at different files in 1 Version Tree, like is the normal/correct case.)
Also, I assume the problem is with the folder having some kind of a reference to 2 different files, but somehow, I cannot edit the folder?!
Those are call "evil twins" (also described in that SO question)
(one less thing to worry with Git ;) )
The easiest way is to pick one branch:
remove the file from the other branch (rmname),
and to the merge.
The merge will add that same file in the other branch.
That process (rmname + merge) is illustrated in "Clearcase: How do I merge in a specific file from one view, into another, to avoid the Evil Twin scenario?"
(edit by Andreas)
Your solution worked great, I changed it for me since I noticed I have a specific case:
The file got bad since someone else renamed it... so it was not just as simple as your solution, but I had to do it "by hand", as is
Go to X:\FullyQualifiedPath (correct path in VOB)
Use:
cleartool ln FullyQualifiedName ./FileName
where FullyQualifiedName is the name as you get it e. g. from VersionTree when you say “Send To -> Copy” (something like //view, drop the file: before). This creates the link
Afterwards, you can see the desired version in the ClearCase Explorer again.
In Clearcase, I want to copy (fork, split) a file while preserving its history. Something like svn cp old.txt new.txt. How do I do it?
It isn't possible do fork a file in ClearCase.
If you refactor your code and split a file in two, one of them will appear as a new file and you will loose the information about who coded it. The annotate command will say the author of the lines are who splited it.
UCM or not, you cannot duplicate easily the full history of a file.
The best way to isolate an history is still to create a branch in order to make new versions to that file without impacting the same file in the original branch.
Thinking 'svn cp' should be available in ClearCase might come from the fact that, in SVN, branches are directories, and a tool like cc2svn will actually replicate ClearCase branches using 'svn cp'.
But since, with ClearCase, branches are first-class citizen, it is best to reason in term of branch than in term of copy/fork.
From the main page of cc2svn:
There is a difference in creating the branches in ClearCase and SVN:
SVN copies all files from parent branch to the target like: svn cp branches/main branches/dev_branch
ClearCase creates the actual branch for file upon checkout operation only.
Pretty simply done
Check out parent folder
Move element you wish to duplicate to appropriate location (not within the checked out parent folder)
Undo Checkout of parent folder
All the files get returned to the original folder with history and also the duplicate ones remain in the new location with the history too. Now each file can be checked out and changed individually
Could anyone explain what is a Evil Twin and Subtractive merge in Clearcase?
Evil Twin
An Evil Twin is an element that you have removed (using rmname) and want to re-add, but it's 'evil twin' exists in previous versions of the directory.
You have to remember that each element had a unique ID, so you are attempting to add an element with the same name - but with a different UID. This is not allowed.
The best way to deal with an Evil Twin is to relink the newest version you can find of the existing element to the new version of the directory. You can then make a new version of the element and replace the data within it.
Subtractive Merge
A subtractive merge is the opposite of a selective merge.
A selective merge (the default, bog standard merge) adds the changes from another element version into your checked-out version.
A subtractive merge attempts to remove the changes made in a different version from the version you have checked out - because it's a bad version, you've made mistakes in it etc.
IBM has a nice article on substractive merge.
A subtractive merge can be performed to exclude or bypass bad versions on a branch without actually removing the bad versions.
Cleartool merge using the -delete option will allow a user to merge from the last known good version to a new version on the same branch which excludes the work done in the versions identified as bad versions.
This merge must be performed from the command line, it does not create a merge arrow, the arrow can be created manually.
This will work for file as well as directory
But you need to realize that merge is about a file or a directory, not about a directory "and everything in it".
To merge recursively, take a look at findmerge.
You can want to merge only directories (since they are always merged first, to determine the actual list of files to merge!), as in this IBM article
% cleartool setview major_vu% cleartool findmerge /vobs/vob1 /vobs/libvob2 –type d \
–fversion /main/LATEST –merge
you may also do the merge from the LATEST version of a branch or from a tag:
findmerge . –fversion /main/rel2_bugfix/LATEST –print
findmerge . –ftag rel2_bugfix_view –whynot –print
Note: the -print is always a good idea before replacing it by '-merge -gmerge', in order to get a preview of what will be merged. But if directories are involved, it will only print that 'directory X' needs to be merged, not the exact list of files.
For evil twins, check out the IBM article. Case sensitive issues can be a real pain to deal with and create some evil twins without you realizing it...