當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。