本文整理汇总了C#中NGit.Revwalk.RevCommit.GetShortMessage方法的典型用法代码示例。如果您正苦于以下问题:C# RevCommit.GetShortMessage方法的具体用法?C# RevCommit.GetShortMessage怎么用?C# RevCommit.GetShortMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit.Revwalk.RevCommit
的用法示例。
在下文中一共展示了RevCommit.GetShortMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToCommit
private static Commit ToCommit(RevCommit commit, Repository repository)
{
return new Commit
(
repository,
commit.Name,
commit.GetShortMessage(),
ToPerson(commit.GetAuthorIdent()),
ToPerson(commit.GetCommitterIdent()),
commit.GetCommitterIdent().GetWhen(),
commit.Parents.Select(p => p.Name)
);
}
示例2: TestParse_WeirdHeaderOnlyCommit
public virtual void TestParse_WeirdHeaderOnlyCommit()
{
StringBuilder b = new StringBuilder();
b.Append("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n");
b.Append("author A U. Thor <[email protected]> 1218123387 +0700\n");
b.Append("committer C O. Miter <[email protected]> 1218123390 -0500\n");
RevCommit c;
c = new RevCommit(Id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
c.ParseCanonical(new RevWalk(db), Sharpen.Runtime.GetBytesForString(b.ToString(),
"UTF-8"));
NUnit.Framework.Assert.AreEqual(string.Empty, c.GetFullMessage());
NUnit.Framework.Assert.AreEqual(string.Empty, c.GetShortMessage());
}
示例3: TestParse_explicit_bad_encoded
public virtual void TestParse_explicit_bad_encoded()
{
ByteArrayOutputStream b = new ByteArrayOutputStream();
b.Write(Sharpen.Runtime.GetBytesForString("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"
, "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("author F\u00f6r fattare <[email protected]> 1218123387 +0700\n"
, "ISO-8859-1"));
b.Write(Sharpen.Runtime.GetBytesForString("committer C O. Miter <[email protected]> 1218123390 -0500\n"
, "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("encoding EUC-JP\n", "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("\n", "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("\u304d\u308c\u3044\n", "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("\n", "UTF-8"));
b.Write(Sharpen.Runtime.GetBytesForString("Hi\n", "UTF-8"));
RevCommit c;
c = new RevCommit(Id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
// bogus id
c.ParseCanonical(new RevWalk(db), b.ToByteArray());
NUnit.Framework.Assert.AreEqual("Japanese (EUC)", c.Encoding.EncodingName);
NUnit.Framework.Assert.AreEqual("F\u00f6r fattare", c.GetAuthorIdent().GetName());
NUnit.Framework.Assert.AreEqual("\u304d\u308c\u3044", c.GetShortMessage());
NUnit.Framework.Assert.AreEqual("\u304d\u308c\u3044\n\nHi\n", c.GetFullMessage());
}
示例4: Rebase
public bool Rebase ()
{
NGit.Api.Git git = new NGit.Api.Git (repo);
if (aborted)
return false;
if (starting) {
ObjectId headId = repo.Resolve (Constants.HEAD + "^{commit}");
RevCommit headCommit = rw.ParseCommit (headId);
oldHead = headCommit;
ObjectId upstreamId = repo.Resolve (upstreamRef);
RevCommit upstreamCommit = rw.ParseCommit (upstreamId);
oldHead = headCommit;
lastGoodHead = upstreamId;
commitChain = new List<RevCommit> ();
LogCommand cmd = new NGit.Api.Git(repo).Log().AddRange(upstreamId, headCommit);
foreach (RevCommit commit in cmd.Call())
commitChain.Add(commit);
commitChain.Reverse ();
currentMergeIndex = 0;
// Checkout the upstream commit
// Reset head to upstream
GitUtil.HardReset (repo, upstreamRef);
string rebaseDir = Path.Combine (repo.Directory, "rebase-apply");
if (!Directory.Exists (rebaseDir))
Directory.CreateDirectory (rebaseDir);
string rebasingFile = Path.Combine (rebaseDir, "rebasing");
if (!File.Exists (rebasingFile))
File.WriteAllBytes (rebasingFile, new byte[0]);
starting = false;
monitor.BeginTask ("Applying local commits", commitChain.Count);
}
else {
// Conflicts resolved. Continue.
NGit.Api.AddCommand cmd = git.Add ();
var conflicts = LastMergeResult.GetConflicts ();
foreach (string conflictFile in conflicts.Keys) {
cmd.AddFilepattern (conflictFile);
}
cmd.Call ();
NGit.Api.CommitCommand commit = git.Commit ();
commit.SetMessage (currentMergeCommit.GetFullMessage ());
commit.SetAuthor (currentMergeCommit.GetAuthorIdent ());
commit.SetCommitter (currentMergeCommit.GetCommitterIdent ());
commit.Call();
}
// Merge commit by commit until the current head
while (currentMergeIndex < commitChain.Count) {
currentMergeCommit = commitChain[currentMergeIndex++];
mergeResult = GitUtil.CherryPick (repo, currentMergeCommit);
monitor.Log.WriteLine ("Applied '{0}'", currentMergeCommit.GetShortMessage ());
monitor.Step (1);
if (mergeResult.GetMergeStatus () == MergeStatus.CONFLICTING || mergeResult.GetMergeStatus () == MergeStatus.FAILED)
return false;
lastGoodHead = mergeResult.GetNewHead ();
}
monitor.EndTask ();
CleanRebaseFile ();
return true;
}