public void SendDiff(string conferenceId, DiffItem diffItem)
        {
            DiffCommand command = new DiffCommand(conferenceId);

            command.DiffItem = diffItem;
            SendCommand(command);
        }
Example #2
0
        internal ChangeSetDetail PopulateDetails(string id, ChangeSetDetail detail)
        {
            var summaryCommand = new DiffCommand
            {
                SummaryOnly = true
            };

            if (!String.IsNullOrEmpty(id))
            {
                summaryCommand.ChangeIntroducedByRevision = id;
            }

            IStringReader summaryReader = Repository.Diff(summaryCommand).AsReader();

            ParseSummary(summaryReader, detail);

            var diffCommand = new DiffCommand
            {
                UseGitDiffFormat = true,
            };

            if (!String.IsNullOrEmpty(id))
            {
                diffCommand.ChangeIntroducedByRevision = id;
            }

            var diffReader = Repository.Diff(diffCommand).AsReader();

            GitExeRepository.ParseDiffAndPopulate(diffReader, detail);

            return(detail);
        }
Example #3
0
 public ChildCommands(DiffCommand diff, SetupComCommand setupCom, CleanCommand cleanCom, SortCommand sort, GraphCommand graph, AnalyzeCommand analyze)
 {
     Diff     = diff;
     SetupCom = setupCom;
     CleanCom = cleanCom;
     Sort     = sort;
     Graph    = graph;
     Analyze  = analyze;
 }
Example #4
0
        private void AddColumns(DiffCommand command)
        {
            var tables     = _sourceTableRepository.GetAll();
            var tableNames = command.AllTables ? tables.Select(t => t.Name).ToList() : TableHelper.ParseTableNames(command.TableNames);

            foreach (var table in tables.Where(t => tableNames.Contains(t.Name)))
            {
                AddColumns(command, table);
            }
        }
Example #5
0
        public void Diff(DiffCommand command)
        {
            _validator.ValidateAndThrow(command);

            ChangeSetCommand.Restart();

            DropColumns(command);
            AddColumns(command);
            AddForeignKeys(command);
        }
Example #6
0
        private void AddForeignKeys(DiffCommand command, Table table)
        {
            var sourceForeignKeys = _sourceTableRepository.GetForeignKeys(table.Name);
            var targetForeignKeys = _targetTableRepository.GetForeignKeys(table.Name);
            var foreignKeys       = sourceForeignKeys.Where(t => targetForeignKeys.All(s => s.Name != t.Name)).ToList();

            foreach (var foreignKey in foreignKeys)
            {
                AddForeignKey(command, table, foreignKey);
            }
        }
Example #7
0
        private void DropColumns(DiffCommand command, Table table)
        {
            var sourceColumns = _sourceTableRepository.GetColumns(table.Name);
            var targetColumns = _targetTableRepository.GetColumns(table.Name);
            var columns       = targetColumns.Where(t => sourceColumns.All(s => s.Name != t.Name)).ToList();

            foreach (var column in columns)
            {
                DropColumn(command, table, column);
            }
        }
Example #8
0
        private static string GetCommitDiff(Repository repository, Git git, RevCommit rev, String file)
        {
            //Fetch diffrence of commit
            OutputStream      @out    = new ByteArrayOutputStream();
            DiffCommand       diff1   = git.Diff().SetPathFilter(PathFilter.Create(file)).SetOldTree(GetTreeIterator(rev.GetParent(0).Tree.Name, repository)).SetNewTree(GetTreeIterator(rev.Tree.Name, repository)).SetOutputStream(@out);
            IList <DiffEntry> entries = diff1.Call();
            string            data    = @out.ToString();

            data = System.Text.RegularExpressions.Regex.Replace(data, "[^a-zA-Z.]+", " ");//[^0-9a-zA-Z.]
            data = RemoveStopWords(data);
            return(data);
        }
Example #9
0
        public const string BaseFileForDependency = "CatalogController.cs";// "defaultResources.nopres.xml";
        public static string GetCommitDiff(Repository repository, Git git, RevCommit rev, String file)
        {
            string snapshotN        = GetSnapshot(repository, git, rev.GetParent(0).Tree, file);
            string snapshotNPlusOne = GetSnapshot(repository, git, rev.Tree, file);

            //Fetch diffrence of commit
            OutputStream      @out    = new ByteArrayOutputStream();
            DiffCommand       diff    = git.Diff().SetPathFilter(PathFilter.Create(file)).SetOldTree(GetTreeIterator(rev.GetParent(0).Tree.Name, repository)).SetNewTree(GetTreeIterator(rev.Tree.Name, repository)).SetOutputStream(@out);
            IList <DiffEntry> entries = diff.Call();

            return(@out.ToString());
        }
Example #10
0
        private static void DropColumn(DiffCommand command, Table table, Column column)
        {
            var changeSetCommand = new ChangeSetCommand(command.Author);
            var builder          = new DropColumnChangeSetBuilder(table, column);
            var changeSet        = builder.Build(changeSetCommand);

            var xml  = changeSet.ToXml();
            var path = Path.Combine(command.DirectoryPath, $"{ChangeSetCommand.Sequence:000}.{table.Name.ToLower()}.{column.Name.ToLower()}.drop.xml");

            FileHelper.Write(path, xml);

            ChangeSetCommand.Next();
        }
