示例#1
0
		/// <summary>
		/// Компилирует исходую и целевую версию проекта, сравнивает классы и формирует пары для сравнений
		/// </summary>
		public void Generate(){
			Directory.CreateDirectory(_context.RootDirectory);
			IDictionary<string, XElement> sourceClasses = new Dictionary<string, XElement>();
			_context.Log.Trace("start initialize git");
			PrepareGitRepository();
			_context.Log.Info("git initialized");
			if (_context.FullUpdate){
				_context.Log.Trace("full update mode");
			}
			else{
				_context.Log.Trace("start base proj reading");
				sourceClasses = GetBSharpClasses(_context.GitBaseRevision);
				_context.Log.Trace("end base proj reading");
			}
			_context.Log.Trace("start update proj reading");
			IDictionary<string, XElement> updatedClasses = GetBSharpClasses(_context.GitUpdateRevision);
			_context.Log.Trace("end base proj reading");
			IDictionary<string,DiffPair> result = new Dictionary<string, DiffPair>();
			foreach (var updatedClass in updatedClasses){
				var name = updatedClass.Key;
				var diff = new DiffPair{Updated = updatedClass.Value,Base = new XElement("stub"), FileName = name};
				if (sourceClasses.ContainsKey(name)){
					diff.Base = sourceClasses[name];
				}
				if(diff.Base.ToString()==diff.Updated.ToString())continue;
				result[name] = diff;
			}
			_context.DiffPairs = result.Values.ToArray();
			FixCodeUpdates();
			
		}
示例#2
0
        private static IEnumerable <DataDiffTable> GetDiff(string basis, string updated, bool emptyaschange = true)
        {
            var bx   = basis.StartsWith("<") ? XElement.Parse(basis) : new BxlParser().Parse(basis).Elements().First();
            var up   = basis.StartsWith("<") ? XElement.Parse(updated) : new BxlParser().Parse(updated).Elements().First();
            var diff = new DiffPair {
                Base = bx, Updated = up
            };
            var context = new TableDiffGeneratorContext {
                DiffPairs = new[] { diff }, EmptyAttributesAsUpdates = emptyaschange
            };

            new DataTableDiffGenerator(context).Generate();
            return(context.Tables);
        }
示例#3
0
		private static IEnumerable<DataDiffTable> GetDiff(string basis, string updated, bool emptyaschange = true){
			
			var bx = basis.StartsWith("<") ? XElement.Parse(basis) : new BxlParser().Parse(basis).Elements().First();
			var up = basis.StartsWith("<") ? XElement.Parse(updated) : new BxlParser().Parse(updated).Elements().First();
			var diff = new DiffPair{Base = bx, Updated = up};
			var context = new TableDiffGeneratorContext{DiffPairs =new[]{ diff},EmptyAttributesAsUpdates = emptyaschange};
			new DataTableDiffGenerator(context).Generate();
			return context.Tables;
		}
示例#4
0
 public static int textComparer(DiffPair s, DiffPair s1)
 {
     return(s.textData.Line.CompareTo(s1.textData.Line));
 }