示例#1
0
 public void appendCommits(
     @NotNull List<CommitParents> commitParentsList, @NotNull Executor<String> statusUpdater) {
   statusUpdater.execute("Rebuild graph and print model");
   MyTimer timer = new MyTimer("append commits");
   graphModel.appendCommitsToGraph(commitParentsList);
   timer.print();
 }
示例#2
0
  public static DataPackImpl buildDataPack(
      @NotNull List<CommitParents> commitParentsList,
      @NotNull List<Ref> allRefs,
      Executor<String> statusUpdater) {
    statusUpdater.execute("Build graph");

    MyTimer timer = new MyTimer("graph build");
    MutableGraph graph = GraphBuilder.build(commitParentsList);
    timer.print();

    timer.clear("graphModel build");
    GraphModel graphModel = new GraphModelImpl(graph);
    timer.print();

    statusUpdater.execute("Build print model");
    timer.clear("build printModel");
    final GraphPrintCellModel printCellModel = new GraphPrintCellModelImpl(graphModel.getGraph());
    timer.print();
    graphModel.addUpdateListener(
        new Executor<UpdateRequest>() {
          @Override
          public void execute(UpdateRequest key) {
            printCellModel.recalculate(key);
          }
        });

    final RefsModel refsModel = new RefsModel(allRefs);
    graphModel
        .getFragmentManager()
        .setUnconcealedNodeFunction(
            new Function<Node, Boolean>() {
              @NotNull
              @Override
              public Boolean get(@NotNull Node key) {
                if (key.getDownEdges().isEmpty()
                    || key.getUpEdges().isEmpty()
                    || refsModel.isBranchRef(key.getCommitHash())) {
                  return true;
                } else {
                  return false;
                }
              }
            });
    return new DataPackImpl(graphModel, refsModel, printCellModel);
  }