当前位置: 首页>>代码示例>>C#>>正文


C# Git.Tag方法代码示例

本文整理汇总了C#中NGit.Api.Git.Tag方法的典型用法代码示例。如果您正苦于以下问题:C# Git.Tag方法的具体用法?C# Git.Tag怎么用?C# Git.Tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NGit.Api.Git的用法示例。


在下文中一共展示了Git.Tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestTaggingOnHead

		public virtual void TestTaggingOnHead()
		{
			Git git = new Git(db);
			RevCommit commit = git.Commit().SetMessage("initial commit").Call();
			RevTag tag = git.Tag().SetName("tag").Call();
			NUnit.Framework.Assert.AreEqual(commit.Id, tag.GetObject().Id);
		}
开发者ID:shoff,项目名称:ngit,代码行数:7,代码来源:TagCommandTest.cs

示例2: TestPush

		public virtual void TestPush()
		{
			// create other repository
			Repository db2 = CreateWorkRepository();
			// setup the first repository
			StoredConfig config = ((FileBasedConfig)db.GetConfig());
			RemoteConfig remoteConfig = new RemoteConfig(config, "test");
			URIish uri = new URIish(db2.Directory.ToURI().ToURL());
			remoteConfig.AddURI(uri);
			remoteConfig.Update(config);
			config.Save();
			Git git1 = new Git(db);
			// create some refs via commits and tag
			RevCommit commit = git1.Commit().SetMessage("initial commit").Call();
			Ref tagRef = git1.Tag().SetName("tag").Call();
			try
			{
				db2.Resolve(commit.Id.GetName() + "^{commit}");
				NUnit.Framework.Assert.Fail("id shouldn't exist yet");
			}
			catch (MissingObjectException)
			{
			}
			// we should get here
			RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x");
			git1.Push().SetRemote("test").SetRefSpecs(spec).Call();
			NUnit.Framework.Assert.AreEqual(commit.Id, db2.Resolve(commit.Id.GetName() + "^{commit}"
				));
			NUnit.Framework.Assert.AreEqual(tagRef.GetObjectId(), db2.Resolve(tagRef.GetObjectId
				().GetName()));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:31,代码来源:PushCommandTest.cs

示例3: SetUp

		/// <exception cref="System.Exception"></exception>
		public override void SetUp()
		{
			base.SetUp();
			git = new Git(db);
			// commit something
			WriteTrashFile("Test.txt", "Hello world");
			git.Add().AddFilepattern("Test.txt").Call();
			git.Commit().SetMessage("Initial commit").Call();
			// create a master branch and switch to it
			git.BranchCreate().SetName("test").Call();
			RefUpdate rup = db.UpdateRef(Constants.HEAD);
			rup.Link("refs/heads/test");
			// tags
			git.Tag().SetName("tag1").Call();
			git.Tag().SetName("tag2").Call();
			git.Tag().SetName("tag3").Call();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:18,代码来源:LsRemoteCommandTest.cs

示例4: TestTagging

		public virtual void TestTagging()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			RevCommit commit = git.Commit().SetMessage("second commit").Call();
			git.Commit().SetMessage("third commit").Call();
			Ref tagRef = git.Tag().SetObjectId(commit).SetName("tag").Call();
			NUnit.Framework.Assert.AreEqual(commit.Id, db.Peel(tagRef).GetPeeledObjectId());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:TagCommandTest.cs

示例5: TestDelete

 public virtual void TestDelete()
 {
     Git git = new Git(db);
     git.Commit().SetMessage("initial commit").Call();
     RevTag tag = git.Tag().SetName("tag").Call();
     NUnit.Framework.Assert.AreEqual(1, db.GetTags().Count);
     IList<string> deleted = git.TagDelete().SetTags(tag.GetTagName()).Call();
     NUnit.Framework.Assert.AreEqual(1, deleted.Count);
     NUnit.Framework.Assert.AreEqual(tag.GetTagName(), Repository.ShortenRefName(deleted
         [0]));
     NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
     RevTag tag1 = git.Tag().SetName("tag1").Call();
     RevTag tag2 = git.Tag().SetName("tag2").Call();
     NUnit.Framework.Assert.AreEqual(2, db.GetTags().Count);
     deleted = git.TagDelete().SetTags(tag1.GetTagName(), tag2.GetTagName()).Call();
     NUnit.Framework.Assert.AreEqual(2, deleted.Count);
     NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:18,代码来源:TagCommandTest.cs

示例6: TestTaggingOnHead

		public virtual void TestTaggingOnHead()
		{
			Git git = new Git(db);
			RevCommit commit = git.Commit().SetMessage("initial commit").Call();
			Ref tagRef = git.Tag().SetName("tag").Call();
			NUnit.Framework.Assert.AreEqual(commit.Id, db.Peel(tagRef).GetPeeledObjectId());
			RevWalk walk = new RevWalk(db);
			NUnit.Framework.Assert.AreEqual("tag", walk.ParseTag(tagRef.GetObjectId()).GetTagName
				());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:TagCommandTest.cs

示例7: SetUp

		/// <exception cref="System.Exception"></exception>
		public override void SetUp()
		{
			base.SetUp();
			tr = new TestRepository<Repository>(db);
			git = new Git(db);
			// commit something
			WriteTrashFile("Test.txt", "Hello world");
			git.Add().AddFilepattern("Test.txt").Call();
			git.Commit().SetMessage("Initial commit").Call();
			// create a master branch and switch to it
			git.BranchCreate().SetName("test").Call();
			RefUpdate rup = db.UpdateRef(Constants.HEAD);
			rup.Link("refs/heads/test");
			// commit something on the test branch
			WriteTrashFile("Test.txt", "Some change");
			git.Add().AddFilepattern("Test.txt").Call();
			git.Commit().SetMessage("Second commit").Call();
			RevBlob blob = tr.Blob("blob-not-in-master-branch");
			git.Tag().SetName("tag-for-blob").SetObjectId(blob).Call();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:21,代码来源:CloneCommandTest.cs

示例8: TestFetch

		public virtual void TestFetch()
		{
			// create other repository
			Repository db2 = CreateWorkRepository();
			Git git2 = new Git(db2);
			// setup the first repository to fetch from the second repository
			StoredConfig config = ((FileBasedConfig)db.GetConfig());
			RemoteConfig remoteConfig = new RemoteConfig(config, "test");
			URIish uri = new URIish(db2.Directory.ToURI().ToURL());
			remoteConfig.AddURI(uri);
			remoteConfig.Update(config);
			config.Save();
			// create some refs via commits and tag
			RevCommit commit = git2.Commit().SetMessage("initial commit").Call();
			RevTag tag = git2.Tag().SetName("tag").Call();
			Git git1 = new Git(db);
			RefSpec spec = new RefSpec("refs/heads/master:refs/heads/x");
			git1.Fetch().SetRemote("test").SetRefSpecs(spec).Call();
			NUnit.Framework.Assert.AreEqual(commit.Id, db.Resolve(commit.Id.GetName() + "^{commit}"
				));
			NUnit.Framework.Assert.AreEqual(tag.Id, db.Resolve(tag.Id.GetName()));
		}
开发者ID:shoff,项目名称:ngit,代码行数:22,代码来源:FetchCommandTest.cs

示例9: TestEmptyTagName

		public virtual void TestEmptyTagName()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			try
			{
				// forget to tag name
				git.Tag().SetMessage("some message").Call();
				NUnit.Framework.Assert.Fail("We should have failed without a tag name");
			}
			catch (InvalidTagNameException)
			{
			}
		}
开发者ID:shoff,项目名称:ngit,代码行数:14,代码来源:TagCommandTest.cs

示例10: TestFailureOnSignedTags

		public virtual void TestFailureOnSignedTags()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			try
			{
				git.Tag().SetSigned(true).SetName("tag").Call();
				NUnit.Framework.Assert.Fail("We should have failed with an UnsupportedOperationException due to signed tag"
					);
			}
			catch (NotSupportedException)
			{
			}
		}
开发者ID:shoff,项目名称:ngit,代码行数:14,代码来源:TagCommandTest.cs

示例11: TestInvalidTagName

		public virtual void TestInvalidTagName()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			try
			{
				git.Tag().SetName("bad~tag~name").SetMessage("some message").Call();
				NUnit.Framework.Assert.Fail("We should have failed due to a bad tag name");
			}
			catch (InvalidTagNameException)
			{
			}
		}
开发者ID:shoff,项目名称:ngit,代码行数:13,代码来源:TagCommandTest.cs

示例12: TestListAllTagsInRepositoryInOrder

		public virtual void TestListAllTagsInRepositoryInOrder()
		{
			Git git = new Git(db);
			git.Add().AddFilepattern("*").Call();
			git.Commit().SetMessage("initial commit").Call();
			git.Tag().SetName("v3").Call();
			git.Tag().SetName("v2").Call();
			git.Tag().SetName("v10").Call();
			IList<Ref> list = git.TagList().Call();
			NUnit.Framework.Assert.AreEqual(3, list.Count);
			NUnit.Framework.Assert.AreEqual("refs/tags/v10", list[0].GetName());
			NUnit.Framework.Assert.AreEqual("refs/tags/v2", list[1].GetName());
			NUnit.Framework.Assert.AreEqual("refs/tags/v3", list[2].GetName());
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:14,代码来源:TagCommandTest.cs

示例13: TestDeleteFullName

		public virtual void TestDeleteFullName()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			Ref tagRef = git.Tag().SetName("tag").Call();
			NUnit.Framework.Assert.AreEqual(1, db.GetTags().Count);
			IList<string> deleted = git.TagDelete().SetTags(Repository.ShortenRefName(tagRef.
				GetName())).Call();
			NUnit.Framework.Assert.AreEqual(1, deleted.Count);
			NUnit.Framework.Assert.AreEqual(tagRef.GetName(), deleted[0]);
			NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:12,代码来源:TagCommandTest.cs

示例14: TestDelete

		public virtual void TestDelete()
		{
			Git git = new Git(db);
			git.Commit().SetMessage("initial commit").Call();
			Ref tagRef = git.Tag().SetName("tag").Call();
			NUnit.Framework.Assert.AreEqual(1, db.GetTags().Count);
			IList<string> deleted = git.TagDelete().SetTags(tagRef.GetName()).Call();
			NUnit.Framework.Assert.AreEqual(1, deleted.Count);
			NUnit.Framework.Assert.AreEqual(tagRef.GetName(), deleted[0]);
			NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
			Ref tagRef1 = git.Tag().SetName("tag1").Call();
			Ref tagRef2 = git.Tag().SetName("tag2").Call();
			NUnit.Framework.Assert.AreEqual(2, db.GetTags().Count);
			deleted = git.TagDelete().SetTags(tagRef1.GetName(), tagRef2.GetName()).Call();
			NUnit.Framework.Assert.AreEqual(2, deleted.Count);
			NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:17,代码来源:TagCommandTest.cs

示例15: TestDeleteFullName

 public virtual void TestDeleteFullName()
 {
     Git git = new Git(db);
     git.Commit().SetMessage("initial commit").Call();
     RevTag tag = git.Tag().SetName("tag").Call();
     NUnit.Framework.Assert.AreEqual(1, db.GetTags().Count);
     IList<string> deleted = git.TagDelete().SetTags(Constants.R_TAGS + tag.GetTagName
         ()).Call();
     NUnit.Framework.Assert.AreEqual(1, deleted.Count);
     NUnit.Framework.Assert.AreEqual(Constants.R_TAGS + tag.GetTagName(), deleted[0]);
     NUnit.Framework.Assert.AreEqual(0, db.GetTags().Count);
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:12,代码来源:TagCommandTest.cs


注:本文中的NGit.Api.Git.Tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。