[jbosstools-commits] JBoss Tools SVN: r42805 - in branches/jbosstools-3.3.x/openshift: plugins/org.jboss.tools.openshift.egit.ui/META-INF and 5 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jul 31 06:56:26 EDT 2012


Author: adietish
Date: 2012-07-31 06:56:26 -0400 (Tue, 31 Jul 2012)
New Revision: 42805

Modified:
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.ui/META-INF/MANIFEST.MF
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.client/.classpath
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/META-INF/MANIFEST.MF
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java
Log:
[JBIDE-12338] adapted version ranges in manifests, catched exception and rethrow RuntimeException/CoreException if EGit 2.0 throws additional exceptions

Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java	2012-07-31 10:56:26 UTC (rev 42805)
@@ -47,7 +47,7 @@
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.InitCommand;
 import org.eclipse.jgit.api.MergeResult;
-import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.errors.NoWorkTreeException;
 import org.eclipse.jgit.errors.NotSupportedException;
 import org.eclipse.jgit.lib.ConfigConstants;
@@ -142,6 +142,7 @@
 	 * @param monitor
 	 * @return
 	 * @throws CoreException
+	 * @throws GitAPIException 
 	 */
 	public static Repository share(IProject project, IProgressMonitor monitor) throws CoreException {
 		Repository repository = createRepository(project, monitor);
@@ -172,7 +173,9 @@
 			init.setBare(false).setDirectory(project.getLocation().toFile());
 			Git git = init.call();
 			return git.getRepository();
-		} catch (JGitInternalException e) {
+		} catch (Exception e) {
+			// ugly workaround to allow us to use egit 2.0 while staying
+			// compatible
 			throw new CoreException(EGitCoreActivator.createErrorStatus(
 					NLS.bind("Could not initialize a git repository at {0}: {1}",
 							getRepositoryPathFor(project),
@@ -874,16 +877,29 @@
 	 * @throws IOException
 	 * @throws NoWorkTreeException
 	 */
-	public static boolean isDirty(Repository repository) throws NoWorkTreeException, IOException {
-		boolean hasChanges = false;
-		org.eclipse.jgit.api.Status repoStatus = new Git(repository).status().call();
-		hasChanges |= !repoStatus.getAdded().isEmpty();
-		hasChanges |= !repoStatus.getChanged().isEmpty();
-		hasChanges |= !repoStatus.getModified().isEmpty();
-		hasChanges |= !repoStatus.getRemoved().isEmpty();
-		hasChanges |= !repoStatus.getConflicting().isEmpty();
-		hasChanges |= !repoStatus.getMissing().isEmpty();
-		return hasChanges;
+	public static boolean isDirty(Repository repository)
+			throws NoWorkTreeException, IOException {
+		try {
+			boolean hasChanges = false;
+			org.eclipse.jgit.api.Status repoStatus = new Git(repository)
+					.status().call();
+			hasChanges |= !repoStatus.getAdded().isEmpty();
+			hasChanges |= !repoStatus.getChanged().isEmpty();
+			hasChanges |= !repoStatus.getModified().isEmpty();
+			hasChanges |= !repoStatus.getRemoved().isEmpty();
+			hasChanges |= !repoStatus.getConflicting().isEmpty();
+			hasChanges |= !repoStatus.getMissing().isEmpty();
+			return hasChanges;
+		} catch (Exception e) {
+			// ugly workaround to allow us to use egit 2.0 while staying
+			// compatible
+			if (e instanceof NoWorkTreeException) {
+				throw (NoWorkTreeException) e;
+			} else if (e instanceof IOException) {
+				throw (IOException) e;
+			}
+			throw new RuntimeException(e);
+		}
 	}
 
 	public static int countCommitableChanges(IProject project, IServer server, IProgressMonitor monitor) throws CoreException {

Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.ui/META-INF/MANIFEST.MF	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.egit.ui/META-INF/MANIFEST.MF	2012-07-31 10:56:26 UTC (rev 42805)
@@ -5,11 +5,11 @@
 Bundle-Version: 2.3.1.qualifier
 Bundle-Activator: org.jboss.tools.openshift.egit.ui.EGitUIActivator
 Require-Bundle: org.jboss.tools.openshift.egit.core;bundle-version="[2.3.0,3.0.0)",
- org.eclipse.egit.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.egit.ui;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.jgit;bundle-version="[1.0.0,2.0.0)",
- com.jcraft.jsch;bundle-version="[0.1.41,1.0.0)",
- org.eclipse.ui;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.egit.core;bundle-version="1.0.0",
+ org.eclipse.egit.ui;bundle-version="1.0.0",
+ org.eclipse.jgit;bundle-version="1.0.0",
+ com.jcraft.jsch;bundle-version="0.1.41",
+ org.eclipse.ui;bundle-version="3.7.0",
  org.eclipse.core.runtime,
  org.eclipse.core.expressions;bundle-version="[3.4.300,4.0.0)",
  org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)",

Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.client/.classpath
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.client/.classpath	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.client/.classpath	2012-07-31 10:56:26 UTC (rev 42805)
@@ -3,7 +3,7 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry exported="true" kind="lib" path="openshift-java-client-2.0.0-SNAPSHOT.jar" sourcepath="/openshift-java-client"/>
+	<classpathentry exported="true" kind="lib" path="openshift-java-client-2.0.0-SNAPSHOT.jar" sourcepath="/home/adietish/jboss-workspaces/openshift-java-client/src"/>
 	<classpathentry kind="lib" path="jboss-dmr-1.0.0.Final.jar"/>
 	<classpathentry kind="lib" path="log4j-1.2.16.jar"/>
 	<classpathentry kind="lib" path="slf4j-api-1.6.1.jar"/>

Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF	2012-07-31 10:56:26 UTC (rev 42805)
@@ -9,9 +9,9 @@
  org.jboss.tools.openshift.egit.core;bundle-version="2.3.0",
  org.jboss.tools.openshift.egit.ui;bundle-version="2.3.0",
  org.jboss.ide.eclipse.as.ui;bundle-version="[2.3.0,3.0.0)",
- org.eclipse.egit.ui;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.egit.core;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.jgit;bundle-version="[1.1.0,2.1.0)",
+ org.eclipse.egit.ui;bundle-version="1.0.0",
+ org.eclipse.egit.core;bundle-version="1.1.0",
+ org.eclipse.jgit;bundle-version="1.1.0",
  com.jcraft.jsch;bundle-version="0.1.41",
  org.eclipse.jsch.core;bundle-version="[1.1.300,2.0.0)",
  org.jboss.ide.eclipse.as.core;bundle-version="2.3.0",

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/META-INF/MANIFEST.MF	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/META-INF/MANIFEST.MF	2012-07-31 10:56:26 UTC (rev 42805)
@@ -6,9 +6,9 @@
 Bundle-Activator: org.jboss.tools.openshift.egit.internal.test.EGitTestActivator
 Bundle-Vendor: JBoss by Red Hat
 Require-Bundle: org.eclipse.egit.core;bundle-version="1.0.0",
- org.eclipse.jgit;bundle-version="[1.0.0,2.0.1]",
+ org.eclipse.jgit;bundle-version="1.0.0",
  org.eclipse.core.runtime,
- org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)",
+ org.eclipse.core.resources;bundle-version="3.7.100",
  org.eclipse.core.filesystem;bundle-version="1.3.100",
  org.junit;bundle-version="[4.8.2,5.0.0)",
  org.jboss.tools.openshift.egit.core;bundle-version="1.0.0"

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java	2012-07-31 10:56:26 UTC (rev 42805)
@@ -1,9 +1,9 @@
 package org.jboss.tools.openshift.egit.internal.test;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
 
 import java.io.File;
 import java.io.IOException;
@@ -17,6 +17,7 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.egit.core.Activator;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.lib.ConfigConstants;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.StoredConfig;
@@ -196,7 +197,7 @@
 	}
 	
 	@Test
-	public void addedButNotCommittedIsDirty() throws IOException {
+	public void addedButNotCommittedIsDirty() throws IOException, GitAPIException {
 		assertFalse(EGitUtils.isDirty(testRepository.getRepository()));
 		File file = testRepository.createFile("a.txt", "protoculture");
 		testRepository.add(file);

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java	2012-07-31 10:48:22 UTC (rev 42804)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java	2012-07-31 10:56:26 UTC (rev 42805)
@@ -34,12 +34,10 @@
 import org.eclipse.egit.core.op.DisconnectProviderOperation;
 import org.eclipse.jgit.api.CommitCommand;
 import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
+import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
-import org.eclipse.jgit.api.errors.NoHeadException;
-import org.eclipse.jgit.api.errors.NoMessageException;
-import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
+import org.eclipse.jgit.api.errors.UnmergedPathsException;
 import org.eclipse.jgit.dircache.DirCache;
 import org.eclipse.jgit.dircache.DirCacheEntry;
 import org.eclipse.jgit.errors.UnmergedPathException;
@@ -132,15 +130,11 @@
 	 *            commit message
 	 * @return commit object
 	 * @throws IOException
-	 * @throws NoHeadException
-	 * @throws NoMessageException
-	 * @throws ConcurrentRefUpdateException
 	 * @throws JGitInternalException
-	 * @throws WrongRepositoryStateException
+	 * @throws GitAPIException 
 	 */
 	public RevCommit createInitialCommit(String message) throws IOException,
-			NoHeadException, NoMessageException, ConcurrentRefUpdateException,
-			JGitInternalException, WrongRepositoryStateException {
+			JGitInternalException, GitAPIException {
 		String repoPath = repository.getWorkTree().getAbsolutePath();
 		File file = new File(repoPath, "dummy");
 		if (!file.exists())
@@ -252,17 +246,14 @@
 	 *            commit message
 	 * @return commit object
 	 * 
-	 * @throws NoHeadException
-	 * @throws NoMessageException
 	 * @throws UnmergedPathException
-	 * @throws ConcurrentRefUpdateException
 	 * @throws JGitInternalException
-	 * @throws WrongRepositoryStateException
+	 * @throws GitAPIException 
+	 * @throws UnmergedPathsException 
 	 */
-	public RevCommit commit(String message) throws NoHeadException,
-			NoMessageException, UnmergedPathException,
-			ConcurrentRefUpdateException, JGitInternalException,
-			WrongRepositoryStateException {
+	public RevCommit commit(String message) throws UnmergedPathException,
+			JGitInternalException,
+			UnmergedPathsException, GitAPIException {
 		Git git = new Git(repository);
 		CommitCommand commitCommand = git.commit();
 		commitCommand.setAuthor("J. Git", "j.git at egit.org");
@@ -271,7 +262,7 @@
 		return commitCommand.call();
 	}
 
-	public void add(IFile file) throws IOException {
+	public void add(IFile file) throws IOException, GitAPIException {
 		add(new File(file.getLocation().toOSString()));
 	}
 
@@ -280,8 +271,9 @@
 	 * 
 	 * @param file
 	 * @throws IOException
+	 * @throws GitAPIException 
 	 */
-	public void add(File file) throws IOException {
+	public void add(File file) throws IOException, GitAPIException {
 		String repoPath =
 				getRepoRelativePath(file.getAbsolutePath());
 		try {



More information about the jbosstools-commits mailing list