public static void readExternal(
      final Element element,
      final List<ShelvedChangeList> changes,
      final List<ShelvedChangeList> recycled)
      throws InvalidDataException {
    changes.addAll(ShelvedChangeList.readChanges(element, false, true));

    recycled.addAll(ShelvedChangeList.readChanges(element, true, true));
  }
  public <T extends TaskRepository> void setRepositories(List<T> repositories) {

    Set<TaskRepository> set = new HashSet<TaskRepository>(myRepositories);
    set.removeAll(repositories);
    myBadRepositories.removeAll(set); // remove all changed reps
    myIssueCache.clear();

    myRepositories.clear();
    myRepositories.addAll(repositories);

    reps:
    for (T repository : repositories) {
      if (repository.isShared() && repository.getUrl() != null) {
        List<TaskProjectConfiguration.SharedServer> servers = getProjectConfiguration().servers;
        TaskRepositoryType type = repository.getRepositoryType();
        for (TaskProjectConfiguration.SharedServer server : servers) {
          if (repository.getUrl().equals(server.url) && type.getName().equals(server.type)) {
            continue reps;
          }
        }
        TaskProjectConfiguration.SharedServer server = new TaskProjectConfiguration.SharedServer();
        server.type = type.getName();
        server.url = repository.getUrl();
        servers.add(server);
      }
    }
  }
 @Nullable
 private static Change[] loadFakeRevisions(final Project project, final Change[] changes) {
   List<Change> matchingChanges = new ArrayList<Change>();
   for (Change change : changes) {
     matchingChanges.addAll(
         ChangeListManager.getInstance(project).getChangesIn(ChangesUtil.getFilePath(change)));
   }
   return matchingChanges.toArray(new Change[matchingChanges.size()]);
 }
Ejemplo n.º 4
0
  @CalledInAwt
  protected void refreshFiles(final Collection<FilePath> additionalDirectly) {
    final List<FilePath> directlyAffected = myVerifier.getDirectlyAffected();
    final List<VirtualFile> indirectlyAffected = myVerifier.getAllAffected();
    directlyAffected.addAll(additionalDirectly);

    refreshPassedFilesAndMoveToChangelist(
        myProject, directlyAffected, indirectlyAffected, myToTargetListsMover);
  }
  @SuppressWarnings({"unchecked"})
  public void loadState(Config config) {
    XmlSerializerUtil.copyBean(config, myConfig);
    myTasks.clear();
    for (LocalTaskImpl task : config.tasks) {
      addTask(task);
    }

    myRepositories.clear();
    Element element = config.servers;
    List<TaskRepository> repositories = loadRepositories(element);
    myRepositories.addAll(repositories);
  }
Ejemplo n.º 6
0
 @NotNull
 public ApplyPatchStatus nonWriteActionPreCheck() {
   final List<FilePatch> failedPreCheck = myVerifier.nonWriteActionPreCheck();
   myFailedPatches.addAll(failedPreCheck);
   myPatches.removeAll(failedPreCheck);
   final List<FilePatch> skipped = myVerifier.getSkipped();
   final boolean applyAll = skipped.isEmpty();
   myPatches.removeAll(skipped);
   if (!failedPreCheck.isEmpty()) return ApplyPatchStatus.FAILURE;
   return applyAll
       ? ApplyPatchStatus.SUCCESS
       : ((skipped.size() == myPatches.size())
           ? ApplyPatchStatus.ALREADY_APPLIED
           : ApplyPatchStatus.PARTIAL);
 }
Ejemplo n.º 7
0
 @Nullable
 protected ApplyPatchStatus executeWritable() {
   final ReadonlyStatusHandler.OperationStatus readOnlyFilesStatus =
       getReadOnlyFilesStatus(myVerifier.getWritableFiles());
   if (readOnlyFilesStatus.hasReadonlyFiles()) {
     showError(myProject, readOnlyFilesStatus.getReadonlyFilesMessage(), true);
     return ApplyPatchStatus.ABORT;
   }
   myFailedPatches.addAll(myVerifier.filterBadFileTypePatches());
   ApplyPatchStatus result = myFailedPatches.isEmpty() ? null : ApplyPatchStatus.FAILURE;
   final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches = myVerifier.getTextPatches();
   try {
     markInternalOperation(textPatches, true);
     return ApplyPatchStatus.and(
         result, actualApply(textPatches, myVerifier.getBinaryPatches(), myCommitContext));
   } finally {
     markInternalOperation(textPatches, false);
   }
 }
Ejemplo n.º 8
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;
    }
Ejemplo n.º 9
0
  @Override
  public <S> List<S> filterUniqueRoots(
      final List<S> in, final Convertor<S, VirtualFile> convertor) {
    if (in.size() <= 1) return in;

    final List<MyPair<S>> infos = new ArrayList<MyPair<S>>(in.size());
    final SvnFileUrlMappingImpl mapping = (SvnFileUrlMappingImpl) getSvnFileUrlMapping();
    final List<S> notMatched = new LinkedList<S>();
    for (S s : in) {
      final VirtualFile vf = convertor.convert(s);
      if (vf == null) continue;

      final File ioFile = new File(vf.getPath());
      SVNURL url = mapping.getUrlForFile(ioFile);
      if (url == null) {
        url = SvnUtil.getUrl(this, ioFile);
        if (url == null) {
          notMatched.add(s);
          continue;
        }
      }
      infos.add(new MyPair<S>(vf, url.toString(), s));
    }
    final List<MyPair<S>> filtered = new ArrayList<MyPair<S>>(infos.size());
    ForNestedRootChecker.filterOutSuperfluousChildren(this, infos, filtered);

    final List<S> converted =
        ObjectsConvertor.convert(
            filtered,
            new Convertor<MyPair<S>, S>() {
              @Override
              public S convert(final MyPair<S> o) {
                return o.getSrc();
              }
            });
    if (!notMatched.isEmpty()) {
      // potential bug is here: order is not kept. but seems it only occurs for cases where result
      // is sorted after filtering so ok
      converted.addAll(notMatched);
    }
    return converted;
  }