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

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

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

Repository.getIndexFile介绍

[英]Get the index file location or null if repository isn't local.
[中]获取索引文件位置,如果存储库不是本地的,则为null。

代码示例

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

/**
 * Create a new in-core index representation and read an index from disk.
 * <p>
 * The new index will be read before it is returned to the caller. Read
 * failures are reported as exceptions and therefore prevent the method from
 * returning a partially populated index.
 *
 * @param repository
 *            repository containing the index to read
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws java.io.IOException
 *             the index file is present but could not be read.
 * @throws org.eclipse.jgit.errors.CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 */
public static DirCache read(Repository repository)
    throws CorruptObjectException, IOException {
  final DirCache c = read(repository.getIndexFile(), repository.getFS());
  c.repository = repository;
  return c;
}

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

/**
 * Create a new in-core index representation, lock it, and read from disk.
 * <p>
 * The new index will be locked and then read before it is returned to the
 * caller. Read failures are reported as exceptions and therefore prevent
 * the method from returning a partially populated index. On read failure,
 * the lock is released.
 *
 * @param repository
 *            repository containing the index to lock and read
 * @param indexChangedListener
 *            listener to be informed when DirCache is committed
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws java.io.IOException
 *             the index file is present but could not be read, or the lock
 *             could not be obtained.
 * @throws org.eclipse.jgit.errors.CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 * @since 2.0
 */
public static DirCache lock(final Repository repository,
    final IndexChangedListener indexChangedListener)
    throws CorruptObjectException, IOException {
  DirCache c = lock(repository.getIndexFile(), repository.getFS(),
      indexChangedListener);
  c.repository = repository;
  return c;
}

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

/**
 * Create a new in-core index representation and read an index from disk.
 * <p>
 * The new index will be read before it is returned to the caller. Read
 * failures are reported as exceptions and therefore prevent the method from
 * returning a partially populated index.
 *
 * @param repository
 *            repository containing the index to read
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws IOException
 *             the index file is present but could not be read.
 * @throws CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 */
public static DirCache read(final Repository repository)
    throws CorruptObjectException, IOException {
  final DirCache c = read(repository.getIndexFile(), repository.getFS());
  c.repository = repository;
  return c;
}

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

/**
 * Create a new in-core index representation and read an index from disk.
 * <p>
 * The new index will be read before it is returned to the caller. Read
 * failures are reported as exceptions and therefore prevent the method from
 * returning a partially populated index.
 *
 * @param repository
 *            repository containing the index to read
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws java.io.IOException
 *             the index file is present but could not be read.
 * @throws org.eclipse.jgit.errors.CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 */
public static DirCache read(Repository repository)
    throws CorruptObjectException, IOException {
  final DirCache c = read(repository.getIndexFile(), repository.getFS());
  c.repository = repository;
  return c;
}

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

/**
 * Create a new in-core index representation, lock it, and read from disk.
 * <p>
 * The new index will be locked and then read before it is returned to the
 * caller. Read failures are reported as exceptions and therefore prevent
 * the method from returning a partially populated index. On read failure,
 * the lock is released.
 *
 * @param repository
 *            repository containing the index to lock and read
 * @param indexChangedListener
 *            listener to be informed when DirCache is committed
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws java.io.IOException
 *             the index file is present but could not be read, or the lock
 *             could not be obtained.
 * @throws org.eclipse.jgit.errors.CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 * @since 2.0
 */
public static DirCache lock(final Repository repository,
    final IndexChangedListener indexChangedListener)
    throws CorruptObjectException, IOException {
  DirCache c = lock(repository.getIndexFile(), repository.getFS(),
      indexChangedListener);
  c.repository = repository;
  return c;
}

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

/**
 * Create a new in-core index representation, lock it, and read from disk.
 * <p>
 * The new index will be locked and then read before it is returned to the
 * caller. Read failures are reported as exceptions and therefore prevent
 * the method from returning a partially populated index. On read failure,
 * the lock is released.
 *
 * @param repository
 *            repository containing the index to lock and read
 * @param indexChangedListener
 *            listener to be informed when DirCache is committed
 * @return a cache representing the contents of the specified index file (if
 *         it exists) or an empty cache if the file does not exist.
 * @throws IOException
 *             the index file is present but could not be read, or the lock
 *             could not be obtained.
 * @throws CorruptObjectException
 *             the index file is using a format or extension that this
 *             library does not support.
 * @since 2.0
 */
public static DirCache lock(final Repository repository,
    final IndexChangedListener indexChangedListener)
    throws CorruptObjectException, IOException {
  DirCache c = lock(repository.getIndexFile(), repository.getFS(),
      indexChangedListener);
  c.repository = repository;
  return c;
}

代码示例来源:origin: io.fabric8/fabric-git

@Activate
@VisibleForExternal
public void activate(Map<String, ?> configuration) throws Exception {
  LockFile.unlock(getGit().getRepository().getIndexFile());
  configurer.configure(configuration, this);
  // Remove non-String values from the configuration
  Map<String, String> properties = new HashMap<>();
  for (Map.Entry<String, ?> entry : configuration.entrySet()) {
    String key = entry.getKey();
    Object value = entry.getValue();
    if (value instanceof String) {
      properties.put(key, (String) value);
    }
  }
  this.dataStoreProperties = Collections.unmodifiableMap(properties);
  this.pullPushPolicy = new DefaultPullPushPolicy(getGit(), GitHelpers.REMOTE_ORIGIN, gitTimeout);
  // DataStore activation accesses public API that is private by {@link AbstractComponent#assertValid()).
  // We activate the component first and rollback on error
  try {
    activateComponent();
    activateInternal();
  } catch (Exception ex) {
    deactivateComponent();
    throw ex;
  }
}

代码示例来源:origin: jboss-fuse/fabric8

return;
LockFile.unlock(getGit().getRepository().getIndexFile());
configurer.configure(configuration, this);

相关文章

Repository类方法