/** passed dir must be under VC control (it is assumed) */
 @Nullable
 public String getRepositoryUUID(final Project project, final VirtualFile dir) {
   try {
     final SVNInfo info1 =
         new RepeatSvnActionThroughBusy() {
           @Override
           protected void executeImpl() throws SVNException {
             myT = myVcs.getInfo(new File(dir.getPath()));
           }
         }.compute();
     if (info1 == null || info1.getRepositoryUUID() == null) {
       // go deeper if current parent was added (if parent was added, it theoretically could NOT
       // know its repo UUID)
       final VirtualFile parent = dir.getParent();
       if (parent == null) {
         return null;
       }
       if (isPendingAdd(project, parent)) {
         return getRepositoryUUID(project, parent);
       }
     } else {
       return info1.getRepositoryUUID();
     }
   } catch (SVNException e) {
     // go to return default
   }
   return null;
 }
示例#2
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 fillMapping(final SvnMapping mapping, final List<SvnCopyRootSimple> list) {
    final LocalFileSystem lfs = LocalFileSystem.getInstance();

    for (SvnCopyRootSimple simple : list) {
      final VirtualFile copyRoot = lfs.findFileByIoFile(new File(simple.myCopyRoot));
      final VirtualFile vcsRoot = lfs.findFileByIoFile(new File(simple.myVcsRoot));

      if (copyRoot == null || vcsRoot == null) continue;

      final SvnVcs vcs = SvnVcs.getInstance(myProject);
      final SVNInfo svnInfo = vcs.getInfo(copyRoot);
      if ((svnInfo == null) || (svnInfo.getRepositoryRootURL() == null)) continue;

      final RootUrlInfo info =
          new RootUrlInfo(
              svnInfo.getRepositoryRootURL(),
              svnInfo.getURL(),
              SvnFormatSelector.getWorkingCopyFormat(svnInfo.getFile()),
              copyRoot,
              vcsRoot);
      mapping.add(info);
    }
  }