本文整理汇总了C#中Sep.Git.Tfs.Core.LogEntry类的典型用法代码示例。如果您正苦于以下问题:C# LogEntry类的具体用法?C# LogEntry怎么用?C# LogEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogEntry类属于Sep.Git.Tfs.Core命名空间,在下文中一共展示了LogEntry类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithCommitHeaderEnv
//private Encoding LookupEncoding(string encoding)
//{
// if(encoding == null)
// return null;
// throw new NotImplementedException("Need to implement encoding lookup for " + encoding);
//}
private void WithCommitHeaderEnv(LogEntry logEntry, Action action)
{
WithTemporaryEnvironment(action, new Dictionary<string, string>
{
{"GIT_AUTHOR_NAME", logEntry.AuthorName},
{"GIT_AUTHOR_EMAIL", logEntry.AuthorEmail},
{"GIT_AUTHOR_DATE", logEntry.Date.FormatForGit()},
{"GIT_COMMITTER_DATE", logEntry.Date.FormatForGit()},
{"GIT_COMMITTER_NAME", logEntry.CommitterName ?? logEntry.AuthorName},
{"GIT_COMMITTER_EMAIL", logEntry.CommitterEmail ?? logEntry.AuthorEmail}
});
}
示例2: WriteCommit
private string WriteCommit(LogEntry logEntry)
{
// TODO (maybe): encode logEntry.Log according to 'git config --get i18n.commitencoding', if specified
//var commitEncoding = Repository.CommandOneline("config", "i18n.commitencoding");
//var encoding = LookupEncoding(commitEncoding) ?? Encoding.UTF8;
string commitHash = null;
Repository.CommandInputOutputPipe((procIn, procOut) =>
{
procIn.WriteLine(logEntry.Log);
procIn.WriteLine(GitTfsConstants.TfsCommitInfoFormat, TfsUrl,
TfsRepositoryPath, logEntry.ChangesetId);
procIn.Close();
commitHash = ParseCommitInfo(procOut.ReadToEnd());
}, BuildCommitCommand(logEntry));
return commitHash;
}
示例3: BuildCommitCommand
private string[] BuildCommitCommand(LogEntry logEntry)
{
var tree = logEntry.Tree ?? GetTemporaryIndexTreeSha();
tree.AssertValidSha();
var commitCommand = new List<string> { "commit-tree", tree };
foreach (var parent in logEntry.CommitParents)
{
commitCommand.Add("-p");
commitCommand.Add(parent);
}
return commitCommand.ToArray();
}
示例4: Commit
private string Commit(LogEntry logEntry)
{
string commitHash = null;
WithCommitHeaderEnv(logEntry, () => commitHash = WriteCommit(logEntry));
// TODO (maybe): StoreChangesetMetadata(commitInfo);
return commitHash;
}
示例5: ProcessChangeset
private string ProcessChangeset(ITfsChangeset changeset, LogEntry log)
{
if (ExportMetadatas)
{
if (changeset.Summary.Workitems.Any()) {
var workItemIds = TranslateWorkItems(changeset.Summary.Workitems.Select(wi => wi.Id.ToString()));
if (workItemIds != null) {
log.Log += "\nwork-items: " + string.Join(", ", workItemIds.Select(s => "#" + s));
}
}
if (!string.IsNullOrWhiteSpace(changeset.Summary.PolicyOverrideComment))
log.Log += "\n" + GitTfsConstants.GitTfsPolicyOverrideCommentPrefix + changeset.Summary.PolicyOverrideComment;
if (!string.IsNullOrWhiteSpace(changeset.Summary.CodeReviewer))
log.Log += "\n" + GitTfsConstants.GitTfsCodeReviewerPrefix + changeset.Summary.CodeReviewer;
if (!string.IsNullOrWhiteSpace(changeset.Summary.SecurityReviewer))
log.Log += "\n" + GitTfsConstants.GitTfsSecurityReviewerPrefix + changeset.Summary.SecurityReviewer;
if (!string.IsNullOrWhiteSpace(changeset.Summary.PerformanceReviewer))
log.Log += "\n" + GitTfsConstants.GitTfsPerformanceReviewerPrefix + changeset.Summary.PerformanceReviewer;
}
var commitSha = Commit(log);
UpdateTfsHead(commitSha, changeset.Summary.ChangesetId);
StringBuilder metadatas = new StringBuilder();
if (changeset.Summary.Workitems.Any())
{
string workitemNote = "Workitems:\n";
foreach (var workitem in changeset.Summary.Workitems)
{
var workitemId = workitem.Id.ToString();
var workitemUrl = workitem.Url;
if (ExportMetadatas && ExportWorkitemsMapping.Count != 0)
{
if (ExportWorkitemsMapping.ContainsKey(workitemId))
{
var oldWorkitemId = workitemId;
workitemId = ExportWorkitemsMapping[workitemId];
workitemUrl = workitemUrl.Replace(oldWorkitemId, workitemId);
}
}
workitemNote += String.Format("[{0}] {1}\n {2}\n", workitemId, workitem.Title, workitemUrl);
}
metadatas.Append(workitemNote);
}
if (!string.IsNullOrWhiteSpace(changeset.Summary.PolicyOverrideComment))
metadatas.Append("\nPolicy Override Comment:" + changeset.Summary.PolicyOverrideComment);
if (!string.IsNullOrWhiteSpace(changeset.Summary.CodeReviewer))
metadatas.Append("\nCode Reviewer:" + changeset.Summary.CodeReviewer);
if (!string.IsNullOrWhiteSpace(changeset.Summary.SecurityReviewer))
metadatas.Append("\nSecurity Reviewer:" + changeset.Summary.SecurityReviewer);
if (!string.IsNullOrWhiteSpace(changeset.Summary.PerformanceReviewer))
metadatas.Append("\nPerformance Reviewer:" + changeset.Summary.PerformanceReviewer);
if (!string.IsNullOrWhiteSpace(changeset.OmittedParentBranch))
metadatas.Append("\nOmitted parent branch: " + changeset.OmittedParentBranch);
if (metadatas.Length != 0)
Repository.CreateNote(commitSha, metadatas.ToString(), log.AuthorName, log.AuthorEmail, log.Date);
return commitSha;
}
示例6: Commit
private string Commit(LogEntry logEntry)
{
logEntry.Log = BuildCommitMessage(logEntry.Log, logEntry.ChangesetId);
return Repository.Commit(logEntry).Sha;
}
示例7: WriteCommit
private string WriteCommit(LogEntry logEntry)
{
// TODO (maybe): encode logEntry.Log according to 'git config --get i18n.commitencoding', if specified
//var commitEncoding = Repository.CommandOneline("config", "i18n.commitencoding");
//var encoding = LookupEncoding(commitEncoding) ?? Encoding.UTF8;
string commitHash = null;
//the remote to be associated with the commit might be a subtree, if it's null then it's not from a subtree.
var remote = logEntry.Remote ?? this;
Repository.CommandInputOutputPipe((procIn, procOut) =>
{
procIn.WriteLine(logEntry.Log);
procIn.WriteLine(GitTfsConstants.TfsCommitInfoFormat, remote.TfsUrl,
remote.TfsRepositoryPath, logEntry.ChangesetId);
procIn.Close();
commitHash = ParseCommitInfo(procOut.ReadToEnd());
}, BuildCommitCommand(logEntry));
return commitHash;
}
示例8: MakeNewLogEntry
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;
}
示例9: BuildCommitCommand
private string[] BuildCommitCommand(LogEntry logEntry)
{
var commitCommand = new List<string> { "commit-tree", logEntry.Tree };
foreach (var parent in logEntry.CommitParents)
{
commitCommand.Add("-p");
commitCommand.Add(parent);
}
return commitCommand.ToArray();
}