private static CommitSelectionExpression RelativeCommitSelection( this CommitSelectionExpression parentExp, string revision, Func <CommitSelectionExpression, int, CommitSelectionExpression> numberFilter, Func <CommitSelectionExpression, BranchMask, CommitSelectionExpression> branchFilter) { if (revision == null) { return(parentExp); } var revisionData = ( from c in parentExp.Queryable <Commit>().Where(x => x.Revision == revision) join b in parentExp.Queryable <Branch>() on c.BranchId equals b.Id select new { Number = c.Number, Branch = b, }).SingleOrDefault(); if (revisionData == null) { return(parentExp.Reselect(c => c.Take(0))); } return(parentExp .Reselect(s => numberFilter(s, revisionData.Number)) .Reselect(s => branchFilter(s, revisionData.Branch.Mask))); }
public static CommitSelectionExpression AreRefactorings(this CommitSelectionExpression parentExp) { return(parentExp.Reselect(s => s.Where(commit => (from c in s join m in parentExp.Queryable <Modification>() on c.Number equals m.CommitNumber join cb in parentExp.Queryable <CodeBlock>() on m.Id equals cb.ModificationId where cb.TargetCodeBlock == null || cb.Size < 0 group cb.Size by c.Number) .Where(x => x.Sum() <= 0).Select(x => x.Key).Contains(commit.Number)))); }
public static CommitSelectionExpression HasAttribute( this CommitSelectionExpression parentExp, string attributeType) { return(parentExp.Reselect(s => (from c in s join ca in parentExp.Queryable <CommitAttribute>() .Where(x => x.Type == attributeType) on c.Number equals ca.CommitNumber select c).Distinct() )); }
public static CommitSelectionExpression TouchFiles(this CommitSelectionExpression parentExp) { return(parentExp.Reselect(s => ( from c in s join m in parentExp.Queryable <Modification>() on c.Number equals m.CommitNumber join f in parentExp.Selection <CodeFile>() on m.FileId equals f.Id select c ).Distinct() )); }
public static CommitSelectionExpression HasNotAttribute( this CommitSelectionExpression parentExp, string attributeType) { return(parentExp.Reselect(s => from c in s join ca in parentExp.Queryable <CommitAttribute>() .Where(x => x.Type == attributeType) on c.Number equals ca.CommitNumber into caGroup from caNullable in caGroup.DefaultIfEmpty() where caNullable == null select c )); }
public static CommitSelectionExpression OnBranchForward( this CommitSelectionExpression parentExp, BranchMask mask) { return(parentExp.Reselect(s => from c in s join br in parentExp.Queryable <Branch>() on c.BranchId equals br.Id let branch_bit_pos = mask.Data.Length + mask.Offset - 1 - br.Mask.Offset where (branch_bit_pos < 0) || (branch_bit_pos < br.Mask.Data.Length && br.Mask.Data.Substring(branch_bit_pos, 1) == "1") select c)); }