public InitBranch(TextWriter stdout, Globals globals, Help helper, AuthorsFile authors)
 {
     _stdout = stdout;
     _globals = globals;
     _helper = helper;
     _authors = authors;
 }
Exemple #2
0
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            if (checkinOptions.AuthorsFilePath == null)
            {
                writer.WriteLine("Author file was not set.");
                return;
            }

            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();
            TextReader  tr = new StreamReader(checkinOptions.AuthorsFilePath);

            af.Parse(tr);

            Author a = af.FindAuthor(commit.AuthorAndEmail);

            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
Exemple #3
0
 public Fetch(Globals globals, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.remoteOptions = remoteOptions;
     this.globals = globals;
     this.authors = authors;
     this.labels = labels;
 }
Exemple #4
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, AuthorsFile authors)
 {
     _tfs = tfs;
     _changeset = changeset;
     _authors = authors;
     BaseChangesetId = _changeset.Changes.Max(c => c.Item.ChangesetId) - 1;
 }
 public void TestBadRecord()
 {
     string author =
     @"Domain\Test.User = Test User";
     AuthorsFile authFile = new AuthorsFile();
     authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author))));
 }
Exemple #6
0
 public TfsChangeset(ITfsHelper tfs, IChangeset changeset, TextWriter stdout, AuthorsFile authors)
 {
     _tfs = tfs;
     _changeset = changeset;
     _stdout = stdout;
     _authors = authors;
 }
Exemple #7
0
 public Fetch(Globals globals, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals = globals;
     this.stdout = stdout;
     this.remoteOptions = remoteOptions;
     this.authors = authors;
     this.labels = labels;
 }
Exemple #8
0
 public Rcheckin(CheckinOptions checkinOptions, TfsWriter writer, Globals globals, AuthorsFile authors)
 {
     _checkinOptions = checkinOptions;
     _checkinOptionsFactory = new CheckinOptionsFactory(globals);
     _writer = writer;
     _globals = globals;
     _authors = authors;
 }
 public void AuthorsFileEmptyFile()
 {
     MemoryStream ms = new MemoryStream();
     StreamReader sr = new StreamReader(ms);
     AuthorsFile authFile = new AuthorsFile();
     authFile.Parse(sr);
     Assert.NotNull(authFile.Authors);
     Assert.Equal<int>(0, authFile.Authors.Count);
 }
Exemple #10
0
 public Rcheckin(TextWriter stdout, CheckinOptions checkinOptions, TfsWriter writer, Globals globals, AuthorsFile authors)
 {
     _stdout = stdout;
     _checkinOptions = checkinOptions;
     _checkinOptionsFactory = new CommitSpecificCheckinOptionsFactory(_stdout, globals, authors);
     _writer = writer;
     _globals = globals;
     _authors = authors;
 }
        public CheckinOptions BuildCommitSpecificCheckinOptions(CheckinOptions sourceCheckinOptions,
            string commitMessage, GitCommit commit, AuthorsFile authors)
        {
            var customCheckinOptions = BuildCommitSpecificCheckinOptions(sourceCheckinOptions, commitMessage);

            customCheckinOptions.ProcessAuthor(writer, commit, authors);

            return customCheckinOptions;
        }
        public void AuthorsFileMultiLineRecordWithBlankLine()
        {
            string author =
@"Domain\Test.User = Test User <*****@*****.**>

Domain\Different.User = Three Name User < *****@*****.** >";
            AuthorsFile authFile = new AuthorsFile();
            Assert.Throws<GitTfsException>(() => authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author)))));
        }
