/// <summary> /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'CommitRelations'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet<T>'. /// </summary> public void AddToCommitRelations(CommitRelation commitRelation) { base.AddObject("CommitRelations", commitRelation); }
/// <summary> /// Erstellt ein neues CommitRelation-Objekt. /// </summary> /// <param name="parentCommit">Anfangswert der Eigenschaft ParentCommit.</param> /// <param name="childCommit">Anfangswert der Eigenschaft ChildCommit.</param> public static CommitRelation CreateCommitRelation(global::System.Int32 parentCommit, global::System.Int32 childCommit) { CommitRelation commitRelation = new CommitRelation(); commitRelation.ParentCommit = parentCommit; commitRelation.ChildCommit = childCommit; return commitRelation; }
int? FinishImportCommit(LibGit2Sharp.Commit gitCommit, List<int> parentCommits) { string commitHash = gitCommit.Sha; var commit = new DataAccess.Collector.Commit(); commit.Hash = commitHash; commit.CommitDate = gitCommit.Committer.When.UtcDateTime; db.Context.Commits.AddObject(commit); db.Context.SaveChanges(); Debug.WriteLine("Imported commit " + commitHash + " as " + commit.Id); // Fix existing sessions referencing this commit: int? svnRevision = null; if (EnableGitSvnImport) { foreach (string messageLine in gitCommit.Message.Split('\n', '\r')) { Match m = gitSvnRegex.Match(messageLine); if (m.Success) { // determine SVN revision numbers for commits imported from SVN svnRevision = int.Parse(m.Groups[1].Value); break; } } } if (svnRevision != null) { svnRevisionToCommitIdMapping[svnRevision.Value] = commit.Id; } else { var sessionsThatNeedUpdate = from s in db.Context.Sessions join ed in db.Context.EnvironmentDatas on s.Id equals ed.SessionId join edn in db.Context.EnvironmentDataNames on ed.EnvironmentDataNameId equals edn.Id join edv in db.Context.EnvironmentDataValues on ed.EnvironmentDataValueId equals edv.Id where edn.Name == "commit" && edv.Name == commitHash select s; int updatedSessionsCount = 0; foreach (var session in sessionsThatNeedUpdate) { session.CommitId = commit.Id; updatedSessionsCount++; } if (updatedSessionsCount > 0) Debug.WriteLine("Updated " + updatedSessionsCount + " sessions referencing this commit"); } // Now create the relation to the parent commits: foreach (int parentCommit in parentCommits) { CommitRelation r = new CommitRelation(); r.ParentCommit = parentCommit; r.ChildCommit = commit.Id; db.Context.CommitRelations.AddObject(r); } db.Context.SaveChanges(); return commit.Id; }