Example #11
0
        private static void AddForeignKey(DiffCommand command, Table table, ForeignKey foreignKey)
        {
            var changeSetCommand = new ChangeSetCommand(command.Author);
            var builder          = new AddForeignKeyConstraintChangeSetBuilder(foreignKey);
            var changeSet        = builder.Build(changeSetCommand);

            var xml  = changeSet.ToXml();
            var path = Path.Combine(command.DirectoryPath, $"{ChangeSetCommand.Sequence:000}.{table.Name.ToLower()}.{foreignKey.Name.ToLower()}.foreign-key.xml");

            FileHelper.Write(path, xml);

            ChangeSetCommand.Next();
        }
Example #12
0
        public DiffViewModel()
        {
            Command = new DiffCommand
            {
                Author         = "altair.sossai",
                SourceDatabase = Constants.Databases.SqlServer,
                TargetDatabase = Constants.Databases.SqlServer,
                DirectoryPath  = @"E:\liquibase-editor",
                TableNames     = "GA_TIMESHEET; GA_TIMESHEET_ITEM"
            };

            Command.UseSqlServerDefaultConfiguration();
        }
Example #13
0
        private void AddColumns(DiffCommand command, Table table)
        {
            var sourceColumns = _sourceTableRepository.GetColumns(table.Name);
            var targetColumns = _targetTableRepository.GetColumns(table.Name);
            var columns       = sourceColumns.Where(t => targetColumns.All(s => s.Name != t.Name)).ToList();

            foreach (var column in columns)
            {
                AddColumn(command, table, column);

                if (column.AutoIncrement)
                {
                    CreateSequence(command, table, column);
                }
            }
        }
Example #14
0
        private void ProcessDiffCommand(DiffCommand diffCommand)
        {
            //_diffFrame = new Bitmap(_diffFrame.Width, _diffFrame.Height);
            using (Graphics diffFrameGraphics = Graphics.FromImage(_diffFrame))
            {
                diffFrameGraphics.DrawImage(
                    DiffContainer.ByteArrayToImage(diffCommand.DiffItem.ImageBytes),
                    diffCommand.DiffItem.X, diffCommand.DiffItem.Y,
                    diffCommand.DiffItem.Width, diffCommand.DiffItem.Height);

                //diffFrameGraphics.DrawRectangle(Pens.Red,new Rectangle(
                //    diffCommand.DiffItem.X,
                //    diffCommand.DiffItem.Y,
                //    diffCommand.DiffItem.Width,
                //    diffCommand.DiffItem.Height));
            }
        }
Example #15
0
        static int Main(string[] args)
        {
            var app = new CommandLineApplication()
            {
                Name        = "mysqldiff",
                Description = "MySql Migration Tool",
            };

            app.HelpOption(true);

            DiffCommand.RegisterWithApp(app);
            CopyCommand.RegisterWithApp(app);

            app.OnExecute(() =>
            {
                app.ShowHelp();
            });

            return(app.Execute(args));
        }
Example #16
0
        internal ChangeSetDetail PopulateDetails(string id, ChangeSetDetail detail)
        {
            var summaryCommand = new DiffCommand
            {
                SummaryOnly = true
            };

            if (!String.IsNullOrEmpty(id))
            {
                summaryCommand.ChangeIntroducedByRevision = id;
            }

            IStringReader summaryReader = Repository.Diff(summaryCommand).AsReader();

            ParseSummary(summaryReader, detail);

            var diffCommand = new DiffCommand
            {
                UseGitDiffFormat = true,
            };

            if (!String.IsNullOrEmpty(id))
            {
                diffCommand.ChangeIntroducedByRevision = id;
            }

            var diffReader = Repository.Diff(diffCommand).AsReader();

            GitExeRepository.ParseDiffAndPopulate(diffReader, detail);

            return detail;
        }
Example #17
0
 public static void UseOracleDefaultConfiguration(this DiffCommand command)
 {
     command.UseSourceOracleDefaultConfiguration();
     command.UseTargetOracleDefaultConfiguration();
 }
Example #18
0
 public static void UseTargetOracleDefaultConfiguration(this DiffCommand command)
 {
     command.TargetConnectionString = "USER ID=GATEC_SIMPLEFARM_QA;PASSWORD=ga;DATA SOURCE=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.25)(PORT = 1524)))(CONNECT_DATA =(SERVICE_NAME = DBDEV11)))";
 }
Example #19
0
 public static void UseSqlServerDefaultConfiguration(this DiffCommand command)
 {
     command.UseSourceSqlServerDefaultConfiguration();
     command.UseTargetSqlServerDefaultConfiguration();
 }
Example #20
0
 public static void UseTargetSqlServerDefaultConfiguration(this DiffCommand command)
 {
     command.TargetConnectionString = "Server=localhost;Database=FC_SIMPLEFARM_DEV2004;User Id=sa;Password=ef66b58b-6ff2-4c78-bcec-6b279312b625;";
 }