コード例 #1
0
ファイル: Program.cs プロジェクト: kirnosenko/msr-tools
        static void Mapping()
        {
            MappingTool mapper = new MappingTool(configFile);

            mapper.Info();
            //mapper.Map(true, 1000);
            //mapper.Truncate(10);
            //mapper.Check(1992);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: BMichael998/msr-tools
        static void Mapping()
        {
            MappingTool mapper = new MappingTool(configFile);

            //mapper.Info();
            //mapper.Map(true, 215);
            //mapper.Map(false, 800);
            //mapper.Truncate(10);
            mapper.Check(215);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: zamaletdinov-a/msr-tools
        static void Main(string[] args)
        {
            string configFile;
            string cmd;
            bool   createDataBase             = false;
            int    revisionNumber             = 0;
            string revision                   = null;
            bool   automaticallyFixDiffErrors = false;
            string path = null;
            string dir  = null;

            try
            {
                configFile = args[0];
                cmd        = args[1];
                int i = 2;
                while (i < args.Length)
                {
                    switch (args[i])
                    {
                    case "-c":
                        createDataBase = true;
                        break;

                    case "-f":
                        automaticallyFixDiffErrors = true;
                        break;

                    case "-n":
                        revisionNumber = Convert.ToInt32(args[++i]);
                        break;

                    case "-r":
                        revision = args[++i];
                        break;

                    case "-p":
                        path = args[++i];
                        break;

                    case "-d":
                        dir = args[++i];
                        break;

                    default:
                        break;
                    }
                    i++;
                }
            }
            catch
            {
                Console.WriteLine("usage: MSR.Tools.Mapper CONFIG_FILE_NAME COMMAND [ARGS]");
                Console.WriteLine("Commands:");
                Console.WriteLine("  info              print general information about database");
                Console.WriteLine("  map               map data incrementally from software repositories to database");
                Console.WriteLine("    -c              create database");
                Console.WriteLine("    -n N            map data till revision number N");
                Console.WriteLine("    -r R            map data till revision R");
                Console.WriteLine("  pmap              map data partially from software repositories to database");
                Console.WriteLine("    -n N            map data from a revision number N to the last one in database");
                Console.WriteLine("    -r R            map data from a revision R to the last one in database");
                Console.WriteLine("    -p PATH         map file in the path");
                Console.WriteLine("    -d DIR          map files in the directory");
                Console.WriteLine("  emap              map a single data entity to database");
                Console.WriteLine("    release R TAG   map a release entity with TAG for revision R to database");
                Console.WriteLine("  truncate          remove mapped data from database");
                Console.WriteLine("    -n N            keep the first N revisions");
                Console.WriteLine("    -r R            keep all revisions until revision R");
                Console.WriteLine("  check             check validity of mapped data");
                Console.WriteLine("    -n N            check data till revision number N");
                Console.WriteLine("    -p PATH         check the file on path");
                Console.WriteLine("    -f              automatically fix diff errors");

                return;
            }

            MappingTool mapper = null;

            try
            {
                mapper = new MappingTool(configFile);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                switch (cmd)
                {
                case "info":
                    mapper.Info();
                    break;

                case "map":
                    if (revisionNumber != 0)
                    {
                        mapper.Map(createDataBase, revisionNumber);
                    }
                    else
                    {
                        mapper.Map(createDataBase, revision);
                    }
                    break;

                case "pmap":
                    IPathSelector[] pathSelectors = new IPathSelector[]
                    {
                        new TakePathByList()
                        {
                            Paths = path != null ? new string[] { path } : null,
                            Dirs  = dir != null ? new string[] { dir } : null
                        }
                    };
                    if (revisionNumber != 0)
                    {
                        mapper.PartialMap(revisionNumber, pathSelectors);
                    }
                    else
                    {
                        mapper.PartialMap(revision, pathSelectors);
                    }
                    break;

                case "emap":
                {
                    switch (args[2])
                    {
                    case "release":
                    {
                        mapper.MapReleaseEntity(args[3], args[4]);
                        break;
                    }
                    }
                    break;
                }

                case "truncate":
                    if (revisionNumber != 0)
                    {
                        mapper.Truncate(revisionNumber);
                    }
                    else
                    {
                        mapper.Truncate(revision);
                    }
                    break;

                case "check":
                    if (revisionNumber != 0)
                    {
                        mapper.Check(revisionNumber, path, automaticallyFixDiffErrors);
                    }
                    else
                    {
                        mapper.Check(revision, path, automaticallyFixDiffErrors);
                    }
                    break;

                default:
                    Console.WriteLine("Unknown command {0}", cmd);
                    break;
                }
            }
            catch (MsrException e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: kirnosenko/msr-tools
        static void Main(string[] args)
        {
            string configFile;
            string cmd;
            bool createDataBase = false;
            int revisionNumber = 0;
            string revision = null;
            bool automaticallyFixDiffErrors = false;
            string path = null;
            string dir = null;

            try
            {
                configFile = args[0];
                cmd = args[1];
                int i = 2;
                while (i < args.Length)
                {
                    switch (args[i])
                    {
                        case "-c":
                            createDataBase = true;
                            break;
                        case "-f":
                            automaticallyFixDiffErrors = true;
                            break;
                        case "-n":
                            revisionNumber = Convert.ToInt32(args[++i]);
                            break;
                        case "-r":
                            revision = args[++i];
                            break;
                        case "-p":
                            path = args[++i];
                            break;
                        case "-d":
                            dir = args[++i];
                            break;
                        default:
                            break;
                    }
                    i++;
                }
            }
            catch
            {
                Console.WriteLine("usage: MSR.Tools.Mapper CONFIG_FILE_NAME COMMAND [ARGS]");
                Console.WriteLine("Commands:");
                Console.WriteLine("  info              print general information about database");
                Console.WriteLine("  map               map data incrementally from software repositories to database");
                Console.WriteLine("    -c              create database");
                Console.WriteLine("    -n N            map data till revision number N");
                Console.WriteLine("    -r R            map data till revision R");
                Console.WriteLine("  pmap              map data partially from software repositories to database");
                Console.WriteLine("    -n N            map data from a revision number N to the last one in database");
                Console.WriteLine("    -r R            map data from a revision R to the last one in database");
                Console.WriteLine("    -p PATH         map file in the path");
                Console.WriteLine("    -d DIR          map files in the directory");
                Console.WriteLine("  emap              map a single data entity to database");
                Console.WriteLine("    release R TAG   map a release entity with TAG for revision R to database");
                Console.WriteLine("  truncate          remove mapped data from database");
                Console.WriteLine("    -n N            keep the first N revisions");
                Console.WriteLine("    -r R            keep all revisions until revision R");
                Console.WriteLine("  check             check validity of mapped data");
                Console.WriteLine("    -n N            check data till revision number N");
                Console.WriteLine("    -p PATH         check the file on path");
                Console.WriteLine("    -f              automatically fix diff errors");

                return;
            }

            MappingTool mapper = null;
            try
            {
                mapper = new MappingTool(configFile);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                switch (cmd)
                {
                    case "info":
                        mapper.Info();
                        break;
                    case "map":
                        if (revisionNumber != 0)
                        {
                            mapper.Map(createDataBase, revisionNumber);
                        }
                        else
                        {
                            mapper.Map(createDataBase, revision);
                        }
                        break;
                    case "pmap":
                        IPathSelector[] pathSelectors = new IPathSelector[]
                        {
                            new TakePathByList()
                            {
                                Paths = path != null ? new string[] { path } : null,
                                Dirs = dir != null ? new string[] { dir } : null
                            }
                        };
                        if (revisionNumber != 0)
                        {
                            mapper.PartialMap(revisionNumber, pathSelectors);
                        }
                        else
                        {
                            mapper.PartialMap(revision, pathSelectors);
                        }
                        break;
                    case "emap":
                    {
                        switch (args[2])
                        {
                            case "release":
                            {
                                mapper.MapReleaseEntity(args[3], args[4]);
                                break;
                            }
                        }
                        break;
                    }
                    case "truncate":
                        if (revisionNumber != 0)
                        {
                            mapper.Truncate(revisionNumber);
                        }
                        else
                        {
                            mapper.Truncate(revision);
                        }
                        break;
                    case "check":
                        if (revisionNumber != 0)
                        {
                            mapper.Check(revisionNumber, path, automaticallyFixDiffErrors);
                        }
                        else
                        {
                            mapper.Check(revision, path, automaticallyFixDiffErrors);
                        }
                        break;
                    default:
                        Console.WriteLine("Unknown command {0}", cmd);
                        break;
                }
            }
            catch (MsrException e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: BMichael998/msr-tools
 static void MapReleases()
 {
     MappingTool mapper = new MappingTool(configFile);
     mapper.MapReleases(
         new Dictionary<string,string>()
         {
             { "f29b607b20b61fddf93885132ed0708308770cf8", "1.12.0 BETA 3" },
             { "7fb632e2d838f1e75aec512e060841977c6cb5a5", "1.10.0" },
             { "72fbb5a89ac45a8795cda0cd1537e7bbe666602f", "1.8.0" },
             { "d8b0a5b7da22c4621b3064fca08d55830430bddb", "1.6.0" },
             { "71edf25b4a6a1f882e3a463292b3828f40c894c9", "1.4.0" },
             { "3f83858cea5aa8bca9647d8363adc35c1f1d5801", "1.2.0" },
             { "d4bfe61f1dc71363c0d237b1add257a4e50488d5", "1.0.0" },
             { "ccbd6c1cd30acc12df9e91aba0230c848d69b6cc", "0.9.0" },
         }
     );
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: BMichael998/msr-tools
        static void PartialMapping()
        {
            MappingTool mapper = new MappingTool(configFile);

            mapper.PartialMap(1901,
                new IPathSelector[]
                {
                    new TakePathByList()
                    {
                        Paths = new string[] { "/src/gpexecute.inc" }
                    }
                }
            );
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: BMichael998/msr-tools
 static void MapSyntheticReleases(int count, double stabilizationProbability)
 {
     MappingTool mapper = new MappingTool(configFile);
     mapper.MapSyntheticReleases(count, stabilizationProbability);
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: kirnosenko/msr-tools
 static void MapReleases()
 {
     MappingTool mapper = new MappingTool(configFile);
     mapper.MapReleases(
         new Dictionary<string,string>()
         {
             { "308aee2d8229cbdd26f29eb04954044592dffa9d", "0.1.0" },
             { "4d00ea8121fd373525ecf6fa93243efc91666554", "0.1.1" },
             { "f0c86737a276553e72a4ff1b070e8e30eaab50a0", "0.2.0" },
             { "0e10ffa1fc83ae4d6b3657266865df4c4a3534da", "0.2.1" },
             { "4f9d9cdbefa90a8d3673f94d078f196de2ec788b", "0.3.0" },
             { "3bab948571635f5b2bf8c9f8ac7ce867c4e57414", "0.3.1" },
             { "368d67c4f309ee9b3f437f9c36845f7a02837d41", "0.3.2" },
         }
     );
 }