Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.LogCommand


  public void reword() throws Exception {
    RewordCommitOperation op = new RewordCommitOperation(
        testRepository.getRepository(), commit, "new message");
    op.execute(new NullProgressMonitor());

    LogCommand log = new Git(testRepository.getRepository()).log();
    RevCommit newCommit = log.call().iterator().next();
    assertEquals("new message", newCommit.getFullMessage());
  }
View Full Code Here


        FastForwardMode.Merge.valueOf(ffMode));
    config.save();
  }

  private int countCommitsInHead() throws GitAPIException {
    LogCommand log = new Git(testRepository.getRepository()).log();
    Iterable<RevCommit> commits = log.call();
    int result = 0;
    for (Iterator i = commits.iterator(); i.hasNext();) {
      i.next();
      result++;
    }
View Full Code Here

        final List<VersionRecord> records = new ArrayList<VersionRecord>();

        if ( id != null ) {
            try {
                final LogCommand logCommand = fs.gitRepo().log().add( id );
                if ( !gPath.isEmpty() ) {
                    logCommand.addPath( gPath );
                }

                for ( final RevCommit commit : logCommand.call() ) {

                    records.add( new VersionRecord() {
                        @Override
                        public String id() {
                            return commit.name();
View Full Code Here

            @Override
            public FileTime lastModifiedTime() {
                if ( lastModifiedDate == -1L ) {
                    RevWalk revWalk = null;
                    try {
                        final LogCommand logCommand = fs.gitRepo().log().add( id ).setMaxCount( 1 );
                        if ( !gPath.isEmpty() ) {
                            logCommand.addPath( gPath );
                        }
                        revWalk = (RevWalk) logCommand.call();
                        lastModifiedDate = revWalk.iterator().next().getCommitterIdent().getWhen().getTime();
                    } catch ( Exception ex ) {
                        lastModifiedDate = 0;
                    } finally {
                        if ( revWalk != null ) {
                            revWalk.dispose();
                        }
                    }
                }
                return new FileTimeImpl( lastModifiedDate );
            }

            @Override
            public FileTime lastAccessTime() {
                return null;
            }

            @Override
            public FileTime creationTime() {
                if ( creationDate == -1L ) {
                    RevWalk revWalk = null;
                    try {
                        final LogCommand logCommand = fs.gitRepo().log().add( id ).setMaxCount( 1 );
                        if ( !gPath.isEmpty() ) {
                            logCommand.addPath( gPath );
                        }
                        revWalk = (RevWalk) logCommand.call();
                        creationDate = revWalk.iterator().next().getCommitterIdent().getWhen().getTime();
                    } catch ( Exception ex ) {
                        creationDate = 0;
                    } finally {
                        if ( revWalk != null ) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.LogCommand

Copyright © 2018 www.massapicom. 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.