Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[subversive-dev] Regression: branch comparison ignores local additions

Hi,

in latest subversive release (3.0.4) bug #492534 came back.
I guess the regression was introduced in commit r21653.
The attached patch seems to solve the problem. Can you review it?

[#492534] :https://bugs.eclipse.org/bugs/show_bug.cgi?id=492534

-- 
Florent Angebault
Linagora - Support OSSA
https://www.08000linux.com/
diff --git a/org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/compare/ThreeWayResourceCompareInput.java b/org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/compare/ThreeWayResourceCompareInput.java
index 835b95fa..5fedc1c2 100644
--- a/org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/compare/ThreeWayResourceCompareInput.java
+++ b/org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/compare/ThreeWayResourceCompareInput.java
@@ -238,21 +238,30 @@ public class ThreeWayResourceCompareInput extends ResourceCompareInput implement
 	
 	public void initialize(IProgressMonitor monitor) throws Exception {
 		Map<String, SVNDiffStatus> localChanges = new HashMap<String, SVNDiffStatus>();
-		SVNDiffStatus []rChanges = this.remoteChanges.toArray(new SVNDiffStatus[this.remoteChanges.size()]);
-		SVNUtility.reorder(rChanges, true);
+		Map<String, SVNDiffStatus> remoteChanges = new HashMap<String, SVNDiffStatus>();
+		Map<SVNDiffStatus, String> allChanges = new HashMap<SVNDiffStatus, String>();
 		for (Iterator<SVNDiffStatus> it = this.localChanges.iterator(); it.hasNext() && !monitor.isCanceled(); ) {
 			SVNDiffStatus status = it.next();
 			localChanges.put(status.pathPrev, status);
+			allChanges.put(status, status.pathPrev);
+		}
+		for (Iterator<SVNDiffStatus> it = this.remoteChanges.iterator(); it.hasNext() && !monitor.isCanceled(); ) {
+			SVNDiffStatus status = it.next();
+			String localPath = this.getLocalPath(SVNUtility.decodeURL(status.pathPrev), this.rootAncestor);
+			remoteChanges.put(localPath, status);
+			allChanges.put(status, localPath);
 		}
 		
+		SVNDiffStatus[] allChangedStatuses = allChanges.keySet().toArray(new SVNDiffStatus[allChanges.size()]);
+		SVNUtility.reorder(allChangedStatuses, true);
 		HashMap path2node = new HashMap();
 		String message = SVNUIMessages.ResourceCompareInput_CheckingDelta;
-		for (int i = 0; i < rChanges.length && !monitor.isCanceled(); i++) {
-			SVNDiffStatus status = rChanges[i];
-			String localPath = this.getLocalPath(SVNUtility.decodeURL(status.pathPrev), this.rootAncestor);
-			monitor.subTask(BaseMessages.format(message, new Object[] {localPath}));
-			this.makeBranch(localPath, localChanges.get(localPath), status, path2node, monitor);
-			ProgressMonitorUtility.progress(monitor, i, rChanges.length);
+		for (int i = 0; i < allChangedStatuses.length && !monitor.isCanceled(); i++) {
+			SVNDiffStatus status = allChangedStatuses[i];
+			String changePath = allChanges.get(status);
+			monitor.subTask(BaseMessages.format(message, new Object[] {changePath}));
+			this.makeBranch(changePath, localChanges.get(changePath), remoteChanges.get(changePath), path2node, monitor);
+			ProgressMonitorUtility.progress(monitor, i, allChanges.size());
 		}
 		
 		this.findRootNode(path2node, this.rootLeft, monitor);

Back to the top