Beispiel #1
0
  /**
   * Create a hive instance at the specified file location.
   *
   * @param location file to (bare) git directory where the hive is located
   * @param create flag to create the hive, or open an exisiting hive
   */
  public Hive(final File location, final boolean create) {
    try {
      branchName = "refs/heads/swarmdb";
      repository = new Repository(location);
      if (create) {
        repository.create();
        createVersionInfo();
        repository.writeSymref(Constants.HEAD, branchName);
      }
      // TODO: check version compatibility

    } catch (final Exception e) {
      throw new SwarmdbException(
          "Unable to create git repository at " + location.getAbsolutePath(), e);
    }
  }