Thursday, August 30, 2012

Performing compare in Eclipse with resources that are not under version control

I had an interesting problem at hand. For a particular plugin that has GEF editor every time model of the editor would get build a special '.compiledFlow' file would get generated. This file should not be managed by svn and should not be committed with the rest of the project. This was double by using Team.setAllIgnores(). However, as a by-product of this whenever I tried to compare a file that was under version control, .compiledFlow would also be considered for comparison, this is because model file and .compiledFlow file were bulked in this special virtual folder. Whenever I tried to compare my model file I would get the following error
org.tigris.subversion.javahl.ClientException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.diff(AbstractJhlClientAdapter.java:2462) at org.tigris.subversion.subclipse.ui.operations.ShowDifferencesAsUnifiedDiffOperationWC.execute(ShowDifferencesAsUnifiedDiffOperationWC.java:50) at org.tigris.subversion.subclipse.ui.operations.SVNOperation.run(SVNOperation.java:90) at org.eclipse.team.internal.ui.actions.ProgressDialogRunnableContext$3.run(ProgressDialogRunnableContext.java:100) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.team.internal.ui.actions.ProgressDialogRunnableContext$2.run(ProgressDialogRunnableContext.java:97) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.tigris.subversion.javahl.ClientException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tigris.subversion.javahl.JavaHLObjectFactory.throwException(JavaHLObjectFactory.java:778) at org.tmatesoft.svn.core.javahl.SVNClientImpl.throwException(SVNClientImpl.java:1850) at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff(SVNClientImpl.java:2035) at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff(SVNClientImpl.java:1990) at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff(SVNClientImpl.java:1985) at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.diff(AbstractJhlClientAdapter.java:2459) ... 6 more Caused by: org.tmatesoft.svn.core.SVNException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51) at org.tmatesoft.svn.core.internal.wc.admin.SVNWCAccess.getVersionedEntry(SVNWCAccess.java:621) at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicClient.java:499) at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber(SVNBasicClient.java:465) at org.tmatesoft.svn.core.wc.SVNDiffClient.doDiffURLWC(SVNDiffClient.java:2725) at org.tmatesoft.svn.core.wc.SVNDiffClient.doDiff(SVNDiffClient.java:685) at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff(SVNClientImpl.java:2024) ... 9 more
Obviously the problem here is that .compiledFlow was not under version control. However, I don't want it to be there, and I also want to compare this file's siblings. The solution is set unversioned diff flag:
SVNDiffClient diffClient = SVNClientManager.newInstance().getDiffClient(); 
diffClient.getDiffGenerator().setDiffUnversioned(true);

Blogger Syntax Highliter