Exemple #13
0
 public Fetch(Globals globals, ConfigProperties properties, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors, Labels labels)
 {
     this.globals = globals;
     this.properties = properties;
     this.stdout = stdout;
     this.remoteOptions = remoteOptions;
     this.authors = authors;
     this.labels = labels;
     this.upToChangeSet = -1;
 }
 public void AuthorsFileCaseInsensitiveRecord()
 {
     string author = @"DOMAIN\Test.User = Test User <*****@*****.**>";
     AuthorsFile authFile = new AuthorsFile();
     authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author))));
     Assert.NotNull(authFile.Authors);
     Assert.Equal<int>(1, authFile.Authors.Count);
     Assert.True(authFile.Authors.ContainsKey(@"domain\Test.User"));
     Author auth = authFile.Authors[@"domain\Test.User"];
     Assert.Equal<string>("Test User", auth.Name);
     Assert.Equal<string>("*****@*****.**", auth.Email);
 }
        public void AuthorsFileCommentCharacterStartOfLine()
        {
            string author =
            @"Domain\Test.User = Test User <*****@*****.**>
            #Domain\Different.User = Three Name User < *****@*****.** >";
            AuthorsFile authFile = new AuthorsFile();
            authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author))));
            Assert.NotNull(authFile.Authors);
            Assert.Equal<int>(1, authFile.Authors.Count);

            Assert.True(authFile.Authors.ContainsKey(@"Domain\Test.User"));
            Assert.False(authFile.Authors.ContainsKey(@"Domain\Different.User"));
        }
        public static void ProcessAuthor(this CheckinOptions checkinOptions, GitCommit commit, AuthorsFile authors)
        {
            if (!authors.IsParseSuccessfull)
                return;

            Author a = authors.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            Trace.TraceInformation("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
        public void AuthorsFileMultiLineRecord()
        {
            string author =
@"Domain\Test.User = Test User <*****@*****.**>
Domain\Different.User = Three Name User < *****@*****.** >";
            AuthorsFile authFile = new AuthorsFile();
            authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author))));
            Assert.NotNull(authFile.Authors);
            Assert.Equal<int>(2, authFile.Authors.Count);

            Assert.True(authFile.Authors.ContainsKey(@"Domain\Test.User"));
            Author auth = authFile.Authors[@"Domain\Test.User"];
            Assert.Equal<string>("Test User", auth.Name);
            Assert.Equal<string>("*****@*****.**", auth.Email);

            Assert.True(authFile.Authors.ContainsKey(@"Domain\Different.User"));
            auth = authFile.Authors[@"Domain\Different.User"];
            Assert.Equal<string>("Three Name User", auth.Name);
            Assert.Equal<string>(" [email protected] ", auth.Email);
        }
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();

            if (!af.Parse(checkinOptions.AuthorsFilePath, globals.GitDir))
            {
                return;
            }

            Author a = af.FindAuthor(commit.AuthorAndEmail);

            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
        public static void ProcessAuthor(this CheckinOptions checkinOptions, TextWriter writer, GitCommit commit, AuthorsFile authors)
        {
            if (!authors.IsParseSuccessfull)
            {
                return;
            }

            Author a = authors.FindAuthor(commit.AuthorAndEmail);

            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
Exemple #20
0
 public CommitSpecificCheckinOptionsFactory(TextWriter writer, Globals globals, AuthorsFile authors)
 {
     this.writer  = writer;
     this.globals = globals;
     this.authors = authors;
 }
Exemple #21
0
 public QuickFetch(Globals globals, RemoteOptions remoteOptions, AuthorsFile authors) : base(globals, remoteOptions, authors, null)
 {
 }
Exemple #22
0
 public InitBranch4Test(TextWriter stdout, Globals globals, Help helper, AuthorsFile authors)
     : base(stdout, globals, helper, authors)
 {
 }
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            if (checkinOptions.AuthorsFilePath == null)
            {
                writer.WriteLine("Author file was not set.");
                return;
            }

            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();
            TextReader tr = new StreamReader(checkinOptions.AuthorsFilePath);
            af.Parse(tr);

            Author a = af.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
        public CheckinOptions BuildCommitSpecificCheckinOptions(CheckinOptions sourceCheckinOptions,
                                                                string commitMessage, GitCommit commit, AuthorsFile authors)
        {
            var customCheckinOptions = BuildCommitSpecificCheckinOptions(sourceCheckinOptions, commitMessage);

            customCheckinOptions.ProcessAuthor(commit, authors);

            return(customCheckinOptions);
        }
Exemple #25
0
 public Labels(TextWriter stdout, Globals globals, AuthorsFile authors)
 {
     this._stdout = stdout;
     this._globals = globals;
     this._authors = authors;
 }
        public void AuthorsFileInternationalCharactersCommented()
        {
            string author = @"DOMAIN\Blåbærsyltetøy = ÆØÅ User <ÆØÅ@example.com>
#DifferentDomain\Blåbærsyltetøy = ÆØÅ User <ÆØÅ@example.com>";
            AuthorsFile authFile = new AuthorsFile();
            authFile.Parse(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(author))));
            Assert.NotNull(authFile.Authors);
            Assert.Equal<int>(1, authFile.Authors.Count);
            Assert.True(authFile.Authors.ContainsKey(@"domain\Blåbærsyltetøy"));
        }
