コード例 #1
0
 public ThreeState haveChangesUnder(@NotNull VirtualFile virtualFile) {
   FilePath dir = VcsUtil.getFilePath(virtualFile);
   FilePath changeCandidate = myIdx.getAffectedPaths().ceiling(dir);
   if (changeCandidate == null) {
     return ThreeState.NO;
   }
   return FileUtil.isAncestorThreeState(dir.getPath(), changeCandidate.getPath(), false);
 }
コード例 #2
0
 public List<File> getAffectedPaths() {
   final SortedSet<FilePath> set = myIdx.getAffectedPaths();
   final List<File> result = new ArrayList<File>(set.size());
   for (FilePath path : set) {
     result.add(path.getIOFile());
   }
   return result;
 }
コード例 #3
0
  private void checkForMultipleCopiesNotMove(boolean somethingChanged) {
    final MultiMap<FilePath, Pair<Change, String>> moves =
        new MultiMap<FilePath, Pair<Change, String>>() {
          @NotNull
          protected Collection<Pair<Change, String>> createCollection() {
            return new LinkedList<Pair<Change, String>>();
          }
        };

    for (LocalChangeList changeList : myMap.values()) {
      final Collection<Change> changes = changeList.getChanges();
      for (Change change : changes) {
        if (change.isMoved() || change.isRenamed()) {
          moves.putValue(
              change.getBeforeRevision().getFile(), Pair.create(change, changeList.getName()));
        }
      }
    }
    for (FilePath filePath : moves.keySet()) {
      final List<Pair<Change, String>> copies = (List<Pair<Change, String>>) moves.get(filePath);
      if (copies.size() == 1) continue;
      Collections.sort(copies, MyChangesAfterRevisionComparator.getInstance());
      for (int i = 0; i < (copies.size() - 1); i++) {
        somethingChanged = true;
        final Pair<Change, String> item = copies.get(i);
        final Change oldChange = item.getFirst();
        final Change newChange = new Change(null, oldChange.getAfterRevision());

        final LocalChangeListImpl list = (LocalChangeListImpl) myMap.get(item.getSecond());
        list.removeChange(oldChange);
        list.addChange(newChange);

        final VcsKey key = myIdx.getVcsFor(oldChange);
        myIdx.changeRemoved(oldChange);
        myIdx.changeAdded(newChange, key);
      }
    }
    if (somethingChanged) {
      FileStatusManager.getInstance(myProject).fileStatusesChanged();
    }
  }
コード例 #4
0
 public void addChangeToCorrespondingList(final Change change, final VcsKey vcsKey) {
   final String path = ChangesUtil.getFilePath(change).getPath();
   LOG.debug(
       "[addChangeToCorrespondingList] for change "
           + path
           + " type: "
           + change.getType()
           + " have before revision: "
           + (change.getBeforeRevision() != null));
   assert myDefault != null;
   for (LocalChangeList list : myMap.values()) {
     if (list.isDefault()) {
       LOG.debug(
           "[addChangeToCorrespondingList] skip default list: "
               + list.getName()
               + " type: "
               + change.getType()
               + " have before revision: "
               + (change.getBeforeRevision() != null));
       continue;
     }
     if (((LocalChangeListImpl) list).processChange(change)) {
       LOG.debug(
           "[addChangeToCorrespondingList] matched: "
               + list.getName()
               + " type: "
               + change.getType()
               + " have before revision: "
               + (change.getBeforeRevision() != null));
       myIdx.changeAdded(change, vcsKey);
       return;
     }
   }
   ((LocalChangeListImpl) myDefault).processChange(change);
   myIdx.changeAdded(change, vcsKey);
 }
コード例 #5
0
 public boolean addChangeToList(
     @NotNull final String name, final Change change, final VcsKey vcsKey) {
   LOG.debug(
       "[addChangeToList] name: "
           + name
           + " change: "
           + ChangesUtil.getFilePath(change).getPath()
           + " vcs: "
           + (vcsKey == null ? null : vcsKey.getName()));
   final LocalChangeList changeList = myMap.get(name);
   if (changeList != null) {
     ((LocalChangeListImpl) changeList).addChange(change);
     myIdx.changeAdded(change, vcsKey);
   }
   return changeList != null;
 }
コード例 #6
0
  public void removeRegisteredChangeFor(FilePath path) {
    myIdx.remove(path);

    for (LocalChangeList list : myMap.values()) {
      for (Change change : list.getChanges()) {
        final ContentRevision afterRevision = change.getAfterRevision();
        if (afterRevision != null && afterRevision.getFile().equals(path)) {
          ((LocalChangeListImpl) list).removeChange(change);
          return;
        }
        final ContentRevision beforeRevision = change.getBeforeRevision();
        if (beforeRevision != null && beforeRevision.getFile().equals(path)) {
          ((LocalChangeListImpl) list).removeChange(change);
          return;
        }
      }
    }
  }
コード例 #7
0
  // called NOT under ChangeListManagerImpl lock
  public void notifyStartProcessingChanges(final VcsModifiableDirtyScope scope) {
    final Collection<Change> oldChanges = new ArrayList<Change>();
    for (LocalChangeList list : myMap.values()) {
      final Collection<Change> affectedChanges =
          ((LocalChangeListImpl) list).startProcessingChanges(myProject, scope);
      if (!affectedChanges.isEmpty()) {
        oldChanges.addAll(affectedChanges);
      }
    }
    for (Change change : oldChanges) {
      myIdx.changeRemoved(change);
    }
    // scope should be modified for correct moves tracking
    correctScopeForMoves(scope, oldChanges);

    myLocallyDeleted.cleanAndAdjustScope(scope);
    mySwitchedHolder.cleanAndAdjustScope(scope);
  }
コード例 #8
0
 public FileStatus getStatus(final FilePath file) {
   return myIdx.getStatus(file);
 }
コード例 #9
0
 public FileStatus getStatus(final VirtualFile file) {
   return myIdx.getStatus(file);
 }