Java 类org.eclipse.jgit.lib.ReflogEntry 实例源码

项目:gerrit    文件:ReflogIT.java   
@Test
public void guessRestApiInReflog() throws Exception {
  assume().that(notesMigration.disableChangeReviewDb()).isTrue();
  PushOneCommit.Result r = createChange();
  Change.Id id = r.getChange().getId();

  try (Repository repo = repoManager.openRepository(r.getChange().project())) {
    File log = new File(repo.getDirectory(), "logs/" + changeMetaRef(id));
    if (!log.exists()) {
      log.getParentFile().mkdirs();
      assertThat(log.createNewFile()).isTrue();
    }

    gApi.changes().id(id.get()).topic("foo");
    ReflogEntry last = repo.getReflogReader(changeMetaRef(id)).getLastEntry();
    assertThat(last).named("last RefLogEntry").isNotNull();
    assertThat(last.getComment()).isEqualTo("change.PutTopic");
  }
}
项目:GitDirStat    文件:HistoryUpdate.java   
@Override
public boolean accept(ReflogEntry reflogEntry) {
    ObjectId newId = reflogEntry.getNewId();
    ObjectId oldId = reflogEntry.getOldId();

    boolean oldIdExpired = !expireCommits.contains(oldId);
    boolean newIdExpired = !expireCommits.contains(newId);

    boolean noIdExpired = !oldIdExpired || !newIdExpired;
    return noIdExpired;
}
项目:GitDirStat    文件:Ref.java   
public void addReflogEntries(List<ReflogEntry> reflogEntries)
        throws IOException {
    String refName = getName();
    ReflogWriter reflogWriter = getReflogWriter();
    for (ReflogEntry nonExpiredEntry : reflogEntries) {
        ObjectId oldId = nonExpiredEntry.getOldId();
        ObjectId newId = nonExpiredEntry.getNewId();
        PersonIdent ident = nonExpiredEntry.getWho();
        String message = nonExpiredEntry.getComment();
        reflogWriter.log(refName, oldId, newId, ident, message);
    }

}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public Void call() throws GitAPIException {
    checkCallable();

    List<Ref> refs = gitRepository.getRefs(Ref.class);

    List<Predicate<ReflogEntry>> refLogEntryFilterPredicates = new ArrayList<Predicate<ReflogEntry>>();

    refLogEntryFilterPredicates.add(expireDatePredicate);
    refLogEntryFilterPredicates.add(new ReflogEntryFilterPredicateAdapter(
            reflogEntryFilter));

    Predicate<ReflogEntry> refLogEntriesFilter = AllPredicate
            .allPredicate(refLogEntryFilterPredicates);

    try {
        for (Ref ref : refs) {
            List<ReflogEntry> reflogEntries = ref.getReflogEntries();

            Iterator<ReflogEntry> reflogEntryIterator = reflogEntries
                    .iterator();
            Iterator<ReflogEntry> filteredReflogEntryIterator = IteratorUtils
                    .filteredIterator(reflogEntryIterator,
                            refLogEntriesFilter);
            List<ReflogEntry> nonFilteredReflogEntries = IteratorUtils
                    .toList(filteredReflogEntryIterator);

            ref.clearReflog();
            ref.addReflogEntries(nonFilteredReflogEntries);
        }
    } catch (IOException e) {
        throw new GitAPIException("Unable to read reflog entries", e) {

            private static final long serialVersionUID = 2266798959465371684L;
        };
    }

    return null;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean evaluate(ReflogEntry reflogEntry) {
    PersonIdent who = reflogEntry.getWho();

    TimeZone timeZone = who.getTimeZone();
    Calendar reflogEntryCalendar = Calendar.getInstance(timeZone);
    Date when = who.getWhen();
    reflogEntryCalendar.setTime(when);

    boolean isNotExpired = reflogEntryCalendar.after(expireCalendar);
    return isNotExpired;
}
项目:gerrit    文件:GetReflog.java   
private ReflogEntryInfo newReflogEntryInfo(ReflogEntry e) {
  return new ReflogEntryInfo(
      e.getOldId().getName(),
      e.getNewId().getName(),
      CommonConverters.toGitPerson(e.getWho()),
      e.getComment());
}
项目:GitDirStat    文件:HistoryUpdate.java   
@Override
public boolean accept(ReflogEntry reflogEntry) {
    ObjectId newId = reflogEntry.getNewId();
    ObjectId oldId = reflogEntry.getOldId();

    boolean oldIdExpired = !expireCommits.contains(oldId);
    boolean newIdExpired = !expireCommits.contains(newId);

    boolean noIdExpired = !oldIdExpired || !newIdExpired;
    return noIdExpired;
}
项目:GitDirStat    文件:Ref.java   
public void addReflogEntries(List<ReflogEntry> reflogEntries)
        throws IOException {
    String refName = getName();
    ReflogWriter reflogWriter = getReflogWriter();
    for (ReflogEntry nonExpiredEntry : reflogEntries) {
        ObjectId oldId = nonExpiredEntry.getOldId();
        ObjectId newId = nonExpiredEntry.getNewId();
        PersonIdent ident = nonExpiredEntry.getWho();
        String message = nonExpiredEntry.getComment();
        reflogWriter.log(refName, oldId, newId, ident, message);
    }

}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public Void call() throws GitAPIException {
    checkCallable();

    List<Ref> refs = gitRepository.getRefs(Ref.class);

    List<Predicate<ReflogEntry>> refLogEntryFilterPredicates = new ArrayList<Predicate<ReflogEntry>>();

    refLogEntryFilterPredicates.add(expireDatePredicate);
    refLogEntryFilterPredicates.add(new ReflogEntryFilterPredicateAdapter(
            reflogEntryFilter));

    Predicate<ReflogEntry> refLogEntriesFilter = AllPredicate
            .allPredicate(refLogEntryFilterPredicates);

    try {
        for (Ref ref : refs) {
            List<ReflogEntry> reflogEntries = ref.getReflogEntries();

            Iterator<ReflogEntry> reflogEntryIterator = reflogEntries
                    .iterator();
            Iterator<ReflogEntry> filteredReflogEntryIterator = IteratorUtils
                    .filteredIterator(reflogEntryIterator,
                            refLogEntriesFilter);
            List<ReflogEntry> nonFilteredReflogEntries = IteratorUtils
                    .toList(filteredReflogEntryIterator);

            ref.clearReflog();
            ref.addReflogEntries(nonFilteredReflogEntries);
        }
    } catch (IOException e) {
        throw new GitAPIException("Unable to read reflog entries", e) {

            private static final long serialVersionUID = 2266798959465371684L;
        };
    }

    return null;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean evaluate(ReflogEntry reflogEntry) {
    PersonIdent who = reflogEntry.getWho();

    TimeZone timeZone = who.getTimeZone();
    Calendar reflogEntryCalendar = Calendar.getInstance(timeZone);
    Date when = who.getWhen();
    reflogEntryCalendar.setTime(when);

    boolean isNotExpired = reflogEntryCalendar.after(expireCalendar);
    return isNotExpired;
}
项目:jphp    文件:GitUtils.java   
public static ArrayMemory valueOf(ReflogEntry value) {
    ArrayMemory memory = new ArrayMemory();
    memory.refOfIndex("newId").assign(valueOf(value.getNewId()));
    memory.refOfIndex("oldId").assign(valueOf(value.getOldId()));
    memory.refOfIndex("who").assign(value.getWho() == null ? Memory.NULL : valueOf(value.getWho()));
    memory.refOfIndex("comment").assign(value.getComment());
    return memory;
}
项目:jphp    文件:GitUtils.java   
public static ArrayMemory valueOfReflogEntries(Iterable<ReflogEntry> values) {
    ArrayMemory memory = new ArrayMemory();

    for (ReflogEntry value : values) {
        memory.add(valueOf(value));
    }

    return memory;
}
项目:GitDirStat    文件:Ref.java   
public List<ReflogEntry> getReflogEntries() throws IOException {
    Repository repo = gitRepository.getRepository();
    ReflogReader reflogReader = repo.getReflogReader(getName());
    List<ReflogEntry> reverseEntries = reflogReader.getReverseEntries();
    return reverseEntries;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean accept(ReflogEntry reflogEntry) {
    return true;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean evaluate(ReflogEntry reflogEntry) {
    return reflogEntryFilter.accept(reflogEntry);
}
项目:GitDirStat    文件:Ref.java   
public List<ReflogEntry> getReflogEntries() throws IOException {
    Repository repo = gitRepository.getRepository();
    ReflogReader reflogReader = repo.getReflogReader(getName());
    List<ReflogEntry> reverseEntries = reflogReader.getReverseEntries();
    return reverseEntries;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean accept(ReflogEntry reflogEntry) {
    return true;
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
@Override
public boolean evaluate(ReflogEntry reflogEntry) {
    return reflogEntryFilter.accept(reflogEntry);
}
项目:GitDirStat    文件:ExpireReflogCommand.java   
public boolean accept(ReflogEntry reflogEntry);
项目:GitDirStat    文件:ExpireReflogCommand.java   
public boolean accept(ReflogEntry reflogEntry);