diff options
author | Angel Avila | 2013-09-04 19:23:53 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2013-09-19 20:03:15 +0000 |
commit | cba5f1573967f78933c7f77f55b3209b0ae130c4 (patch) | |
tree | dbcc804a1db76512f5924a2110ab5509b085bea7 /plugins/org.eclipse.osee.framework.skynet.core | |
parent | 58684e9a972496a9ceec69908820194d826a807e (diff) | |
download | org.eclipse.osee-cba5f1573967f78933c7f77f55b3209b0ae130c4.tar.gz org.eclipse.osee-cba5f1573967f78933c7f77f55b3209b0ae130c4.tar.xz org.eclipse.osee-cba5f1573967f78933c7f77f55b3209b0ae130c4.zip |
bug[ats_12LYT]: Make Merge Manager UI consistent
Change-Id: I725413ae9732066acf0bf18e85b9347f43c81d91
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core')
2 files changed, 44 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 1f6d37a8150..5ed5625f2d8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -51,7 +51,6 @@ import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects; import org.eclipse.osee.framework.skynet.core.UserManager; -import org.eclipse.osee.framework.skynet.core.artifact.operation.FinishUpdateBranchOperation; import org.eclipse.osee.framework.skynet.core.artifact.operation.UpdateBranchOperation; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.artifact.update.ConflictResolverOperation; @@ -184,6 +183,36 @@ public class BranchManager { return mergeBranch; } + /** + * returns the first merge branch for this source destination pair from the cache or null if not found + */ + public static MergeBranch getFirstMergeBranch(Branch sourceBranch) throws OseeCoreException { + MergeBranch mergeBranch = getCache().findFirstMergeBranch(sourceBranch); + return mergeBranch; + } + + /** + * returns a list tof all the merge branches for this source branch from the cache or null if not found + */ + public static List<MergeBranch> getMergeBranches(Branch sourceBranch) throws OseeCoreException { + List<MergeBranch> mergeBranches = getCache().findAllMergeBranches(sourceBranch); + return mergeBranches; + } + + /** + * returns whether a source branch has existing merge branches + */ + public static boolean hasMergeBranches(Branch sourceBranch) throws OseeCoreException { + if (getMergeBranches(sourceBranch).isEmpty()) { + return false; + } else { + return true; + } + } + + /** + * returns whether a merge branch exists for a source and dest branch pair + */ public static boolean doesMergeBranchExist(Branch sourceBranch, Branch destBranch) throws OseeCoreException { return getMergeBranch(sourceBranch, destBranch) != null; } @@ -209,20 +238,20 @@ public class BranchManager { } /** - * Update branch + * returns a list tof all the merge branches for this source branch from the cache or null if not found */ - public static Job updateBranch(final Branch branch, final ConflictResolverOperation resolver) { - IOperation operation = new UpdateBranchOperation(branch, resolver); - return Operations.executeAsJob(operation, true); + public static boolean isUpdatable(Branch branchToUpdate) throws OseeCoreException { + if (!hasMergeBranches(branchToUpdate) || branchToUpdate.getBranchState().isRebaselineInProgress()) { + return true; + } + return false; } /** - * Completes the update branch operation by committing latest parent based branch with branch with changes. Then - * swaps branches so we are left with the most current branch containing latest changes. + * Update branch */ - public static Job completeUpdateBranch(final ConflictManagerExternal conflictManager, final boolean archiveSourceBranch, final boolean overwriteUnresolvedConflicts) { - IOperation operation = - new FinishUpdateBranchOperation(conflictManager, archiveSourceBranch, overwriteUnresolvedConflicts); + public static Job updateBranch(final Branch branch, final ConflictResolverOperation resolver) { + IOperation operation = new UpdateBranchOperation(branch, resolver); return Operations.executeAsJob(operation, true); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/UpdateBranchOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/UpdateBranchOperation.java index b795892c605..29bb232f338 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/UpdateBranchOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/UpdateBranchOperation.java @@ -43,8 +43,11 @@ public class UpdateBranchOperation extends AbstractOperation { @Override protected void doWork(IProgressMonitor monitor) throws Exception { - if (originalBranch != null && originalBranch.hasParentBranch()) { - performUpdate(monitor, originalBranch); + // Only update if there are no other Merge Branches and we haven't committed this branch already + if (originalBranch != null && !BranchManager.hasMergeBranches(originalBranch) && !originalBranch.getBranchState().isCommitted()) { + if (originalBranch.hasParentBranch()) { + performUpdate(monitor, originalBranch); + } } } |