public void checkForOutsideCopies() {
   boolean canceled = false;
   for (Iterator<WCInfo> iterator = myWcInfos.iterator(); iterator.hasNext(); ) {
     final WCInfo wcInfo = iterator.next();
     if (!wcInfo.isIsWcRoot()) {
       File path = new File(wcInfo.getPath());
       path = SvnUtil.getWorkingCopyRoot(path);
       int result =
           Messages.showYesNoCancelDialog(
               SvnBundle.message("upgrade.format.clarify.for.outside.copies.text", path),
               SvnBundle.message("action.change.wcopy.format.task.title"),
               Messages.getWarningIcon());
       if (DialogWrapper.CANCEL_EXIT_CODE == result) {
         canceled = true;
         break;
       } else if (DialogWrapper.OK_EXIT_CODE != result) {
         // no - for this copy only. maybe other
         iterator.remove();
       }
     }
   }
   if (canceled) {
     myWcInfos.clear();
   }
 }
 @Override
 public void update(final AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setIcon(SvnIcons.ShowIntegratedFrom);
   presentation.setText(SvnBundle.message("committed.changes.action.enable.merge.highlighting"));
   presentation.setDescription(
       SvnBundle.message("committed.changes.action.enable.merge.highlighting.description.text"));
 }
  public void update(final AnActionEvent e) {
    final FileGroupInfo fileGroupInfo = new FileGroupInfo();

    myHelperAction.setFileIterationListener(fileGroupInfo);
    myHelperAction.update(e);

    myGetterStub.setDelegate(fileGroupInfo);

    if ((e.getPresentation().isEnabled())) {
      removeAll();
      if (myHelperAction.allAreIgnored()) {
        final DataContext dataContext = e.getDataContext();
        final Project project = CommonDataKeys.PROJECT.getData(dataContext);
        SvnVcs vcs = SvnVcs.getInstance(project);

        final Ref<Boolean> filesOk = new Ref<Boolean>(Boolean.FALSE);
        final Ref<Boolean> extensionOk = new Ref<Boolean>(Boolean.FALSE);

        // virtual files parameter is not used -> can pass null
        SvnPropertyService.doCheckIgnoreProperty(
            vcs,
            project,
            null,
            fileGroupInfo,
            fileGroupInfo.getExtensionMask(),
            filesOk,
            extensionOk);

        if (Boolean.TRUE.equals(filesOk.get())) {
          myRemoveExactAction.setActionText(
              fileGroupInfo.oneFileSelected()
                  ? fileGroupInfo.getFileName()
                  : SvnBundle.message("action.Subversion.UndoIgnore.text"));
          add(myRemoveExactAction);
        }

        if (Boolean.TRUE.equals(extensionOk.get())) {
          myRemoveExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myRemoveExtensionAction);
        }

        e.getPresentation().setText(SvnBundle.message("group.RevertIgnoreChoicesGroup.text"));
      } else if (myHelperAction.allCanBeIgnored()) {
        final String ignoreExactlyName =
            (fileGroupInfo.oneFileSelected())
                ? fileGroupInfo.getFileName()
                : SvnBundle.message("action.Subversion.Ignore.ExactMatch.text");
        myAddExactAction.setActionText(ignoreExactlyName);
        add(myAddExactAction);
        if (fileGroupInfo.sameExtension()) {
          myAddExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myAddExtensionAction);
        }
        e.getPresentation().setText(SvnBundle.message("group.IgnoreChoicesGroup.text"));
      }
    }
  }
 protected void showProgressMessage(final ProgressIndicator progress, final File root) {
   if (SvnConfiguration.getInstance(myVcs.getProject()).MERGE_DRY_RUN) {
     progress.setText(
         SvnBundle.message("progress.text.merging.dry.run.changes", root.getAbsolutePath()));
   } else {
     progress.setText(
         SvnBundle.message("progress.text.merging.changes", root.getAbsolutePath()));
   }
 }
  public void loadCommittedChanges(
      ChangeBrowserSettings settings,
      RepositoryLocation location,
      int maxCount,
      final AsynchConsumer<CommittedChangeList> consumer)
      throws VcsException {
    try {
      final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
      final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
      if (progress != null) {
        progress.setText(SvnBundle.message("progress.text.changes.collecting.changes"));
        progress.setText2(
            SvnBundle.message("progress.text2.changes.establishing.connection", location));
      }

      final String repositoryRoot;
      SVNRepository repository = null;
      try {
        repository = myVcs.createRepository(svnLocation.getURL());
        repositoryRoot = repository.getRepositoryRoot(true).toString();
      } catch (SVNException e) {
        throw new VcsException(e);
      } finally {
        if (repository != null) {
          repository.closeSession();
        }
      }

      final ChangeBrowserSettings.Filter filter = settings.createFilter();

      getCommittedChangesImpl(
          settings,
          svnLocation.getURL(),
          new String[] {""},
          maxCount,
          new Consumer<SVNLogEntry>() {
            public void consume(final SVNLogEntry svnLogEntry) {
              final SvnChangeList cl =
                  new SvnChangeList(myVcs, svnLocation, svnLogEntry, repositoryRoot);
              if (filter.accepts(cl)) {
                consumer.consume(cl);
              }
            }
          },
          false,
          true);
    } finally {
      consumer.finished();
    }
  }
    public void run() {
      ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
      if (progress != null) {
        progress.setText(SvnBundle.message("progress.text.loading.contents", myURL));
        progress.setText2(SvnBundle.message("progress.text2.revision.information", myRevision));
      }

      try {
        myContents =
            SvnUtil.getFileContents(
                myVCS, SvnTarget.fromURL(SvnUtil.parseUrl(myURL)), myRevision, myPegRevision);
      } catch (VcsException e) {
        myException = e;
      }
    }
  public byte[] loadContent() throws IOException, VcsException {
    ContentLoader loader = new ContentLoader(myURL, myRevision, myPegRevision);
    if (ApplicationManager.getApplication().isDispatchThread() && !myRevision.isLocal()) {
      ProgressManager.getInstance()
          .runProcessWithProgressSynchronously(
              loader,
              SvnBundle.message("progress.title.loading.file.content"),
              false,
              myVCS.getProject());
    } else {
      loader.run();
    }

    VcsException exception = loader.getException();
    if (exception == null) {
      final byte[] contents = loader.getContents();
      ContentRevisionCache.checkContentsSize(myURL, contents.length);
      return contents;
    } else {
      LOG.info(
          "Failed to load file '"
              + myURL
              + "' content at revision: "
              + myRevision
              + "\n"
              + exception.getMessage(),
          exception);
      throw exception;
    }
  }
  private static class ErrorsFoundNotification extends Notification {

    private static final String FIX_ACTION = "FIX";
    private static final String TITLE = "";
    private static final String DESCRIPTION =
        SvnBundle.message("subversion.roots.detection.errors.found.description");

    private ErrorsFoundNotification(@NotNull final Project project) {
      super(
          NOTIFICATION_GROUP.getDisplayId(),
          TITLE,
          DESCRIPTION,
          NotificationType.ERROR,
          createListener(project));
    }

    private static NotificationListener.Adapter createListener(@NotNull final Project project) {
      return new NotificationListener.Adapter() {
        @Override
        protected void hyperlinkActivated(
            @NotNull Notification notification, @NotNull HyperlinkEvent event) {
          if (FIX_ACTION.equals(event.getDescription())) {
            WorkingCopiesContent.show(project);
          }
        }
      };
    }
  }
  public void execute() {
    int ok =
        Messages.showOkCancelDialog(
            myVcs.getProject(),
            (myChange.isMoved()
                ? SvnBundle.message(
                    "confirmation.resolve.tree.conflict.merge.moved",
                    myOldPresentation,
                    myNewPresentation)
                : SvnBundle.message(
                    "confirmation.resolve.tree.conflict.merge.renamed",
                    myOldPresentation,
                    myNewPresentation)),
            TreeConflictRefreshablePanel.TITLE,
            Messages.getQuestionIcon());
    if (Messages.OK != ok) return;

    FileDocumentManager.getInstance().saveAllDocuments();
    // final String name = "Merge changes from theirs for: " + myOldPresentation;

    final Continuation fragmented = Continuation.createFragmented(myVcs.getProject(), false);
    fragmented.addExceptionHandler(
        VcsException.class,
        new Consumer<VcsException>() {
          @Override
          public void consume(VcsException e) {
            myWarnings.add(e);
            if (e.isWarning()) {
              return;
            }
            AbstractVcsHelper.getInstance(myVcs.getProject())
                .showErrors(myWarnings, TreeConflictRefreshablePanel.TITLE);
          }
        });

    final List<TaskDescriptor> tasks = new SmartList<TaskDescriptor>();
    tasks.add(
        myDescription.isDirectory()
            ? new PreloadChangesContentsForDir()
            : new PreloadChangesContentsForFile());
    tasks.add(new ConvertTextPaths());
    tasks.add(new PatchCreator());
    tasks.add(new SelectPatchesInApplyPatchDialog());
    tasks.add(new SelectBinaryFiles());

    fragmented.run(tasks);
  }
 public ChangeListColumn[] getColumns() {
   return new ChangeListColumn[] {
     new ChangeListColumn.ChangeListNumberColumn(SvnBundle.message("revision.title")),
     ChangeListColumn.NAME,
     ChangeListColumn.DATE,
     ChangeListColumn.DESCRIPTION
   };
 }
 public SvnFormatWorker(
     final Project project, final WorkingCopyFormat newFormat, final List<WCInfo> wcInfos) {
   super(project, SvnBundle.message("action.change.wcopy.format.task.title"), false, DEAF);
   myProject = project;
   myNewFormat = newFormat;
   myExceptions = new ArrayList<Throwable>();
   myWcInfos = wcInfos;
   myVcs = SvnVcs.getInstance(myProject);
 }
 private static Pair<SVNRevision, SVNURL> createRemoteFolder(
     final SvnVcs vcs, final SVNURL parent, final String folderName) throws SVNException {
   SVNURL url = parent.appendPath(folderName, false);
   final String urlText = url.toString();
   final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
   if (indicator != null) {
     indicator.checkCanceled();
     indicator.setText(SvnBundle.message("share.directory.create.dir.progress.text", urlText));
   }
   final SVNCommitInfo info =
       vcs.createCommitClient()
           .doMkDir(
               new SVNURL[] {url},
               SvnBundle.message(
                   "share.directory.commit.message",
                   folderName,
                   ApplicationNamesInfo.getInstance().getFullProductName()));
   return new Pair<SVNRevision, SVNURL>(SVNRevision.create(info.getNewRevision()), url);
 }
  protected UpgradeFormatDialog(
      Project project, File path, boolean canBeParent, final boolean initHere) {
    super(project, canBeParent);
    myPath = path;
    setResizable(false);
    setTitle(SvnBundle.message("dialog.upgrade.wcopy.format.title"));

    if (initHere) {
      init();
    }
  }
  public List<SvnChangeList> getCommittedChanges(
      ChangeBrowserSettings settings, final RepositoryLocation location, final int maxCount)
      throws VcsException {
    final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
    final ArrayList<SvnChangeList> result = new ArrayList<SvnChangeList>();
    final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    if (progress != null) {
      progress.setText(SvnBundle.message("progress.text.changes.collecting.changes"));
      progress.setText2(
          SvnBundle.message("progress.text2.changes.establishing.connection", location));
    }

    final String repositoryRoot;
    SVNRepository repository = null;
    try {
      repository = myVcs.createRepository(svnLocation.getURL());
      repositoryRoot = repository.getRepositoryRoot(true).toString();
      repository.closeSession();
    } catch (SVNException e) {
      throw new VcsException(e);
    } finally {
      if (repository != null) {
        repository.closeSession();
      }
    }

    getCommittedChangesImpl(
        settings,
        svnLocation.getURL(),
        new String[] {""},
        maxCount,
        new Consumer<SVNLogEntry>() {
          public void consume(final SVNLogEntry svnLogEntry) {
            result.add(new SvnChangeList(myVcs, svnLocation, svnLogEntry, repositoryRoot));
          }
        },
        false,
        true);
    settings.filterChanges(result);
    return result;
  }
  private void collectLogEntries(
      final ProgressIndicator indicator,
      FilePath file,
      VcsException[] exception,
      final Consumer<VcsFileRevision> result,
      final Ref<Boolean> supports15Ref)
      throws SVNException, VcsException {
    SVNWCClient wcClient = myVcs.createWCClient();
    SVNInfo info =
        wcClient.doInfo(new File(file.getIOFile().getAbsolutePath()), SVNRevision.UNDEFINED);
    wcClient.setEventHandler(
        new ISVNEventHandler() {
          public void handleEvent(SVNEvent event, double progress) throws SVNException {}

          public void checkCancelled() throws SVNCancelException {
            indicator.checkCanceled();
          }
        });
    if (info == null || info.getRepositoryRootURL() == null) {
      exception[0] =
          new VcsException("File ''{0}'' is not under version control" + file.getIOFile());
      return;
    }
    final String url = info.getURL() == null ? null : info.getURL().toString();
    String relativeUrl = url;
    final SVNURL repoRootURL = info.getRepositoryRootURL();

    final String root = repoRootURL.toString();
    if (url != null && url.startsWith(root)) {
      relativeUrl = url.substring(root.length());
    }
    if (indicator != null) {
      indicator.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url));
    }
    final SVNRevision pegRevision = info.getRevision();
    SVNLogClient client = myVcs.createLogClient();

    final boolean supports15 = SvnUtil.checkRepositoryVersion15(myVcs, url);
    supports15Ref.set(supports15);
    client.doLog(
        new File[] {new File(file.getIOFile().getAbsolutePath())},
        SVNRevision.HEAD,
        SVNRevision.create(1),
        SVNRevision.UNDEFINED,
        false,
        true,
        supports15,
        0,
        null,
        new MyLogEntryHandler(
            myVcs, url, pegRevision, relativeUrl, result, repoRootURL, file.getCharset()));
  }
 protected void customizeCellRenderer(
     final JTable table,
     final Object value,
     final boolean selected,
     final boolean hasFocus,
     final int row,
     final int column) {
   if (value instanceof String && ((String) value).length() > 0) {
     setIcon(myIcon);
     setToolTipText(SvnBundle.message("copy.column.tooltip", value));
   } else {
     setToolTipText("");
   }
 }
  private void registerFormat(
      @NotNull WorkingCopyFormat format,
      @NotNull String label,
      @NotNull JPanel panel,
      @NotNull GridBagConstraints gb) {
    JRadioButton button =
        new JRadioButton(
            SvnBundle.message("radio.configure." + label + ".auto." + getKey(format) + "format"));
    button.putClientProperty("format", format);

    panel.add(button, gb);
    gb.gridy += 1;

    formatGroup.add(button);
    formatButtons.add(button);
  }
  public void reportAppendableHistory(
      FilePath path, final VcsAppendableHistorySessionPartner partner) throws VcsException {
    final FilePath committedPath = ChangesUtil.getCommittedPath(myVcs.getProject(), path);

    final LogLoader logLoader;
    if (path.isNonLocal()) {
      logLoader = new RepositoryLoader(myVcs, path);
    } else {
      logLoader = new LocalLoader(myVcs, path);
    }

    try {
      logLoader.preliminary();
    } catch (SVNCancelException e) {
      return;
    } catch (SVNException e) {
      throw new VcsException(e);
    }
    logLoader.initSupports15();

    final MyHistorySession historySession =
        new MyHistorySession(
            Collections.<VcsFileRevision>emptyList(),
            committedPath,
            Boolean.TRUE.equals(logLoader.mySupport15),
            null);

    final Ref<Boolean> sessionReported = new Ref<Boolean>();
    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator != null) {
      indicator.setText(SvnBundle.message("progress.text2.collecting.history", path.getName()));
    }
    final Consumer<VcsFileRevision> consumer =
        new Consumer<VcsFileRevision>() {
          public void consume(VcsFileRevision vcsFileRevision) {
            if (!Boolean.TRUE.equals(sessionReported.get())) {
              partner.reportCreatedEmptySession(historySession);
              sessionReported.set(true);
            }
            partner.acceptRevision(vcsFileRevision);
          }
        };

    logLoader.setConsumer(consumer);
    logLoader.load();
    logLoader.check();
  }
  @Override
  public void onSuccess() {
    if (myProject.isDisposed()) {
      return;
    }

    if (!myExceptions.isEmpty()) {
      final List<String> messages = new ArrayList<String>();
      for (Throwable exception : myExceptions) {
        messages.add(exception.getMessage());
      }
      AbstractVcsHelper.getInstance(myProject)
          .showErrors(
              Collections.singletonList(new VcsException(messages)),
              SvnBundle.message("action.change.wcopy.format.task.title"));
    }
  }
