org.eclipse.jgit.lib.Repository.toString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.eclipse.jgit.lib.Repository.toString方法的一些代码示例,展示了Repository.toString的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.toString方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:toString

Repository.toString介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * {@inheritDoc}
 * <p>
 * Decrement the use count, and maybe close resources.
 */
@Override
public void close() {
  int newCount = useCnt.decrementAndGet();
  if (newCount == 0) {
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    } else {
      doClose();
    }
  } else if (newCount == -1) {
    // should not happen, only log when useCnt became negative to
    // minimize number of log entries
    String message = MessageFormat.format(JGitText.get().corruptUseCnt,
        toString());
    if (LOG.isDebugEnabled()) {
      LOG.debug(message, new IllegalStateException());
    } else {
      LOG.warn(message);
    }
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    }
  }
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public String getRepoRelativePath(){
  /*
  String rel_path = null;
  Collection<SVNDirEntry> SVNentry = this.rootRepo.getDir("tags/", -1, null,(Collection<SVNDirEntry>) null);
  Iterator<SVNDirEntry> iterator = SVNentry.iterator();
  if (iterator.hasNext()) {
    SVNDirEntry entry = (SVNDirEntry) iterator.next();
    // remove the root repository part from the whole url (object: SVNDirEntry)
    rel_path = entry.getURL().toString().replaceAll(entry.getRepositoryRoot().toString(), "");
  }else{
    SvnClient.log.error("[Error] while getting the relative path for tag directory");
  }
  rel_path = rel_path.substring(0, rel_path.lastIndexOf('/'));
  return rel_path;
   */
  //TODO: To be tested
  return url.toString().replace(repository.toString(), "");
}

代码示例来源:origin: com.madgag/org.eclipse.jgit.pgm

private String repoName() {
    final File gitDir = db.getDirectory();
    if (gitDir == null)
      return db.toString();
    String n = gitDir.getName();
    if (Constants.DOT_GIT.equals(n))
      n = gitDir.getParentFile().getName();
    return n;
  }
}

代码示例来源:origin: berlam/github-bucket

/**
 * {@inheritDoc}
 * <p>
 * Decrement the use count, and maybe close resources.
 */
@Override
public void close() {
  int newCount = useCnt.decrementAndGet();
  if (newCount == 0) {
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    } else {
      doClose();
    }
  } else if (newCount == -1) {
    // should not happen, only log when useCnt became negative to
    // minimize number of log entries
    String message = MessageFormat.format(JGitText.get().corruptUseCnt,
        toString());
    if (LOG.isDebugEnabled()) {
      LOG.debug(message, new IllegalStateException());
    } else {
      LOG.warn(message);
    }
    if (RepositoryCache.isCached(this)) {
      closedAt.set(System.currentTimeMillis());
    }
  }
}

代码示例来源:origin: bozaro/git-as-svn

} finally {
 final long endTime = System.currentTimeMillis();
 log.info("{} hook for repository {} took {}ms", hook, repository.toString(), (endTime - startTime));

代码示例来源:origin: org.apache.stratos/org.apache.stratos.cartridge.agent

public static boolean addRemote(Repository repository, String remoteUrl) {
  boolean remoteAdded = false;
  StoredConfig config = repository.getConfig();
  config.setString(GitDeploymentSynchronizerConstants.REMOTE,
      GitDeploymentSynchronizerConstants.ORIGIN,
      GitDeploymentSynchronizerConstants.URL,
      remoteUrl);
  config.setString(GitDeploymentSynchronizerConstants.REMOTE,
      GitDeploymentSynchronizerConstants.ORIGIN,
      GitDeploymentSynchronizerConstants.FETCH,
      GitDeploymentSynchronizerConstants.FETCH_LOCATION);
  config.setString(GitDeploymentSynchronizerConstants.BRANCH,
      GitDeploymentSynchronizerConstants.MASTER,
      GitDeploymentSynchronizerConstants.REMOTE,
      GitDeploymentSynchronizerConstants.ORIGIN);
  config.setString(GitDeploymentSynchronizerConstants.BRANCH,
      GitDeploymentSynchronizerConstants.MASTER,
      GitDeploymentSynchronizerConstants.MERGE,
      GitDeploymentSynchronizerConstants.GIT_REFS_HEADS_MASTER);
  try {
    config.save();
    remoteAdded = true;
  } catch (IOException e) {
    log.error("Error in adding remote origin " + remoteUrl + " for local repository " +
        repository.toString(), e);
  }
  return remoteAdded;
}

相关文章

微信公众号

最新文章

更多

Repository类方法