SVN: also check for file status when removing "added" files that are already reported as added, but are children of moved directory

This commit is contained in:
irengrig
2012-05-30 12:42:13 +04:00
parent 8600546221
commit 4d8778e375
7 changed files with 17 additions and 12 deletions
@@ -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<Change> 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;
}
@@ -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.
@@ -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) {
@@ -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<Change> 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;
}
@@ -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) {
@@ -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);
}
@@ -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<Change> 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);