Esempio n. 1
0
        static int Main(string[] args)
        {
            ConsoleLogger.Instance.IncludeEventType = false;

            Test("032fa944-399a-4c04-9090-7ce1fd722a0d", "d6d64cae9b4074b5c02f574d12de535f", true);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  ", "   d6d64cae9b4074b5c02f574d12de535f   ", true);
            Test("/032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b4074b5c02f574d12de535f", "", true);
            Test("   /032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b4074b5c02f574d12de535f/    ", "", true);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d,d6d64cae9b4074b5c02f574d12de535f", "", true);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  ,   d6d64cae9b4074b5c02f574d12de535f   ", "", true);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d	d6d64cae9b4074b5c02f574d12de535f", "", true);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  	   d6d64cae9b4074b5c02f574d12de535f   ", "", true);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d/d6d64cae9b4074b5c02f574d12de535f", "", true);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  /   d6d64cae9b4074b5c02f574d12de535f   ", "", true);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  /   d6d64cae9b4074b5c02f574d12de535f   ", "", true);

            Test("032fa944-399a-4c04-9090-7ce1fd722a0d", "d6d64cae9b40702f574d12de535f", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  ", "   d6d64cae9b40702f574d12de535f   ", false);
            Test("/032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b40702f574d12de535f", "", false);
            Test("   /032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b40702f574d12de535f/    ", "", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d,d6d64cae9b40702f574d12de535f", "", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  ,   d6d64cae9b40702f574d12de535f   ", "", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d	d6d64cae9b40702f574d12de535f", "", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  	   d6d64cae9b40702f574d12de535f   ", "", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d/d6d64cae9b40702f574d12de535f", "", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  /   d6d64cae9b40702f574d12de535f   ", "", false);

            Test("/032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b4074b5c02f574d12de535f", "d6d64cae9b40702f574d12de535f", false);
            Test("   /032fa944-399a-4c04-9090-7ce1fd722a0d/capture-schedules/d6d64cae9b4074b5c02f574d12de535f/    ", "d6d64cae9b40702f574d12de535f", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d,d6d64cae9b4074b5c02f574d12de535f", "d6d64cae9b40702f574d12de535f", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  ,   d6d64cae9b4074b5c02f574d12de535f   ", "d6d64cae9b40702f574d12de535f", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d	d6d64cae9b4074b5c02f574d12de535f", "d6d64cae9b40702f574d12de535f", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  	   d6d64cae9b4074b5c02f574d12de535f   ", "d6d64cae9b40702f574d12de535f", false);
            Test("032fa944-399a-4c04-9090-7ce1fd722a0d/d6d64cae9b4074b5c02f574d12de535f", "d6d64cae9b40702f574d12de535f", false);
            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d  /   d6d64cae9b4074b5c02f574d12de535f   ", "d6d64cae9b40702f574d12de535f", false);

            Test("   032fa944-399a-4c04-9090-7ce1fd722a0d     d6d64cae9b4074b5c02f574d12de535f   ", "", true);

            return(0);

            Dictionary <string, List <Counts> > dict = new Dictionary <string, List <Counts> >();
            ProcessHelper proc            = new ProcessHelper("git.exe", "log -n 1200 --pretty=\"%H %ae %ad\"");
            int           maxAuthorLength = 0;

            foreach (string line in proc.Go())
            {
                string[] splits = line.Split(new char[] { ' ' });

                string commitId = splits[0];
                string author   = StringHelper.TrimEnd(splits[1], "@microsoft.com");
                maxAuthorLength = Math.Max(maxAuthorLength, author.Length);

                GitOperations.GetCommitStats(commitId, out int fileCount, out int insertCount, out int deleteCount);
                if (!dict.ContainsKey(author))
                {
                    dict[author] = new List <Counts>();
                }
                dict[author].Add(new Counts(commitId, fileCount, insertCount, deleteCount));
                OldLogger.Log(".");
            }
            OldLogger.LogLine(" done");

            foreach (string author in dict.Keys)
            {
                List <Counts> list             = dict[author];
                int           totalFileCount   = 0;
                int           totalInsertCount = 0;
                int           totalDeleteCount = 0;

                foreach (Counts count in list)
                {
                    totalFileCount   += count.files;
                    totalInsertCount += count.inserts;
                    totalDeleteCount += count.deletes;
                }

                string fileCountString   = PluralStringCheck(totalFileCount, "file changed", "files changed");
                string insertCountString = PluralStringCheck(totalFileCount, "insertion(+)", "insertions(+)");
                string deleteCountString = PluralStringCheck(totalFileCount, "deletion(+)", "deletions(+)");
                string netCountString    = PluralStringCheck((totalInsertCount - totalDeleteCount), "net line changed", "net lines changed");
                OldLogger.LogLine(("Author: " + author).PadRight(maxAuthorLength + 10) + fileCountString.PadRight(20) + insertCountString.PadRight(20) + deleteCountString.PadRight(20) + netCountString);
            }

            foreach (string author in dict.Keys)
            {
                List <Counts> list             = dict[author];
                int           totalFileCount   = 0;
                int           totalInsertCount = 0;
                int           totalDeleteCount = 0;

                foreach (Counts count in list)
                {
                    totalFileCount   += count.files;
                    totalInsertCount += count.inserts;
                    totalDeleteCount += count.deletes;
                }

                OldLogger.LogLine(author.PadRight(maxAuthorLength + 10) + totalFileCount.ToString().PadRight(20) + totalInsertCount.ToString().PadRight(20) + totalDeleteCount.ToString().PadRight(20));
            }

            foreach (string author in dict.Keys)
            {
                OldLogger.LogLine("------------------------------------");
                OldLogger.LogLine("Author: " + author);
                List <Counts> list = dict[author];
                foreach (Counts count in list)
                {
                    OldLogger.LogLine(count.commit.PadRight(45) + count.files.ToString().PadRight(20) + count.inserts.ToString().PadRight(20) + count.deletes.ToString().PadRight(20));
                }
            }

            return(0);
        }