Beispiel #20
0
    @Override
    protected void load() {
      String relativeUrl = myUrl;
      final SVNURL repoRootURL = myInfo.getRepositoryRootURL();

      final String root = repoRootURL.toString();
      if (myUrl != null && myUrl.startsWith(root)) {
        relativeUrl = myUrl.substring(root.length());
      }
      if (myPI != null) {
        myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl));
      }
      final SVNRevision pegRevision = myInfo.getRevision();
      final SvnTarget target = SvnTarget.fromFile(myFile.getIOFile(), myPeg);
      try {
        myVcs
            .getFactory(target)
            .createHistoryClient()
            .doLog(
                target,
                myFrom == null ? SVNRevision.HEAD : myFrom,
                myTo == null ? SVNRevision.create(1) : myTo,
                false,
                true,
                myShowMergeSources && mySupport15,
                myLimit + 1,
                null,
                new MyLogEntryHandler(
                    myVcs,
                    myUrl,
                    pegRevision,
                    relativeUrl,
                    createConsumerAdapter(myConsumer),
                    repoRootURL,
                    myFile.getCharset()));
      } catch (SVNCancelException e) {
        //
      } catch (SVNException e) {
        myException = new VcsException(e);
      } catch (VcsException e) {
        myException = e;
      }
    }
 @Override
 protected void load() {
   if (myPI != null) {
     myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl));
   }
   SVNWCClient wcClient = myVcs.createWCClient();
   try {
     final SVNURL svnurl = SVNURL.parseURIEncoded(myUrl);
     SVNInfo info = null;
     info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
     final String root = info.getRepositoryRootURL().toString();
     String relativeUrl = myUrl;
     if (myUrl.startsWith(root)) {
       relativeUrl = myUrl.substring(root.length());
     }
     SVNLogClient client = myVcs.createLogClient();
     client.doLog(
         svnurl,
         new String[] {},
         SVNRevision.UNDEFINED,
         SVNRevision.HEAD,
         SVNRevision.create(1),
         false,
         true,
         mySupport15,
         0,
         null,
         new RepositoryLogEntryHandler(
             myVcs,
             myUrl,
             SVNRevision.UNDEFINED,
             relativeUrl,
             myConsumer,
             info.getRepositoryRootURL()));
   } catch (SVNCancelException e) {
     //
   } catch (SVNException e) {
     myException = new VcsException(e);
   } catch (VcsException e) {
     myException = e;
   }
 }
    @Override
    protected void load() {
      String relativeUrl = myUrl;
      final SVNURL repoRootURL = myInfo.getRepositoryRootURL();

      final String root = repoRootURL.toString();
      if (myUrl != null && myUrl.startsWith(root)) {
        relativeUrl = myUrl.substring(root.length());
      }
      if (myPI != null) {
        myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl));
      }
      final SVNRevision pegRevision = myInfo.getRevision();
      SVNLogClient client = myVcs.createLogClient();
      try {
        client.doLog(
            new File[] {new File(myFile.getIOFile().getAbsolutePath())},
            SVNRevision.HEAD,
            SVNRevision.create(1),
            SVNRevision.UNDEFINED,
            false,
            true,
            mySupport15,
            0,
            null,
            new MyLogEntryHandler(
                myVcs,
                myUrl,
                pegRevision,
                relativeUrl,
                myConsumer,
                repoRootURL,
                myFile.getCharset()));
      } catch (SVNCancelException e) {
        //
      } catch (SVNException e) {
        myException = new VcsException(e);
      } catch (VcsException e) {
        myException = e;
      }
    }
  public void run(@NotNull final ProgressIndicator indicator) {
    ProjectLevelVcsManager.getInstanceChecked(myProject).startBackgroundVcsOperation();
    indicator.setIndeterminate(true);
    final boolean supportsChangelists = myNewFormat.supportsChangelists();
    if (supportsChangelists) {
      myBeforeChangeLists = ChangeListManager.getInstance(myProject).getChangeListsCopy();
    }
    final SVNWCClient wcClient = myVcs.createWCClient();

    try {
      for (WCInfo wcInfo : myWcInfos) {
        File path = new File(wcInfo.getPath());
        if (!wcInfo.isIsWcRoot()) {
          path = SvnUtil.getWorkingCopyRoot(path);
        }
        indicator.setText(
            SvnBundle.message(
                "action.change.wcopy.format.task.progress.text",
                path.getAbsolutePath(),
                SvnUtil.formatRepresentation(wcInfo.getFormat()),
                SvnUtil.formatRepresentation(myNewFormat)));
        try {
          wcClient.doSetWCFormat(path, myNewFormat.getFormat());
        } catch (Throwable e) {
          myExceptions.add(e);
        }
      }
    } finally {
      ProjectLevelVcsManager.getInstance(myProject).stopBackgroundVcsOperation();

      // to map to native
      if (supportsChangelists) {
        SvnVcs.getInstance(myProject).processChangeLists(myBeforeChangeLists);
      }

      ApplicationManager.getApplication().getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
    }
  }
 private void collectLogEntriesForRepository(
     final ProgressIndicator indicator,
     FilePath file,
     final Consumer<VcsFileRevision> result,
     final Ref<Boolean> supports15Ref)
     throws SVNException, VcsException {
   final String url = file.getPath().replace('\\', '/');
   if (indicator != null) {
     indicator.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url));
   }
   SVNWCClient wcClient = myVcs.createWCClient();
   final SVNURL svnurl = SVNURL.parseURIEncoded(url);
   SVNInfo info = wcClient.doInfo(svnurl, SVNRevision.UNDEFINED, SVNRevision.HEAD);
   final String root = info.getRepositoryRootURL().toString();
   String relativeUrl = url;
   if (url.startsWith(root)) {
     relativeUrl = url.substring(root.length());
   }
   SVNLogClient client = myVcs.createLogClient();
   final boolean supports15 = SvnUtil.checkRepositoryVersion15(myVcs, root);
   supports15Ref.set(supports15);
   // todo log in history provider
   client.doLog(
       svnurl,
       new String[] {},
       SVNRevision.UNDEFINED,
       SVNRevision.HEAD,
       SVNRevision.create(1),
       false,
       true,
       supports15,
       0,
       null,
       new RepositoryLogEntryHandler(
           myVcs, url, SVNRevision.UNDEFINED, relativeUrl, result, info.getRepositoryRootURL()));
 }
 protected String getTopMessage(final String label) {
   return SvnBundle.message(
       "label.configure." + label + ".label",
       ApplicationNamesInfo.getInstance().getFullProductName());
 }
 public String getChangelistTitle() {
   return SvnBundle.message("changes.browser.revision.term");
 }
 @Override
 public String getMaxStringValue() {
   return SvnBundle.message("copy.column.title");
 }
  private void getCommittedChangesImpl(
      ChangeBrowserSettings settings,
      final String url,
      final String[] filterUrls,
      final int maxCount,
      final Consumer<SVNLogEntry> resultConsumer,
      final boolean includeMergedRevisions,
      final boolean filterOutByDate)
      throws VcsException {
    final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    if (progress != null) {
      progress.setText(SvnBundle.message("progress.text.changes.collecting.changes"));
      progress.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url));
    }
    try {
      SVNLogClient logger = myVcs.createLogClient();

      final String author = settings.getUserFilter();
      final Date dateFrom = settings.getDateAfterFilter();
      final Long changeFrom = settings.getChangeAfterFilter();
      final Date dateTo = settings.getDateBeforeFilter();
      final Long changeTo = settings.getChangeBeforeFilter();

      final SVNRevision revisionBefore;
      if (dateTo != null) {
        revisionBefore = SVNRevision.create(dateTo);
      } else if (changeTo != null) {
        revisionBefore = SVNRevision.create(changeTo.longValue());
      } else {
        SVNRepository repository = null;
        final long revision;
        try {
          repository = myVcs.createRepository(url);
          revision = repository.getLatestRevision();
        } finally {
          if (repository != null) {
            repository.closeSession();
          }
        }
        revisionBefore = SVNRevision.create(revision);
      }
      final SVNRevision revisionAfter;
      if (dateFrom != null) {
        revisionAfter = SVNRevision.create(dateFrom);
      } else if (changeFrom != null) {
        revisionAfter = SVNRevision.create(changeFrom.longValue());
      } else {
        revisionAfter = SVNRevision.create(1);
      }

      logger.doLog(
          SVNURL.parseURIEncoded(url),
          filterUrls,
          revisionBefore,
          revisionBefore,
          revisionAfter,
          settings.STOP_ON_COPY,
          true,
          includeMergedRevisions,
          maxCount,
          null,
          new ISVNLogEntryHandler() {
            public void handleLogEntry(SVNLogEntry logEntry) {
              if (myProject.isDisposed()) throw new ProcessCanceledException();
              if (progress != null) {
                progress.setText2(
                    SvnBundle.message(
                        "progress.text2.processing.revision", logEntry.getRevision()));
                progress.checkCanceled();
              }
              if (filterOutByDate && logEntry.getDate() == null) {
                // do not add lists without info - this situation is possible for lists where there
                // are paths that user has no rights to observe
                return;
              }
              if (author == null || author.equalsIgnoreCase(logEntry.getAuthor())) {
                resultConsumer.consume(logEntry);
              }
            }
          });
    } catch (SVNException e) {
      throw new VcsException(e);
    }
  }
  public void execute() {
    ApplicationManager.getApplication().saveAll();

    chanceToFillRoots();
    if (myRoots.length == 0) return;

    final List<Pair<VcsException, VirtualFile>> exceptions =
        new LinkedList<Pair<VcsException, VirtualFile>>();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);

    final Task.Backgroundable task =
        new Task.Backgroundable(
            myProject,
            SvnBundle.message(myTitleKey),
            true,
            BackgroundFromStartOption.getInstance()) {
          public void run(@NotNull final ProgressIndicator indicator) {
            indicator.setIndeterminate(true);
            VirtualFile currentRoot;
            for (VirtualFile root : myRoots) {
              currentRoot = root;
              try {
                final File path = new File(root.getPath());

                indicator.setText(
                    SvnBundle.message("action.Subversion.cleanup.progress.text", path));
                ISVNEventHandler handler =
                    new ISVNEventHandler() {
                      @Override
                      public void handleEvent(SVNEvent event, double progress)
                          throws SVNException {}

                      @Override
                      public void checkCancelled() throws SVNCancelException {
                        if (indicator.isCanceled()) throw new SVNCancelException();
                      }
                    };

                vcs.getFactory(path).createCleanupClient().cleanup(path, handler);
              } catch (VcsException ex) {
                exceptions.add(Pair.create(ex, currentRoot));
              }
            }
          }

          @Override
          public void onCancel() {
            onSuccess();
          }

          @Override
          public void onSuccess() {
            if (myProject.isDisposed()) {
              return;
            }
            final VcsDirtyScopeManager manager = VcsDirtyScopeManager.getInstance(myProject);
            ApplicationManager.getApplication()
                .invokeLater(
                    new Runnable() {
                      public void run() {
                        ApplicationManager.getApplication()
                            .runWriteAction(
                                new Runnable() {
                                  public void run() {
                                    if (myProject.isDisposed()) {
                                      return;
                                    }
                                    for (final VirtualFile root : myRoots) {
                                      root.refresh(false, true);
                                    }
                                  }
                                });
                      }
                    });
            for (final VirtualFile root : myRoots) {
              if (root.isDirectory()) {
                manager.dirDirtyRecursively(root);
              } else {
                manager.fileDirty(root);
              }
            }

            if (!exceptions.isEmpty()) {
              final List<VcsException> vcsExceptions = new LinkedList<VcsException>();
              for (Pair<VcsException, VirtualFile> pair : exceptions) {
                final VcsException exception = pair.first;
                vcsExceptions.add(
                    new VcsException(
                        SvnBundle.message(
                            "action.Subversion.cleanup.error.message",
                            FileUtil.toSystemDependentName(pair.second.getPath()),
                            ((exception == null) ? "" : exception.getMessage()))));
              }
              final AbstractVcsHelper helper = AbstractVcsHelper.getInstance(myProject);
              helper.showErrors(vcsExceptions, SvnBundle.message(myTitleKey));
            }
          }
        };

    ProgressManager.getInstance().run(task);
  }
  public void getCommittedChangesWithMergedRevisons(
      final ChangeBrowserSettings settings,
      final RepositoryLocation location,
      final int maxCount,
      final PairConsumer<SvnChangeList, TreeStructureNode<SVNLogEntry>> finalConsumer)
      throws VcsException {
    final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
    final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    if (progress != null) {
      progress.setText(SvnBundle.message("progress.text.changes.collecting.changes"));
      progress.setText2(
          SvnBundle.message("progress.text2.changes.establishing.connection", location));
    }

    final String repositoryRoot;
    SVNRepository repository = null;
    try {
      repository = myVcs.createRepository(svnLocation.getURL());
      repositoryRoot = repository.getRepositoryRoot(true).toString();
    } catch (SVNException e) {
      throw new VcsException(e);
    } finally {
      if (repository != null) {
        repository.closeSession();
      }
    }

    final MergeTrackerProxy proxy =
        new MergeTrackerProxy(
            new Consumer<TreeStructureNode<SVNLogEntry>>() {
              public void consume(TreeStructureNode<SVNLogEntry> node) {
                finalConsumer.consume(
                    new SvnChangeList(myVcs, svnLocation, node.getMe(), repositoryRoot), node);
              }
            });
    final SvnMergeSourceTracker mergeSourceTracker =
        new SvnMergeSourceTracker(
            new ThrowableConsumer<Pair<SVNLogEntry, Integer>, SVNException>() {
              public void consume(Pair<SVNLogEntry, Integer> svnLogEntryIntegerPair)
                  throws SVNException {
                proxy.consume(svnLogEntryIntegerPair);
              }
            });

    getCommittedChangesImpl(
        settings,
        svnLocation.getURL(),
        new String[] {""},
        maxCount,
        new Consumer<SVNLogEntry>() {
          public void consume(final SVNLogEntry svnLogEntry) {
            try {
              mergeSourceTracker.consume(svnLogEntry);
            } catch (SVNException e) {
              throw new RuntimeException(e);
              // will not occur actually but anyway never eat them
            }
          }
        },
        true,
        false);

    proxy.finish();
  }