• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Transport.RemoteConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NGit.Transport.RemoteConfig的典型用法代码示例。如果您正苦于以下问题:C# RemoteConfig类的具体用法?C# RemoteConfig怎么用?C# RemoteConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RemoteConfig类属于NGit.Transport命名空间,在下文中一共展示了RemoteConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: TestSimple

		public virtual void TestSimple()
		{
			ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
				 "fetch = +refs/heads/*:refs/remotes/spearce/*\n");
			RemoteConfig rc = new RemoteConfig(config, "spearce");
			IList<URIish> allURIs = rc.URIs;
			RefSpec spec;
			NUnit.Framework.Assert.AreEqual("spearce", rc.Name);
			NUnit.Framework.Assert.IsNotNull(allURIs);
			NUnit.Framework.Assert.IsNotNull(rc.FetchRefSpecs);
			NUnit.Framework.Assert.IsNotNull(rc.PushRefSpecs);
			NUnit.Framework.Assert.IsNotNull(rc.TagOpt);
			NUnit.Framework.Assert.AreEqual(0, rc.Timeout);
			NUnit.Framework.Assert.AreEqual(TagOpt.AUTO_FOLLOW, rc.TagOpt);
			NUnit.Framework.Assert.AreEqual(1, allURIs.Count);
			NUnit.Framework.Assert.AreEqual("http://www.spearce.org/egit.git", allURIs[0].ToString
				());
			NUnit.Framework.Assert.AreEqual(1, rc.FetchRefSpecs.Count);
			spec = rc.FetchRefSpecs[0];
			NUnit.Framework.Assert.IsTrue(spec.IsForceUpdate());
			NUnit.Framework.Assert.IsTrue(spec.IsWildcard());
			NUnit.Framework.Assert.AreEqual("refs/heads/*", spec.GetSource());
			NUnit.Framework.Assert.AreEqual("refs/remotes/spearce/*", spec.GetDestination());
			NUnit.Framework.Assert.AreEqual(0, rc.PushRefSpecs.Count);
		}
开发者ID:shoff,项目名称:ngit,代码行数:25,代码来源:RemoteConfigTest.cs


示例3: SetUp

 public override void SetUp()
 {
     base.SetUp();
     Config config = ((FileBasedConfig)db.GetConfig());
     remoteConfig = new RemoteConfig(config, "test");
     remoteConfig.AddURI(new URIish("http://everyones.loves.git/u/2"));
     transport = null;
 }
开发者ID:stinos,项目名称:ngit,代码行数:8,代码来源:TransportTest.cs


示例4: 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


