@Override
    protected void preliminary() throws SVNException {
      SVNWCClient wcClient = myVcs.createWCClient();
      myInfo =
          wcClient.doInfo(new File(myFile.getIOFile().getAbsolutePath()), SVNRevision.UNDEFINED);
      wcClient.setEventHandler(
          new ISVNEventHandler() {
            public void handleEvent(SVNEvent event, double progress) throws SVNException {}

            public void checkCancelled() throws SVNCancelException {
              myPI.checkCanceled();
            }
          });
      if (myInfo == null || myInfo.getRepositoryRootURL() == null) {
        myException =
            new VcsException("File ''{0}'' is not under version control" + myFile.getIOFile());
        return;
      }
      if (myInfo.getURL() == null) {
        myException =
            new VcsException("File " + myFile.getPath() + " is not under Subversion control");
        return;
      }
      myUrl = myInfo.getURL().toString();
    }
예제 #2
0
 public SVNWCClient createWCClient() {
   final SVNWCClient client = new SVNWCClient(getPool(), myConfiguration.getOptions(myProject));
   client
       .getOperationsFactory()
       .setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
   return client;
 }
예제 #3
0
 public SVNInfo getInfo(File ioFile) {
   try {
     SVNWCClient wcClient = createWCClient();
     SVNInfo info = wcClient.doInfo(ioFile, SVNRevision.UNDEFINED);
     if (info == null || info.getRepositoryRootURL() == null) {
       info = wcClient.doInfo(ioFile, SVNRevision.HEAD);
     }
     return info;
   } catch (SVNException e) {
     return null;
   }
 }
  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()));
  }
 @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;
   }
 }
 @Nullable
 private VcsRevisionNumber getCurrentRevision(FilePath file) {
   if (file.isNonLocal()) {
     // technically, it does not make sense, since there's no "current" revision for non-local
     // history (if look how it's used)
     // but ok, lets keep it for now
     return new SvnRevisionNumber(SVNRevision.HEAD);
   }
   try {
     SVNWCClient wcClient = myVcs.createWCClient();
     SVNInfo info =
         wcClient.doInfo(new File(file.getPath()).getAbsoluteFile(), SVNRevision.UNDEFINED);
     if (info != null) {
       return new SvnRevisionNumber(info.getRevision());
     } else {
       return null;
     }
   } catch (SVNException e) {
     return null;
   }
 }
 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()));
 }