コード例 #1
0
ファイル: SvnRemoteList.java プロジェクト: centic9/svnkit
 private void listExternalItems(
     SVNRepository repository,
     SVNExternal[] externalItems,
     SVNURL externalParentUrl,
     SVNDepth depth,
     int entryFields,
     boolean fetchLocks,
     ISVNDirEntryHandler handler)
     throws SVNException {
   SVNURL rootUrl = repository.getRepositoryRoot(true);
   for (SVNExternal externalItem : externalItems) {
     SVNURL resolvedURL = externalItem.resolveURL(rootUrl, externalParentUrl);
     try {
       // TODO: peg revision
       repository.setLocation(resolvedURL, true);
       doList(
           repository,
           externalItem.getRevision().getNumber(),
           handler,
           fetchLocks,
           depth,
           entryFields,
           externalParentUrl,
           externalItem.getPath());
     } catch (SVNException e) {
       if (e.getErrorMessage().getErrorCode() != SVNErrorCode.CANCELLED) {
         SVNEvent event =
             SVNEventFactory.createSVNEvent(
                 new File(externalItem.getPath()),
                 SVNNodeKind.UNKNOWN,
                 null,
                 -1,
                 SVNEventAction.FAILED_EXTERNAL,
                 SVNEventAction.FAILED_EXTERNAL,
                 e.getErrorMessage(),
                 null);
         getOperation().getEventHandler().handleEvent(event, UNKNOWN);
       } else {
         throw e;
       }
     }
   }
 }
コード例 #2
0
  private static void upgradeExternals(SVNSqlJetDb sDb, File wcRootAbsPath) throws SVNException {
    SVNSqlJetStatement stmt = sDb.getStatement(SVNWCDbStatements.SELECT_EXTERNAL_PROPERTIES);
    SVNSqlJetStatement addStmt = sDb.getStatement(SVNWCDbStatements.INSERT_EXTERNAL);

    /* ### For this intermediate upgrade we just assume WC_ID = 1.
    ### Before this bump we lost track of externals all the time, so lets keep this easy. */
    stmt.bindf("is", 1, "");
    try {
      while (stmt.next()) {
        SVNProperties props = stmt.getColumnProperties(SVNWCDbSchema.NODES__Fields.properties);
        String externalsValues = props.getStringValue(SVNProperty.EXTERNALS);
        File localRelPath =
            SVNFileUtil.createFilePath(
                stmt.getColumnString(SVNWCDbSchema.NODES__Fields.properties));
        File localAbsPath = SVNFileUtil.createFilePath(wcRootAbsPath, localRelPath);

        if (externalsValues != null) {
          SVNExternal[] externalDefs = SVNExternal.parseExternals(localAbsPath, externalsValues);
          for (SVNExternal externalDef : externalDefs) {
            File externalPath = SVNFileUtil.createFilePath(localAbsPath, externalDef.getPath());

            /* Insert dummy externals definitions: Insert an unknown external, to make sure it will be cleaned up when it is not
            updated on the next update. */
            addStmt.bindf(
                "isssssis",
                1, /* wc_id*/
                SVNFileUtil.getFilePath(externalPath),
                SVNFileUtil.getFilePath(SVNFileUtil.getFileDir(externalPath)),
                "normal",
                "unknown",
                SVNFileUtil.getFilePath(localRelPath),
                1, /* repos_id */
                "" /* repos_relpath */);
            addStmt.exec();
          }
        }
      }
    } finally {
      stmt.reset();
    }
  }
コード例 #3
0
ファイル: SvnRemoteList.java プロジェクト: centic9/svnkit
  private void listExternals(
      SVNRepository repository,
      Map<SVNURL, SVNPropertyValue> externals,
      SVNDepth depth,
      int entryFields,
      boolean fetchLocks,
      ISVNDirEntryHandler handler)
      throws SVNException {
    for (Map.Entry<SVNURL, SVNPropertyValue> entry : externals.entrySet()) {
      SVNURL externalParentUrl = entry.getKey();
      SVNPropertyValue externalValue = entry.getValue();

      SVNExternal[] externalItems =
          SVNExternal.parseExternals(
              externalParentUrl, SVNPropertyValue.getPropertyAsString(externalValue));
      if (externalItems == null || externalItems.length == 0) {
        continue;
      }
      listExternalItems(
          repository, externalItems, externalParentUrl, depth, entryFields, fetchLocks, handler);
    }
  }