Esempio n. 1
0
  private Intersection getMergeAllIntersection(List<LocalChangeList> localChangeLists) {
    final Intersection intersection = new Intersection();

    for (LocalChangeList localChangeList : localChangeLists) {
      final Collection<Change> localChanges = localChangeList.getChanges();
      for (Change localChange : localChanges) {
        intersection.add(localChangeList.getName(), localChangeList.getComment(), localChange);
      }
    }
    return intersection;
  }
Esempio n. 2
0
    @Nullable
    private Intersection checkIntersection(
        @Nullable final List<CommittedChangeList> lists, List<LocalChangeList> localChangeLists) {
      if (lists == null || lists.isEmpty()) {
        return null;
      }
      final Set<FilePath> mergePaths = new HashSet<FilePath>();
      for (CommittedChangeList list : lists) {
        final SvnChangeList svnList = (SvnChangeList) list;
        final List<String> paths = new ArrayList<String>(svnList.getAddedPaths());
        paths.addAll(svnList.getChangedPaths());
        paths.addAll(svnList.getDeletedPaths());
        for (String path : paths) {
          final File localPath = getLocalPath(path);
          if (localPath != null) {
            mergePaths.add(new FilePathImpl(localPath, false));
          }
        }
      }

      final Intersection intersection = new Intersection();
      for (LocalChangeList localChangeList : localChangeLists) {
        final Collection<Change> localChanges = localChangeList.getChanges();

        for (Change localChange : localChanges) {
          final FilePath before =
              localChange.getBeforeRevision() == null
                  ? null
                  : localChange.getBeforeRevision().getFile();
          final FilePath after =
              localChange.getAfterRevision() == null
                  ? null
                  : localChange.getAfterRevision().getFile();

          if ((before != null && mergePaths.contains(before))
              || (after != null && mergePaths.contains(after))) {
            intersection.add(localChangeList.getName(), localChangeList.getComment(), localChange);
          }
        }
      }
      return intersection;
    }
 @Nullable
 public String editComment(@NotNull final String fromName, final String newComment) {
   final LocalChangeList list = myMap.get(fromName);
   if (list != null) {
     final String oldComment = list.getComment();
     if (!Comparing.equal(oldComment, newComment)) {
       final LocalChangeListImpl listImpl = (LocalChangeListImpl) list;
       listImpl.setCommentImpl(newComment);
       final ChangeListEditHandler editHandler = listImpl.getEditHandler();
       if (editHandler != null) {
         listImpl.setNameImpl(
             editHandler.changeNameOnChangeComment(listImpl.getName(), listImpl.getComment()));
         if (!fromName.equals(listImpl.getName())) {
           myMap.remove(fromName);
           myMap.put(listImpl.getName(), list);
         }
       }
     }
     return oldComment;
   }
   return null;
 }