當前位置: 首頁>>代碼示例>>C#>>正文


C# Revwalk.RevCommit類代碼示例

本文整理匯總了C#中NGit.Revwalk.RevCommit的典型用法代碼示例。如果您正苦於以下問題:C# RevCommit類的具體用法?C# RevCommit怎麽用?C# RevCommit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RevCommit類屬於NGit.Revwalk命名空間,在下文中一共展示了RevCommit類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CherryPickResult

		/// <param name="newHead">commit the head points at after this cherry-pick</param>
		/// <param name="cherryPickedRefs">list of successfully cherry-picked <code>Ref</code>'s
		/// 	</param>
		public CherryPickResult(RevCommit newHead, IList<Ref> cherryPickedRefs)
		{
			this.status = CherryPickResult.CherryPickStatus.OK;
			this.newHead = newHead;
			this.cherryPickedRefs = cherryPickedRefs;
			this.failingPaths = null;
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:10,代碼來源:CherryPickResult.cs

示例2: ValidateStashedCommit

		/// <summary>Core validation to be performed on all stashed commits</summary>
		/// <param name="commit"></param>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		private void ValidateStashedCommit(RevCommit commit)
		{
			NUnit.Framework.Assert.IsNotNull(commit);
			Ref stashRef = db.GetRef(Constants.R_STASH);
			NUnit.Framework.Assert.IsNotNull(stashRef);
			NUnit.Framework.Assert.AreEqual(commit, stashRef.GetObjectId());
			NUnit.Framework.Assert.IsNotNull(commit.GetAuthorIdent());
			NUnit.Framework.Assert.AreEqual(commit.GetAuthorIdent(), commit.GetCommitterIdent
				());
			NUnit.Framework.Assert.AreEqual(2, commit.ParentCount);
			// Load parents
			RevWalk walk = new RevWalk(db);
			try
			{
				foreach (RevCommit parent in commit.Parents)
				{
					walk.ParseBody(parent);
				}
			}
			finally
			{
				walk.Release();
			}
			NUnit.Framework.Assert.AreEqual(1, commit.GetParent(1).ParentCount);
			NUnit.Framework.Assert.AreEqual(head, commit.GetParent(1).GetParent(0));
			NUnit.Framework.Assert.IsFalse(commit.Tree.Equals(head.Tree), "Head tree matches stashed commit tree"
				);
			NUnit.Framework.Assert.AreEqual(head, commit.GetParent(0));
			NUnit.Framework.Assert.IsFalse(commit.GetFullMessage().Equals(commit.GetParent(1)
				.GetFullMessage()));
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:34,代碼來源:StashCreateCommandTest.cs

示例3: Add

		/// <summary>Add a commit if it does not have a flag set yet, then set the flag.</summary>
		/// <remarks>
		/// Add a commit if it does not have a flag set yet, then set the flag.
		/// <p>
		/// This method permits the application to test if the commit has the given
		/// flag; if it does not already have the flag than the commit is added to
		/// the queue and the flag is set. This later will prevent the commit from
		/// being added twice.
		/// </remarks>
		/// <param name="c">commit to add.</param>
		/// <param name="queueControl">flag that controls admission to the queue.</param>
		public void Add(RevCommit c, RevFlag queueControl)
		{
			if (!c.Has(queueControl))
			{
				c.Add(queueControl);
				Add(c);
			}
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:19,代碼來源:AbstractRevQueue.cs

示例4: Include

		/// <exception cref="NGit.Errors.StopWalkException"></exception>
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override bool Include(RevWalk walker, RevCommit cmit)
		{
			if (skip > count++)
			{
				return false;
			}
			return true;
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:12,代碼來源:SkipRevFilter.cs

示例5: Include

		/// <exception cref="NGit.Errors.StopWalkException"></exception>
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override bool Include(RevWalk walker, RevCommit cmit)
		{
			count++;
			if (count > maxCount)
			{
				throw StopWalkException.INSTANCE;
			}
			return true;
		}
開發者ID:nocache,項目名稱:monodevelop,代碼行數:13,代碼來源:MaxCountRevFilter.cs

示例6: CompareCommits

		/// <summary>
		/// Compares two commits and returns a list of files that have changed
		/// </summary>
		public static IEnumerable<DiffEntry> CompareCommits (NGit.Repository repo, RevCommit reference, RevCommit compared)
		{
			var changes = new List<DiffEntry>();
			if (reference == null && compared == null)
				return changes;
			ObjectId refTree = (reference != null ? reference.Tree.Id : ObjectId.ZeroId);
			ObjectId comparedTree = (compared != null ? compared.Tree.Id : ObjectId.ZeroId);
			return CompareCommits (repo, refTree, comparedTree);
		}
開發者ID:llucenic,項目名稱:monodevelop,代碼行數:12,代碼來源:GitUtil.cs

示例7: Commit

			public virtual PlotCommitListTest.CommitListAssert Commit(RevCommit id)
			{
				NUnit.Framework.Assert.IsTrue(this.pcl.Count > this.nextIndex, "Unexpected end of list at pos#"
					 + this.nextIndex);
				this.current = this.pcl[this.nextIndex++];
				NUnit.Framework.Assert.AreEqual(id.Id, this.current.Id, "Expected commit not found at pos#"
					 + (this.nextIndex - 1));
				return this;
			}
開發者ID:shoff,項目名稱:ngit,代碼行數:9,代碼來源:PlotCommitListTest.cs

示例8: GetCommitChanges

		/// <summary>
		/// Returns a list of files that have changed in a commit
		/// </summary>
		public static IEnumerable<Change> GetCommitChanges (NGit.Repository repo, RevCommit commit)
		{
			var treeIds = new[] { commit.Tree.Id }.Concat (commit.Parents.Select (c => c.Tree.Id)).ToArray ();
			var walk = new TreeWalk (repo);
			walk.Reset (treeIds);
			walk.Recursive = true;
			walk.Filter = AndTreeFilter.Create (AndTreeFilter.ANY_DIFF, AndTreeFilter.ALL);
			
			return CalculateCommitDiff (repo, walk, new[] { commit }.Concat (commit.Parents).ToArray ());
		}
開發者ID:joaonunesk,項目名稱:monodevelop,代碼行數:13,代碼來源:GitUtil.cs

示例9: Add

		public override void Add(RevCommit c)
		{
			BlockRevQueue.Block b = head;
			if (b == null || !b.CanUnpop())
			{
				b = free.NewBlock();
				b.ResetToEnd();
				b.next = head;
				head = b;
			}
			b.Unpop(c);
		}
開發者ID:nickname100,項目名稱:monodevelop,代碼行數:12,代碼來源:LIFORevQueue.cs

示例10: CheckoutCommit

		/// <exception cref="System.InvalidOperationException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private void CheckoutCommit(RevCommit commit)
		{
			RevWalk walk = new RevWalk(db);
			RevCommit head = walk.ParseCommit(db.Resolve(Constants.HEAD));
			DirCacheCheckout dco = new DirCacheCheckout(db, head.Tree, db.LockDirCache(), commit
				.Tree);
			dco.SetFailOnConflict(true);
			dco.Checkout();
			walk.Release();
			// update the HEAD
			RefUpdate refUpdate = db.UpdateRef(Constants.HEAD, true);
			refUpdate.SetNewObjectId(commit);
			refUpdate.ForceUpdate();
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:16,代碼來源:RebaseCommandTest.cs

示例11: diff_Commits

 public static List<DiffEntry> diff_Commits(this API_NGit nGit, RevCommit from_RevCommit, RevCommit to_RevCommit)
 {
     if (nGit.repository().notNull())
         try
         {
             var outputStream = NGit_Factory.New_OutputStream();
             var diffFormater = new DiffFormatter(outputStream);
             diffFormater.SetRepository(nGit.repository());
             return diffFormater.Scan(from_RevCommit, to_RevCommit).toList();
         }
         catch (Exception ex)
         {
             ex.log("[API_NGit][diff]");
         }
     return new List<DiffEntry>();
 }
開發者ID:njmube,項目名稱:FluentSharp,代碼行數:16,代碼來源:Diff_ExtensionMethods.cs

示例12: CompareCommits

		/// <summary>
		/// Compares two commits and returns a list of files that have changed
		/// </summary>
		public static IEnumerable<Change> CompareCommits (NGit.Repository repo, RevCommit reference, RevCommit compared)
		{
			var changes = new List<Change>();
			if (reference == null && compared == null)
				return changes;
			ObjectId refTree = (reference != null ? reference.Tree.Id : ObjectId.ZeroId);
			ObjectId comparedTree = (compared != null ? compared.Tree.Id : ObjectId.ZeroId);
			var walk = new TreeWalk (repo);
			if (reference == null || compared == null)
				walk.Reset ((reference ?? compared).Tree.Id);
			else
				walk.Reset (new AnyObjectId[] {refTree, comparedTree});
			walk.Recursive = true;
			walk.Filter = AndTreeFilter.Create(TreeFilter.ANY_DIFF, TreeFilter.ALL);

			return CalculateCommitDiff (repo, walk, new[] { reference, compared });
		}
開發者ID:stewartwhaley,項目名稱:monodevelop,代碼行數:20,代碼來源:GitUtil.cs

示例13: SetupRepository

		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="NGit.Api.Errors.NoFilepatternException"></exception>
		/// <exception cref="NGit.Api.Errors.NoHeadException"></exception>
		/// <exception cref="NGit.Api.Errors.NoMessageException"></exception>
		/// <exception cref="NGit.Api.Errors.ConcurrentRefUpdateException"></exception>
		/// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
		/// <exception cref="NGit.Api.Errors.WrongRepositoryStateException"></exception>
		public virtual void SetupRepository()
		{
			// create initial commit
			git = new Git(db);
			initialCommit = git.Commit().SetMessage("initial commit").Call();
			// create file
			indexFile = new FilePath(db.WorkTree, "a.txt");
			FileUtils.CreateNewFile(indexFile);
			PrintWriter writer = new PrintWriter(indexFile);
			writer.Write("content");
			writer.Flush();
			// add file and commit it
			git.Add().AddFilepattern("a.txt").Call();
			secondCommit = git.Commit().SetMessage("adding a.txt").Call();
			prestage = DirCache.Read(db.GetIndexFile(), db.FileSystem).GetEntry(indexFile.GetName
				());
			// modify file and add to index
			writer.Write("new content");
			writer.Close();
			git.Add().AddFilepattern("a.txt").Call();
			// create a file not added to the index
			untrackedFile = new FilePath(db.WorkTree, "notAddedToIndex.txt");
			FileUtils.CreateNewFile(untrackedFile);
			PrintWriter writer2 = new PrintWriter(untrackedFile);
			writer2.Write("content");
			writer2.Close();
		}
開發者ID:shoff,項目名稱:ngit,代碼行數:34,代碼來源:ResetCommandTest.cs

示例14: SetUp

		public override void SetUp()
		{
			base.SetUp();
			git = Git.Wrap(db);
			committedFile = WriteTrashFile(PATH, "content");
			git.Add().AddFilepattern(PATH).Call();
			head = git.Commit().SetMessage("add file").Call();
			NUnit.Framework.Assert.IsNotNull(head);
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:9,代碼來源:StashApplyCommandTest.cs

示例15: SetUp

 public override void SetUp()
 {
     base.SetUp();
     diskRepo = CreateBareRepository();
     refdir = (RefDirectory)diskRepo.RefDatabase;
     repo = new TestRepository<Repository>(diskRepo);
     A = repo.Commit().Create();
     B = repo.Commit(repo.GetRevWalk().ParseCommit(A));
     v1_0 = repo.Tag("v1_0", B);
     repo.GetRevWalk().ParseBody(v1_0);
 }
開發者ID:JamesChan,項目名稱:ngit,代碼行數:11,代碼來源:RefDirectoryTest.cs


注:本文中的NGit.Revwalk.RevCommit類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。