当前位置: 首页>>代码示例>>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;未经允许,请勿转载。