Bug 126616 IStorageMerger is not called in three-way merge with no common ancestor
I20060131-1200 IMergeContext.merge(IDiff[], boolean, IProgressMonitor) does not attempt to automerge two revisions if no common ancestor is available. Depending on the file content, no common ancestor is needed for automerging (e.g refactoring history files, where merging is simple the union operation). I suggest to call the corresponding IStorageMerger with an empty stream in this case, or have a predicate which tells whether the merger supports three-way merging with no common ancestor.
org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/model/RefactoringIndexMerger.java
*/
	private void performMerge(final OutputStream output, final String encoding, final InputStream target, final InputStream source) throws IOException, UnsupportedEncodingException {
		final RefactoringDescriptorProxy[] sourceProxies= RefactoringHistoryManager.readRefactoringDescriptorProxies(source, null, 0, Long.MAX_VALUE, RefactoringDescriptor.NONE);
		final RefactoringDescriptorProxy[] targetProxies= RefactoringHistoryManager.readRefactoringDescriptorProxies(target, null, 0, Long.MAX_VALUE, RefactoringDescriptor.NONE);
		final Set set= new HashSet();
		for (int index= 0; index < sourceProxies.length; index++)
			set.add(sourceProxies[index]);
		for (int index= 0; index < targetProxies.length; index++)
			set.add(targetProxies[index]);
		final RefactoringDescriptorProxy[] outputProxies= new RefactoringDescriptorProxy[set.size()];
		set.toArray(outputProxies);
		Arrays.sort(outputProxies, new Comparator() {
			public final int compare(final Object first, final Object second) {
				final RefactoringDescriptorProxy predecessor= (RefactoringDescriptorProxy) first;
				final RefactoringDescriptorProxy successor= (RefactoringDescriptorProxy) second;
				return (int) (successor.getTimeStamp() - predecessor.getTimeStamp());
			}
		});
		final StringBuffer buffer= new StringBuffer(256);
		for (int index= 0; index < outputProxies.length; index++) {
			final RefactoringDescriptorProxy proxy= outputProxies[index];
			buffer.setLength(0);
			buffer.append(proxy.getTimeStamp());
			buffer.append(RefactoringHistoryManager.DELIMITER_COMPONENT);
			buffer.append(RefactoringHistoryManager.escapeString(proxy.getDescription()));
			buffer.append(RefactoringHistoryManager.DELIMITER_ENTRY);
			output.write(buffer.toString().getBytes(encoding));
		}
	}
}