public static VcsDataMapper ConstructDataMapper( IDataStore data, IVcsData vcsData, MappingSettings settings) { VcsDataMapper dataMapper = new VcsDataMapper(data, vcsData, settings); dataMapper.RegisterMapper(new CommitMapper(vcsData)); dataMapper.RegisterMapper(new TagMapper(vcsData)); var bugFixDetector = new BugFixDetectorBasedOnLogMessage(); if (settings.FixMessageKeyWords != null) { bugFixDetector.KeyWords = settings.FixMessageKeyWords.Split(' '); } if (settings.FixMessageStopWords != null) { bugFixDetector.StopWords = settings.FixMessageStopWords.Split(' '); } dataMapper.RegisterMapper(new BugFixMapper(vcsData, bugFixDetector)); dataMapper.RegisterMapper(new CommitAttributeMapper(vcsData)); dataMapper.RegisterMapper(new AuthorMapper(vcsData)); dataMapper.RegisterMapper(new BranchMapper(vcsData)); dataMapper.RegisterMapper(new CodeFileMapper(vcsData) { FastMergeProcessing = settings.FastMergeProcessing }); dataMapper.RegisterMapper(new ModificationMapper(vcsData)); dataMapper.RegisterMapper(new BlamePreLoader(vcsData), true); dataMapper.RegisterMapper(new CodeBlockMapper(vcsData)); return(dataMapper); }
static VcsDataMapper ConstructDataMapper( IDataStore data, IVcsData vcsData, VcsDataMapper.MappingSettings settings) { var dataMapper = VcsDataMapper.ConstructDataMapper( data, vcsData, settings); dataMapper.OnMapRevision += revision => { Console.WriteLine("mapping of revision {0}", revision); }; dataMapper.OnTruncateRevision += revision => { Console.WriteLine("truncating of revision {0}", revision); }; dataMapper.OnCheckRevision += revision => { Console.WriteLine("checking of revision {0}", revision); }; dataMapper.OnError += message => { Console.WriteLine(message); }; return(dataMapper); }
public VcsDataMapper( IDataStore data, IVcsData vcsData, MappingSettings settings) { this.data = data; this.vcsData = vcsData; this.settings = settings; }
static void BlameDiff(IVcsData vcsData) { var r0 = "41f93a2c903a45167b26c2dc93d45ffa9a9bbd49"; var r1 = "c2f3bf071ee90b01f2d629921bb04c4f798f02fa"; var file = "/test-delta.c"; var blame0 = vcsData.Blame(r0, file); var blame1 = vcsData.Blame(r1, file); var diff01 = blame0.Diff(blame1); Console.WriteLine(); }
static void FileHistory(IDataStore data, IVcsData vcsData, string path) { using (var s = data.OpenSession()) { var modifications = (from f in s.GetReadOnly <CodeFile>() join m in s.GetReadOnly <Modification>() on f.Id equals m.FileId join c in s.GetReadOnly <Commit>() on m.CommitNumber equals c.Number join cb in s.GetReadOnly <CodeBlock>() on m.Id equals cb.ModificationId where f.Path == path group cb by new { m.Action, c.Revision, c.Number, c.Date } into modCode select new { Action = modCode.Key.Action, Revision = modCode.Key.Revision, Number = modCode.Key.Number, Date = modCode.Key.Date, Added = modCode.Sum( x => x.TargetCodeBlockId == null ? x.Size : 0), Removed = modCode.Sum( x => x.Size < 0 ? x.Size : 0), Compensated = modCode.Sum( x => (x.TargetCodeBlockId != null && x.Size > 0) ? x.Size : 0), }).ToArray(); Console.WriteLine(path); foreach (var m in modifications.OrderByDescending(x => x.Number)) { var linesCount = (m.Action == TouchedFileAction.REMOVED) ? 0 : vcsData.Blame(m.Revision, path).Values.Sum(); Console.WriteLine(string.Format("{0} ({1}) {2} {3} +{4} -{5} +{6} loc: {7}", m.Revision, m.Number, m.Date.ToShortDateString(), m.Action, m.Added, Math.Abs(m.Removed), m.Compensated, linesCount)); } } }
public BlamePreLoader(IVcsData vcsData) : base(vcsData) { }
public CommitMapper(IVcsData vcsData) : base(vcsData) { }
public BaseMapperTest() { vcsData = Substitute.For <IVcsData>(); }
public CommitAttributeMapper(IVcsData vcsData) : base(vcsData) { }
public Mapper(IVcsData vcsData) { this.vcsData = vcsData; }
public CodeFileMapper(IVcsData vcsData) : base(vcsData) { FastMergeProcessing = false; }
public ModificationMapper(IVcsData vcsData) : base(vcsData) { }
static void GetLog(IVcsData vcsData) { var r0 = "6c9de40fbcd0dbc62bffce68a82d170d62bb0df0"; var log = vcsData.Log(r0); }
public VcsDataCachedTest() { innerData = Substitute.For <IVcsData>(); cache = new VcsDataCached(innerData); }
public BugFixMapper(IVcsData vcsData, IBugFixDetector bugFixDetector) : base(vcsData) { this.bugFixDetector = bugFixDetector; }
public AuthorMapper(IVcsData vcsData) : base(vcsData) { }
public TagMapper(IVcsData vcsData) : base(vcsData) { }
public BranchMapper(IVcsData vcsData) : base(vcsData) { }
public CodeBlockMapper(IVcsData vcsData) : base(vcsData) { }