public void LinkAst() { int i = 0; var nextVersionEdges = this.neo4jwrapp.FindAllEdgesBetweenTypes <File, NextFileVersion, File>(); double count = nextVersionEdges.Count(); foreach (var e in nextVersionEdges) { this.FireProgressChanged(i++ / count); if (this.neo4jwrapp.FindAllEdgesBetweenNodes <File, WithAstTransition, File>(e.From, e.To).Any()) { continue; } var fromContent = GetRaw(e.From.Commit, e.From.Path); var toContent = GetRaw(e.To.Commit, e.To.Path); var transitions = GumTreeWrapper.Compare2(fromContent, toContent); int triedCount = 0; while (transitions == null && triedCount < 3) { try { var foo = GumTreeWrapper.Compare2(fromContent, toContent); } catch (Exception) { triedCount++; FireStatusChanged("Could not compare with GumTree ... Try again. "); } } foreach (var transitionEdge in transitions) { if (String.Compare(transitionEdge.Mode, "Keep") == 0) { this.neo4jwrapp.AddTransitionEdge(e.From.Commit, e.From.Path, transitionEdge.From, e.To.Commit, e.To.Path, transitionEdge.To, new NoCodeModification(this.neo4jwrapp)); continue; } if (String.Compare(transitionEdge.Mode, "Insert") == 0) { this.neo4jwrapp.AddLabel(new AstElement() { CommitSha = e.From.Commit, FilePath = e.From.Path, AstId = transitionEdge.From }, BaseNode.ContainsFile); continue; } if (String.Compare(transitionEdge.Mode, "Modified") == 0) { this.neo4jwrapp.AddTransitionEdge(e.From.Commit, e.From.Path, transitionEdge.From, e.To.Commit, e.To.Path, transitionEdge.To, new ModifiedCode(this.neo4jwrapp)); continue; } if (String.Compare(transitionEdge.Mode, "Delete") == 0) { this.neo4jwrapp.AddTransitionEdge(e.From.Commit, e.From.Path, transitionEdge.From, new AstElementDeleted() { CommitSha = e.To.Commit, FilePath = e.To.Path }, new CodeRemoved(this.neo4jwrapp)); continue; } throw new NotImplementedException("Missing Ast Transition for " + transitionEdge.Mode); } this.neo4jwrapp.WriteEdge(e.From, e.To, new WithAstTransition(this.neo4jwrapp)); } this.neo4jwrapp.PropagadeModifictionAttribute(); this.FireProgressChanged(-1); }