Handle null tfs identities.

This commit is contained in:
Matt Burke
2010-03-08 16:11:06 -05:00
parent 9e5b095aab
commit cf1432e35e
2 changed files with 5 additions and 16 deletions
+3 -14
View File
@@ -150,24 +150,13 @@ namespace Sep.Git.Tfs.Core
private LogEntry MakeNewLogEntry()
{
var log = new LogEntry();
log.CommitterName = log.AuthorName = GetAuthorName();
log.CommitterEmail = log.AuthorEmail = GetAuthorEmail();
var identity = tfs.GetIdentity(changeset.Committer);
log.CommitterName = log.AuthorName = identity.DisplayName ?? "Unknown TFS user";
log.CommitterEmail = log.AuthorEmail = identity.MailAddress ?? changeset.Committer;
log.Date = changeset.CreationDate;
log.Log = changeset.Comment + Environment.NewLine;
log.ChangesetId = changeset.ChangesetId;
return log;
}
private string GetAuthorEmail()
{
var identity = tfs.GetIdentity(changeset.Committer);
return identity.MailAddress;
}
private string GetAuthorName()
{
var identity = tfs.GetIdentity(changeset.Committer);
return identity.DisplayName;
}
}
}
+2 -2
View File
@@ -14,12 +14,12 @@ namespace Sep.Git.Tfs.Core
public string MailAddress
{
get { return identity.MailAddress; }
get { return identity == null ? null : identity.MailAddress; }
}
public string DisplayName
{
get { return identity.DisplayName; }
get { return identity == null ? null : identity.DisplayName; }
}
}
}