示例5: Open

 /// <summary>Open a new transport instance to connect two repositories.</summary>
 /// <remarks>
 /// Open a new transport instance to connect two repositories.
 /// <p>
 /// This method assumes
 /// <see cref="Operation.FETCH">Operation.FETCH</see>
 /// .
 /// </remarks>
 /// <param name="local">existing local repository.</param>
 /// <param name="cfg">
 /// configuration describing how to connect to the remote
 /// repository.
 /// </param>
 /// <returns>
 /// the new transport instance. Never null. In case of multiple URIs
 /// in remote configuration, only the first is chosen.
 /// </returns>
 /// <exception cref="System.NotSupportedException">the protocol specified is not supported.
 /// 	</exception>
 /// <exception cref="NGit.Errors.TransportException">the transport cannot open this URI.
 /// 	</exception>
 /// <exception cref="System.ArgumentException">
 /// if provided remote configuration doesn't have any URI
 /// associated.
 /// </exception>
 public static NGit.Transport.Transport Open(Repository local, RemoteConfig cfg)
 {
     return Open(local, cfg, Transport.Operation.FETCH);
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:29,代码来源:Transport.cs


示例6: GetURIs

        private static IList<URIish> GetURIs(RemoteConfig cfg, Transport.Operation op)
        {
            switch (op)
            {
                case Transport.Operation.FETCH:
                {
                    return cfg.URIs;
                }

                case Transport.Operation.PUSH:
                {
                    IList<URIish> uris = cfg.PushURIs;
                    if (uris.IsEmpty())
                    {
                        uris = cfg.URIs;
                    }
                    return uris;
                }

                default:
                {
                    throw new ArgumentException(op.ToString());
                }
            }
        }
开发者ID:kenji-tan,项目名称:ngit,代码行数:25,代码来源:Transport.cs


示例7: Push

		public void Push (IProgressMonitor monitor, string remote, string remoteBranch)
		{
			RemoteConfig remoteConfig = new RemoteConfig (RootRepository.GetConfig (), remote);
			Transport tp = Transport.Open (RootRepository, remoteConfig);
			
			string remoteRef = "refs/heads/" + remoteBranch;
			
			RemoteRefUpdate rr = new RemoteRefUpdate (RootRepository, RootRepository.GetBranch (), remoteRef, false, null, null);
			List<RemoteRefUpdate> list = new List<RemoteRefUpdate> ();
			list.Add (rr);
			using (var gm = new GitMonitor (monitor))
				tp.Push (gm, list);
			switch (rr.GetStatus ()) {
			case RemoteRefUpdate.Status.UP_TO_DATE: monitor.ReportSuccess (GettextCatalog.GetString ("Remote branch is up to date.")); break;
			case RemoteRefUpdate.Status.REJECTED_NODELETE: monitor.ReportError (GettextCatalog.GetString ("The server is configured to deny deletion of the branch"), null); break;
			case RemoteRefUpdate.Status.REJECTED_NONFASTFORWARD: monitor.ReportError (GettextCatalog.GetString ("The update is a non-fast-forward update. Merge the remote changes before pushing again."), null); break;
			case RemoteRefUpdate.Status.OK:
				monitor.ReportSuccess (GettextCatalog.GetString ("Push operation successfully completed."));
				// Update the remote branch
				ObjectId headId = rr.GetNewObjectId ();
				RefUpdate updateRef = RootRepository.UpdateRef (Constants.R_REMOTES + remote + "/" + remoteBranch);
				updateRef.SetNewObjectId(headId);
				updateRef.Update();
				break;
			default:
				string msg = rr.GetMessage ();
				msg = !string.IsNullOrEmpty (msg) ? msg : GettextCatalog.GetString ("Push operation failed");
				monitor.ReportError (msg, null);
				break;
			}
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:31,代码来源:GitRepository.cs


示例8: TestUploadPack

		public virtual void TestUploadPack()
		{
			ReadConfig("[remote \"example\"]\n" + "url = [email protected]:egit.git\n" + "fetch = +refs/heads/*:refs/remotes/example/*\n"
				 + "uploadpack = /path/to/git/git-upload-pack\n" + "receivepack = /path/to/git/git-receive-pack\n"
				);
			RemoteConfig rc = new RemoteConfig(config, "example");
			IList<URIish> allURIs = rc.URIs;
			RefSpec spec;
			NUnit.Framework.Assert.AreEqual("example", rc.Name);
			NUnit.Framework.Assert.IsNotNull(allURIs);
			NUnit.Framework.Assert.IsNotNull(rc.FetchRefSpecs);
			NUnit.Framework.Assert.IsNotNull(rc.PushRefSpecs);
			NUnit.Framework.Assert.AreEqual(1, allURIs.Count);
			NUnit.Framework.Assert.AreEqual("[email protected]:egit.git", allURIs[0].ToString(
				));
			NUnit.Framework.Assert.AreEqual(1, rc.FetchRefSpecs.Count);
			spec = rc.FetchRefSpecs[0];
			NUnit.Framework.Assert.IsTrue(spec.IsForceUpdate());
			NUnit.Framework.Assert.IsTrue(spec.IsWildcard());
			NUnit.Framework.Assert.AreEqual("refs/heads/*", spec.GetSource());
			NUnit.Framework.Assert.AreEqual("refs/remotes/example/*", spec.GetDestination());
			NUnit.Framework.Assert.AreEqual(0, rc.PushRefSpecs.Count);
			NUnit.Framework.Assert.AreEqual("/path/to/git/git-upload-pack", rc.UploadPack);
			NUnit.Framework.Assert.AreEqual("/path/to/git/git-receive-pack", rc.ReceivePack);
		}
开发者ID:shoff,项目名称:ngit,代码行数:25,代码来源:RemoteConfigTest.cs


示例9: OpenAll

        /// <summary>Open new transport instances to connect two repositories.</summary>
        /// <remarks>
        /// Open new transport instances to connect two repositories.
        /// <p>
        /// This method assumes
        /// <see cref="Operation.FETCH">Operation.FETCH</see>
        /// .
        /// </remarks>
        /// <param name="local">existing local repository.</param>
        /// <param name="cfg">
        /// configuration describing how to connect to the remote
        /// repository.
        /// </param>
        /// <returns>
        /// the list of new transport instances for every URI in remote
        /// configuration.
        /// </returns>
        /// <exception cref="System.NotSupportedException">the protocol specified is not supported.
        /// 	</exception>
        /// <exception cref="NGit.Errors.TransportException">the transport cannot open this URI.
        /// 	</exception>
        public static IList<NGit.Transport.Transport> OpenAll(Repository local, RemoteConfig
			 cfg)
        {
            return OpenAll(local, cfg, Transport.Operation.FETCH);
        }
开发者ID:kenji-tan,项目名称:ngit,代码行数:26,代码来源:Transport.cs


示例10: ApplyConfig

 /// <summary>Apply provided remote configuration on this transport.</summary>
 /// <remarks>Apply provided remote configuration on this transport.</remarks>
 /// <param name="cfg">configuration to apply on this transport.</param>
 public virtual void ApplyConfig(RemoteConfig cfg)
 {
     SetOptionUploadPack(cfg.UploadPack);
     SetOptionReceivePack(cfg.ReceivePack);
     SetTagOpt(cfg.TagOpt);
     fetch = cfg.FetchRefSpecs;
     push = cfg.PushRefSpecs;
     timeout = cfg.Timeout;
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:12,代码来源:Transport.cs


示例11: TestSaveAllTags

		public virtual void TestSaveAllTags()
		{
			RemoteConfig rc = new RemoteConfig(config, "origin");
			rc.AddURI(new URIish("/some/dir"));
			rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*"));
			rc.TagOpt = TagOpt.FETCH_TAGS;
			rc.Update(config);
			CheckConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n"
				 + "\ttagopt = --tags\n");
		}
开发者ID:shoff,项目名称:ngit,代码行数:10,代码来源:RemoteConfigTest.cs


示例12: TestSimpleTimeout

		public virtual void TestSimpleTimeout()
		{
			ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
				 "fetch = +refs/heads/*:refs/remotes/spearce/*\n" + "timeout = 12\n");
			RemoteConfig rc = new RemoteConfig(config, "spearce");
			NUnit.Framework.Assert.AreEqual(12, rc.Timeout);
		}
开发者ID:shoff,项目名称:ngit,代码行数:7,代码来源:RemoteConfigTest.cs


示例13: TestRemoveOnlyURI

		public virtual void TestRemoveOnlyURI()
		{
			ReadConfig(string.Empty);
			URIish a = new URIish("/some/dir");
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.IsTrue(rc.RemoveURI(a));
			NUnit.Framework.Assert.AreEqual(0, rc.URIs.Count);
		}
开发者ID:shoff,项目名称:ngit,代码行数:11,代码来源:RemoteConfigTest.cs


示例14: TestSaveRemoveFirstURI

		public virtual void TestSaveRemoveFirstURI()
		{
			ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
				 "url = /some/dir\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n");
			RemoteConfig rc = new RemoteConfig(config, "spearce");
			NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
			rc.RemoveURI(new URIish("http://www.spearce.org/egit.git"));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
			rc.Update(config);
			CheckConfig("[remote \"spearce\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"
				);
		}