Exemple #27
0
 public Labels(Globals globals, AuthorsFile authors)
 {
     _globals = globals;
     _authors = authors;
 }
Exemple #28
0
 public QuickFetch(Globals globals, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors)
     : base(globals, stdout, remoteOptions, authors, null)
 {
 }
 public CommitSpecificCheckinOptionsFactory(TextWriter writer, Globals globals, AuthorsFile authors)
 {
     this.writer = writer;
     this.globals = globals;
     this.authors = authors;
 }
        private void ProcessAuthor(CheckinOptions checkinOptions, TextWriter writer, GitCommit commit)
        {
            // get authors file FIXME
            AuthorsFile af = new AuthorsFile();
            if (!af.Parse(checkinOptions.AuthorsFilePath, globals.GitDir))
                return;

            Author a = af.FindAuthor(commit.AuthorAndEmail);
            if (a == null)
            {
                checkinOptions.AuthorTfsUserId = null;
                return;
            }

            checkinOptions.AuthorTfsUserId = a.TfsUserId;
            writer.WriteLine("Commit was authored by git user {0} {1} ({2})", a.Name, a.Email, a.TfsUserId);
        }
        public void AuthorsFileTestBadRecord()
        {
            string author =
@"Domain\Test.User = Test User";
            AuthorsFile authFile = new AuthorsFile();
            Assert.Throws<GitTfsException>(() => authFile.Parse(new StreamReader(new MemoryStream(Encoding.ASCII.GetBytes(author)))));
        }
        public void AuthorsFileInternationalCharactersMultiLine()
        {
            string author = @"DOMAIN\Blåbærsyltetøy = ÆØÅ User <ÆØÅ@example.com>
differentDomain\Blåbærsyltetøy = ÆØÅ User <ÆØÅ@example.com>";
            AuthorsFile authFile = new AuthorsFile();
            authFile.Parse(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(author))));
            Assert.NotNull(authFile.Authors);
            Assert.Equal<int>(2, authFile.Authors.Count);
            Assert.True(authFile.Authors.ContainsKey(@"domain\Blåbærsyltetøy"));
            Author auth = authFile.Authors[@"domain\Blåbærsyltetøy"];
            Assert.Equal<string>("ÆØÅ User", auth.Name);
            Assert.Equal<string>("ÆØÅ@example.com", auth.Email);

            Assert.True(authFile.Authors.ContainsKey(@"differentDomain\Blåbærsyltetøy"));
            auth = authFile.Authors[@"differentDomain\Blåbærsyltetøy"];
            Assert.Equal<string>("ÆØÅ User", auth.Name);
            Assert.Equal<string>("ÆØÅ@example.com", auth.Email);
        }
Exemple #33
0
 public QuickFetch(Globals globals, ConfigProperties properties, TextWriter stdout, RemoteOptions remoteOptions, AuthorsFile authors)
     : base(globals, properties, stdout, remoteOptions, authors, null)
 {
     _properties = properties;
 }
Exemple #34
0
 public InitBranch(Globals globals, Help helper, AuthorsFile authors)
 {
     _globals = globals;
     _helper = helper;
 }
        private AuthorsFile _SetupAuthorsFile(string[] authors)
        {
            string author = _MergeAuthorsIntoString(authors);

            AuthorsFile authFile = new AuthorsFile();
            authFile.Parse(new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(author))));
            return authFile;
        }