本文整理汇总了C#中ITfsChangeset类的典型用法代码示例。如果您正苦于以下问题:C# ITfsChangeset类的具体用法?C# ITfsChangeset怎么用?C# ITfsChangeset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITfsChangeset类属于命名空间,在下文中一共展示了ITfsChangeset类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: quickFetch
private void quickFetch(ITfsChangeset changeset)
{
AssertTemporaryIndexEmpty();
var log = CopyTree(MaxCommitHash, changeset);
UpdateRef(Commit(log), changeset.Summary.ChangesetId);
DoGcIfNeeded();
}
示例2: Apply
public void Apply(ITfsChangeset changeset, string destinationRef)
{
var log = Apply(MaxCommitHash, changeset);
var commit = Commit(log);
Repository.CommandNoisy("update-ref", destinationRef, commit);
}
示例3: CopyTree
private LogEntry CopyTree(string lastCommit, ITfsChangeset changeset)
{
LogEntry result = null;
WithTemporaryIndex(
() => GitIndexInfo.Do(Repository, index => result = changeset.CopyTree(index)));
WithTemporaryIndex(
() => result.Tree = Repository.CommandOneline("write-tree"));
if (!String.IsNullOrEmpty(lastCommit)) result.CommitParents.Add(lastCommit);
return result;
}
示例4: 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;
}
示例5: ProcessMergeChangeset
private bool ProcessMergeChangeset(ITfsChangeset changeset, bool stopOnFailMergeCommit, ref string parentCommit)
{
if (!Tfs.CanGetBranchInformation)
{
stdout.WriteLine("info: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But was not treated as is because this version of TFS can't manage branches...");
}
else if (!IsIgnoringBranches())
{
var parentChangesetId = Tfs.FindMergeChangesetParent(TfsRepositoryPath, changeset.Summary.ChangesetId, this);
if (parentChangesetId < 1) // Handle missing merge parent info
{
if (stopOnFailMergeCommit)
{
return false;
}
stdout.WriteLine("warning: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But git-tfs is unable to determine the parent changeset.");
return true;
}
var shaParent = Repository.FindCommitHashByChangesetId(parentChangesetId);
if (shaParent == null)
{
string omittedParentBranch;
shaParent = FindMergedRemoteAndFetch(parentChangesetId, stopOnFailMergeCommit, out omittedParentBranch);
changeset.OmittedParentBranch = omittedParentBranch;
}
if (shaParent != null)
{
parentCommit = shaParent;
}
else
{
if (stopOnFailMergeCommit)
return false;
stdout.WriteLine("warning: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But git-tfs failed to find and fetch the parent changeset "
+ parentChangesetId + ". Parent changeset will be ignored...");
}
}
else
{
stdout.WriteLine("info: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But was not treated as is because of your git setting...");
changeset.OmittedParentBranch = ";C" + changeset.Summary.ChangesetId;
}
return true;
}
示例6: Apply
private LogEntry Apply(string parent, ITfsChangeset changeset, IDictionary<string, GitObject> entries, Action<Exception> ignorableErrorHandler)
{
LogEntry result = null;
WithWorkspace(changeset.Summary, workspace =>
{
var treeBuilder = workspace.Remote.Repository.GetTreeBuilder(parent);
result = changeset.Apply(parent, treeBuilder, workspace, entries, ignorableErrorHandler);
result.Tree = treeBuilder.GetTree();
});
if (!String.IsNullOrEmpty(parent)) result.CommitParents.Add(parent);
return result;
}
示例7: CopyTree
private LogEntry CopyTree(string lastCommit, ITfsChangeset changeset)
{
LogEntry result = null;
WithWorkspace(changeset.Summary, workspace => {
var treeBuilder = workspace.Remote.Repository.GetTreeBuilder(null);
result = changeset.CopyTree(treeBuilder, workspace);
result.Tree = treeBuilder.GetTree();
});
if (!String.IsNullOrEmpty(lastCommit)) result.CommitParents.Add(lastCommit);
return result;
}
示例8: CopyTree
private LogEntry CopyTree(string lastCommit, ITfsChangeset changeset)
{
LogEntry result = null;
WithTemporaryIndex(() => Tfs.WithWorkspace(WorkingDirectory, this, changeset.Summary, workspace => {
GitIndexInfo.Do(Repository, index => result = changeset.CopyTree(index, workspace));
result.Tree = Repository.CommandOneline("write-tree");
}));
if (!String.IsNullOrEmpty(lastCommit)) result.CommitParents.Add(lastCommit);
return result;
}
示例9: quickFetch
private void quickFetch(ITfsChangeset changeset)
{
var log = CopyTree(MaxCommitHash, changeset);
UpdateTfsHead(Commit(log), changeset.Summary.ChangesetId);
DoGcIfNeeded();
}
示例10: CommitChangeset
private string CommitChangeset(ITfsChangeset changeset, string parent)
{
var log = Apply(parent, changeset);
return Commit(log);
}
示例11: Apply
private LogEntry Apply(string parent, ITfsChangeset changeset)
{
LogEntry result = null;
WithTemporaryIndex(() => WithWorkspace(changeset.Summary, workspace =>
{
AssertTemporaryIndexClean(parent);
GitIndexInfo.Do(Repository, index => result = changeset.Apply(parent, index, workspace));
result.Tree = Repository.CommandOneline("write-tree");
}));
if (!String.IsNullOrEmpty(parent)) result.CommitParents.Add(parent);
return result;
}
示例12: ProcessMergeChangeset
private bool ProcessMergeChangeset(ITfsChangeset changeset, bool stopOnFailMergeCommit, ref string parentCommit)
{
var parentChangesetId = Tfs.FindMergeChangesetParent(TfsRepositoryPath, changeset.Summary.ChangesetId, this);
var shaParent = Repository.FindCommitHashByChangesetId(parentChangesetId);
if (shaParent == null)
shaParent = FindMergedRemoteAndFetch(parentChangesetId, stopOnFailMergeCommit);
if (shaParent != null)
{
parentCommit = shaParent;
}
else
{
if (stopOnFailMergeCommit)
{
return false;
}
//TODO : Manage case where there is not yet a git commit for the parent changset!!!!!
stdout.WriteLine("warning: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But it can't have been managed accordingly because one of the parent changeset "
+ parentChangesetId +
" is not present in the repository! If you want to do it, fetch the branch containing this changeset before retrying...");
}
return true;
}
示例13: Apply
private LogEntry Apply(string parent, ITfsChangeset changeset)
{
IDictionary<string, GitObject> entries = new Dictionary<string, GitObject>(StringComparer.InvariantCultureIgnoreCase);
return Apply(parent, changeset, entries);
}
示例14: Apply
public void Apply(ITfsChangeset changeset, string destinationRef)
{
var log = Apply(MaxCommitHash, changeset);
var commit = Commit(log);
Repository.UpdateRef(destinationRef, commit);
}