开发者ID:shoff,项目名称:ngit,代码行数:12,代码来源:RemoteConfigTest.cs


示例15: TestRemoveLastURI

		public virtual void TestRemoveLastURI()
		{
			ReadConfig(string.Empty);
			URIish a = new URIish("/some/dir");
			URIish b = new URIish("/another/dir");
			URIish c = new URIish("/more/dirs");
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.IsTrue(rc.AddURI(a));
			NUnit.Framework.Assert.IsTrue(rc.AddURI(b));
			NUnit.Framework.Assert.IsTrue(rc.AddURI(c));
			NUnit.Framework.Assert.AreEqual(3, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
			NUnit.Framework.Assert.AreSame(c, rc.URIs[2]);
			NUnit.Framework.Assert.IsTrue(rc.RemoveURI(c));
			NUnit.Framework.Assert.AreEqual(2, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(a, rc.URIs[0]);
			NUnit.Framework.Assert.AreSame(b, rc.URIs[1]);
		}
开发者ID:shoff,项目名称:ngit,代码行数:19,代码来源:RemoteConfigTest.cs


示例16: TestAddURI

		public virtual void TestAddURI()
		{
			ReadConfig(string.Empty);
			URIish uri = new URIish("/some/dir");
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.AreEqual(0, rc.URIs.Count);
			NUnit.Framework.Assert.IsTrue(rc.AddURI(uri));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
			NUnit.Framework.Assert.AreSame(uri, rc.URIs[0]);
			NUnit.Framework.Assert.IsFalse(rc.AddURI(new URIish(uri.ToString())));
			NUnit.Framework.Assert.AreEqual(1, rc.URIs.Count);
		}
开发者ID:shoff,项目名称:ngit,代码行数:12,代码来源:RemoteConfigTest.cs


示例17: TestUnknown

		public virtual void TestUnknown()
		{
			ReadConfig(string.Empty);
			RemoteConfig rc = new RemoteConfig(config, "backup");
			NUnit.Framework.Assert.AreEqual(0, rc.URIs.Count);
			NUnit.Framework.Assert.AreEqual(0, rc.FetchRefSpecs.Count);
			NUnit.Framework.Assert.AreEqual(0, rc.PushRefSpecs.Count);
			NUnit.Framework.Assert.AreEqual("git-upload-pack", rc.UploadPack);
			NUnit.Framework.Assert.AreEqual("git-receive-pack", rc.ReceivePack);
		}
开发者ID:shoff,项目名称:ngit,代码行数:10,代码来源:RemoteConfigTest.cs


示例18: TestSaveTimeout

		public virtual void TestSaveTimeout()
		{
			RemoteConfig rc = new RemoteConfig(config, "origin");
			rc.AddURI(new URIish("/some/dir"));
			rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*"));
			rc.Timeout = 60;
			rc.Update(config);
			CheckConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n"
				 + "\ttimeout = 60\n");
		}
开发者ID:shoff,项目名称:ngit,代码行数:10,代码来源:RemoteConfigTest.cs


示例19: RemoteSource

		internal RemoteSource (StoredConfig cfg, RemoteConfig rem)
		{
			this.cfg = cfg;
			RepoRemote = rem;
			Name = rem.Name;
			FetchUrl = rem.URIs.Select (u => u.ToString ()).FirstOrDefault ();
			PushUrl = rem.PushURIs.Select (u => u.ToString ()).FirstOrDefault ();
			if (string.IsNullOrEmpty (PushUrl))
				PushUrl = FetchUrl;
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:10,代码来源:GitRepository.cs


示例20: TestSimpleAlwaysTags

		public virtual void TestSimpleAlwaysTags()
		{
			ReadConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" +
				 "fetch = +refs/heads/*:refs/remotes/spearce/*\n" + "tagopt = --tags\n");
			RemoteConfig rc = new RemoteConfig(config, "spearce");
			NUnit.Framework.Assert.AreEqual(TagOpt.FETCH_TAGS, rc.TagOpt);
		}
开发者ID:shoff,项目名称:ngit,代码行数:7,代码来源:RemoteConfigTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Transport.URIish类代码示例发布时间:2022-05-26
下一篇:
C# Transport.PackParser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap