diff --git a/platform/testFramework/src/com/intellij/testFramework/vcs/MockChangelistBuilder.java b/platform/testFramework/src/com/intellij/testFramework/vcs/MockChangelistBuilder.java index 635d70c400b9..6d5f350f5934 100644 --- a/platform/testFramework/src/com/intellij/testFramework/vcs/MockChangelistBuilder.java +++ b/platform/testFramework/src/com/intellij/testFramework/vcs/MockChangelistBuilder.java @@ -18,6 +18,7 @@ package com.intellij.testFramework.vcs; import com.intellij.openapi.util.Factory; import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vfs.VirtualFile; @@ -54,10 +55,10 @@ public class MockChangelistBuilder implements ChangelistBuilder { } @Override - public void removeRegisteredChangeFor(FilePath path) { + public void removeRegisteredChangeFor(FilePath path, FileStatus fileStatus) { for (Iterator iterator = myChanges.iterator(); iterator.hasNext(); ) { final Change change = iterator.next(); - if (path.equals(ChangesUtil.getFilePath(change))) { + if (path.equals(ChangesUtil.getFilePath(change)) && change.getFileStatus().equals(fileStatus)) { iterator.remove(); return; } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangelistBuilder.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangelistBuilder.java index a7042cb1b6ae..2ce5a688d20f 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangelistBuilder.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangelistBuilder.java @@ -18,6 +18,7 @@ package com.intellij.openapi.vcs.changes; import com.intellij.openapi.util.Factory; import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; @@ -54,7 +55,7 @@ public interface ChangelistBuilder { */ void processChangeInList(Change change, String changeListName, VcsKey vcsKey); - void removeRegisteredChangeFor(final FilePath path); + void removeRegisteredChangeFor(final FilePath path, FileStatus fileStatus); /** * Process a file that is not under version control. diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EmptyChangelistBuilder.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EmptyChangelistBuilder.java index 88036289af13..4da0c5ec7191 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EmptyChangelistBuilder.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EmptyChangelistBuilder.java @@ -18,6 +18,7 @@ package com.intellij.openapi.vcs.changes; import com.intellij.openapi.util.Factory; import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; @@ -38,7 +39,7 @@ public class EmptyChangelistBuilder implements ChangelistBuilder { } @Override - public void removeRegisteredChangeFor(FilePath path) { + public void removeRegisteredChangeFor(FilePath path, FileStatus fileStatus) { } public void processUnversionedFile(final VirtualFile file) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java index 4b5c406d756b..78c6f8ab35c5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java @@ -775,19 +775,19 @@ public class ChangeListWorker implements ChangeListsWriteOperations { } } - public void removeRegisteredChangeFor(FilePath path) { + public void removeRegisteredChangeFor(FilePath path, FileStatus fileStatus) { myIdx.remove(path); for (LocalChangeList list : myMap.values()) { for (Iterator iterator = list.getChanges().iterator(); iterator.hasNext(); ) { final Change change = iterator.next(); final ContentRevision afterRevision = change.getAfterRevision(); - if (afterRevision != null && afterRevision.getFile().equals(path)) { + if (afterRevision != null && afterRevision.getFile().equals(path) && change.getFileStatus().equals(fileStatus)) { ((LocalChangeListImpl) list).removeChange(change); return; } final ContentRevision beforeRevision = change.getBeforeRevision(); - if (beforeRevision != null && beforeRevision.getFile().equals(path)) { + if (beforeRevision != null && beforeRevision.getFile().equals(path) && change.getFileStatus().equals(fileStatus)) { ((LocalChangeListImpl) list).removeChange(change); return; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java index ac479025c591..fbe79bbe3ecc 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java @@ -25,6 +25,7 @@ import com.intellij.openapi.util.Factory; import com.intellij.openapi.util.Getter; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.FilePathImpl; +import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; @@ -115,8 +116,8 @@ class UpdatingChangeListBuilder implements ChangelistBuilder { } @Override - public void removeRegisteredChangeFor(FilePath path) { - myChangeListWorker.removeRegisteredChangeFor(path); + public void removeRegisteredChangeFor(FilePath path, FileStatus fileStatus) { + myChangeListWorker.removeRegisteredChangeFor(path, fileStatus); } private boolean isExcluded(final VirtualFile file) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java index f2c3f700b33e..2531b3573295 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java @@ -284,7 +284,7 @@ public class SvnChangeProvider implements ChangeProvider { } }); if (isUnder) { - builder.removeRegisteredChangeFor(oldPath); + builder.removeRegisteredChangeFor(oldPath, FileStatus.ADDED); builder.processChangeInList(newChange, clName, SvnVcs.getKey()); deletedToDelete.add(deletedFile); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java index f93b0c095d20..e16a02ca798f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java @@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Factory; import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.update.UpdatedFilesReverseSide; @@ -63,11 +64,11 @@ public class GatheringChangelistBuilder implements ChangelistBuilder { } @Override - public void removeRegisteredChangeFor(FilePath path) { + public void removeRegisteredChangeFor(FilePath path, FileStatus fileStatus) { // not sure for (Iterator iterator = myChanges.iterator(); iterator.hasNext(); ) { final Change change = iterator.next(); - if (path.equals(ChangesUtil.getFilePath(change))) { + if (path.equals(ChangesUtil.getFilePath(change)) && change.getFileStatus().equals(fileStatus)) { final VirtualFile vf = path.getVirtualFile(); if (vf != null) { myCheckSet.remove(vf);