Examples of IpLogGenerator


Examples of org.eclipse.jgit.iplog.IpLogGenerator

  @Override
  protected void run() throws Exception {
    if (CookieHandler.getDefault() == null)
      CookieHandler.setDefault(new SimpleCookieManager());

    final IpLogGenerator log = new IpLogGenerator();

    if (commitId == null) {
      System.err.println(MessageFormat.format(
        CLIText.get().warningNoCommitGivenOnCommandLine, Constants.HEAD));
      commitId = db.resolve(Constants.HEAD);
    }

    final RevWalk rw = new RevWalk(db);
    final RevObject start = rw.parseAny(commitId);
    if (version == null && start instanceof RevTag)
      version = ((RevTag) start).getTagName();
    else if (version == null)
      throw die(MessageFormat.format(CLIText.get().notATagVersionIsRequired, start.name()));

    log.scan(db, rw.parseCommit(start), version);

    if (output != null) {
      if (!output.getParentFile().exists())
        output.getParentFile().mkdirs();
      LockFile lf = new LockFile(output, db.getFS());
      if (!lf.lock())
        throw die(MessageFormat.format(CLIText.get().cannotLock, output));
      try {
        OutputStream os = lf.getOutputStream();
        try {
          log.writeTo(os);
        } finally {
          os.close();
        }
        if (!lf.commit())
          throw die(MessageFormat.format(CLIText.get().cannotWrite, output));
      } finally {
        lf.unlock();
      }
    } else {
      log.writeTo(System.out);
      System.out.flush();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.