Example #1
0
        private LogEntry MakeNewLogEntry(IChangeset changesetToLog, IGitTfsRemote remote = null)
        {
            var identity = _tfs.GetIdentity(changesetToLog.Committer);
            var name     = changesetToLog.Committer;
            var email    = changesetToLog.Committer;

            if (_authors != null && _authors.Authors.ContainsKey(changesetToLog.Committer))
            {
                name  = _authors.Authors[changesetToLog.Committer].Name;
                email = _authors.Authors[changesetToLog.Committer].Email;
            }
            else if (identity != null)
            {
                //This can be null if the user was deleted from AD.
                //We want to keep their original history around with as little
                //hassle to the end user as possible
                if (!String.IsNullOrWhiteSpace(identity.DisplayName))
                {
                    name = identity.DisplayName;
                }

                if (!String.IsNullOrWhiteSpace(identity.MailAddress))
                {
                    email = identity.MailAddress;
                }
            }
            else if (!String.IsNullOrWhiteSpace(changesetToLog.Committer))
            {
                string[] split = changesetToLog.Committer.Split('\\');
                if (split.Length == 2)
                {
                    name  = split[1].ToLower();
                    email = string.Format("{0}@{1}.tfs.local", name, split[0].ToLower());
                }
            }

            // committer's & author's name and email MUST NOT be empty as otherwise they would be picked
            // by git from user.name and user.email config settings which is bad thing because commit could
            // be different depending on whose machine it fetched
            if (String.IsNullOrWhiteSpace(name))
            {
                name = "Unknown TFS user";
            }
            if (String.IsNullOrWhiteSpace(email))
            {
                email = "*****@*****.**";
            }
            return(new LogEntry
            {
                Date = changesetToLog.CreationDate,
                Log = changesetToLog.Comment + Environment.NewLine,
                ChangesetId = changesetToLog.ChangesetId,
                CommitterName = name,
                AuthorName = name,
                CommitterEmail = email,
                AuthorEmail = email,
                Remote = remote
            });
        }
Example #2
0
        private LogEntry MakeNewLogEntry(IChangeset changesetToLog)
        {
            var log      = new LogEntry();
            var identity = _tfs.GetIdentity(changesetToLog.Committer);

            log.CommitterName  = log.AuthorName = null != identity ? identity.DisplayName ?? "Unknown TFS user" : changesetToLog.Committer ?? "Unknown TFS user";
            log.CommitterEmail = log.AuthorEmail = null != identity ? identity.MailAddress ?? changesetToLog.Committer : changesetToLog.Committer;
            log.Date           = changesetToLog.CreationDate;
            log.Log            = changesetToLog.Comment + Environment.NewLine;
            log.ChangesetId    = changesetToLog.ChangesetId;
            return(log);
        }
Example #3
0
        private LogEntry MakeNewLogEntry(IChangeset changesetToLog)
        {
            var identity = _tfs.GetIdentity(changesetToLog.Committer);

            // committer's & author's name and email MUST NOT be empty as otherwise they would be picked
            // by git from user.name and user.email config settings which is bad thing because commit could
            // be different depending on whose machine it fetched
            var name  = "Unknown TFS user";
            var email = "*****@*****.**";

            if (identity != null)
            {
                if (!String.IsNullOrWhiteSpace(identity.DisplayName))
                {
                    name = identity.DisplayName;
                }

                if (!String.IsNullOrWhiteSpace(identity.MailAddress))
                {
                    email = identity.MailAddress;
                }
                else if (!String.IsNullOrWhiteSpace(changesetToLog.Committer))
                {
                    email = changesetToLog.Committer;
                }
            }

            return(new LogEntry
            {
                Date = changesetToLog.CreationDate,
                Log = changesetToLog.Comment + Environment.NewLine,
                ChangesetId = changesetToLog.ChangesetId,
                CommitterName = name,
                AuthorName = name,
                CommitterEmail = email,
                AuthorEmail = email
            });
        }