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


C# Transport.URIish类代码示例

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


URIish类属于NGit.Transport命名空间,在下文中一共展示了URIish类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Get

		public override bool Get (URIish uri, params CredentialItem[] items)
		{
			bool result = false;
			CredentialItem.Password passwordItem = null;
			CredentialItem.StringType passphraseItem = null;
			
			// We always need to run the TryGet* methods as we need the passphraseItem/passwordItem populated even
			// if the password store contains an invalid password/no password
			if (TryGetUsernamePassword (uri, items, out passwordItem) || TryGetPassphrase (uri, items, out passphraseItem)) {
				// If the password store has a password and we already tried using it, it could be incorrect.
				// If this happens, do not return true and ask the user for a new password.
				if (!HasReset) {
					return true;
				}
			}

			DispatchService.GuiSyncDispatch (delegate {
				CredentialsDialog dlg = new CredentialsDialog (uri, items);
				try {
					result = MessageService.ShowCustomDialog (dlg) == (int)Gtk.ResponseType.Ok;
				} finally {
					dlg.Destroy ();
				}
			});
				
			HasReset = false;
			if (result) {
				if (passwordItem != null) {
					PasswordService.AddWebPassword (new Uri (uri.ToString ()), new string (passwordItem.GetValue ()));
				} else if (passphraseItem != null) {
					PasswordService.AddWebPassword (new Uri (uri.ToString ()), passphraseItem.GetValue ());
				}
			}
			return result;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:35,代码来源:GitCredentials.cs

示例3: TestFileProtocol

 public virtual void TestFileProtocol()
 {
     // as defined by git docu
     URIish u = new URIish("file:///a/b.txt");
     NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
     NUnit.Framework.Assert.IsFalse(u.IsRemote());
     NUnit.Framework.Assert.IsNull(u.GetHost());
     NUnit.Framework.Assert.IsNull(u.GetPass());
     NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
     NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
     NUnit.Framework.Assert.IsNull(u.GetUser());
     NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
     FilePath tmp = FilePath.CreateTempFile("jgitUnitTest", ".tmp");
     u = new URIish(tmp.ToURI().ToString());
     NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
     NUnit.Framework.Assert.IsFalse(u.IsRemote());
     NUnit.Framework.Assert.IsNull(u.GetHost());
     NUnit.Framework.Assert.IsNull(u.GetPass());
     NUnit.Framework.Assert.IsTrue(u.GetPath().Contains("jgitUnitTest"));
     NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
     NUnit.Framework.Assert.IsNull(u.GetUser());
     NUnit.Framework.Assert.IsTrue(u.GetHumanishName().StartsWith("jgitUnitTest"));
     u = new URIish("file:/a/b.txt");
     NUnit.Framework.Assert.AreEqual("file", u.GetScheme());
     NUnit.Framework.Assert.IsFalse(u.IsRemote());
     NUnit.Framework.Assert.IsNull(u.GetHost());
     NUnit.Framework.Assert.IsNull(u.GetPass());
     NUnit.Framework.Assert.AreEqual("/a/b.txt", u.GetPath());
     NUnit.Framework.Assert.AreEqual(-1, u.GetPort());
     NUnit.Framework.Assert.IsNull(u.GetUser());
     NUnit.Framework.Assert.AreEqual("b.txt", u.GetHumanishName());
 }
开发者ID:nnieslan,项目名称:ngit,代码行数:32,代码来源:URIishTest.cs

示例4: CanHandle

		internal static bool CanHandle(URIish uri)
		{
			if (!uri.IsRemote())
			{
				return false;
			}
			string scheme = uri.GetScheme();
			if ("ssh".Equals(scheme))
			{
				return true;
			}
			if ("ssh+git".Equals(scheme))
			{
				return true;
			}
			if ("git+ssh".Equals(scheme))
			{
				return true;
			}
			if (scheme == null && uri.GetHost() != null && uri.GetPath() != null)
			{
				return true;
			}
			return false;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:25,代码来源:TransportGitSsh.cs

示例5: CanHandle

		internal static bool CanHandle(URIish uri)
		{
			if (!uri.IsRemote())
			{
				return false;
			}
			return S3_SCHEME.Equals(uri.GetScheme());
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:8,代码来源:TransportAmazonS3.cs

示例6: CredentialsDialog

		public CredentialsDialog (URIish uri, IEnumerable<CredentialItem> credentials)
		{
			this.Build ();
			this.credentials = credentials;
			
			labelTop.Text = string.Format (labelTop.Text, uri.ToString ());
			
			Gtk.Table table = new Gtk.Table (0, 0, false);
			table.ColumnSpacing = 6;
			vbox.PackStart (table, true, true, 0);
			
			uint r = 0;
			Widget firstEditor = null;
			foreach (CredentialItem c in credentials) {
				Label lab = new Label (c.GetPromptText () + ":");
				lab.Xalign = 0;
				table.Attach (lab, 0, 1, r, r + 1);
				Table.TableChild tc = (Table.TableChild) table [lab];
				tc.XOptions = AttachOptions.Shrink;
				
				Widget editor = null;
				
				if (c is CredentialItem.YesNoType) {
					CredentialItem.YesNoType cred = (CredentialItem.YesNoType) c;
					CheckButton btn = new CheckButton ();
					editor = btn;
					btn.Toggled += delegate {
						cred.SetValue (btn.Active);
					};
				}
				else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType) {
					CredentialItem cred = c;
					Entry e = new Entry ();
					editor = e;
					e.ActivatesDefault = true;
					if (cred.IsValueSecure ())
						e.Visibility = false;
					e.Changed += delegate {
						if (cred is CredentialItem.StringType)
							((CredentialItem.StringType)cred).SetValue (e.Text);
						else
							((CredentialItem.CharArrayType)cred).SetValue (e.Text.ToCharArray ());
					};
				}
				if (editor != null) {
					table.Attach (editor, 1, 2, r, r + 1);
					tc = (Table.TableChild) table [lab];
					tc.XOptions = AttachOptions.Fill;
					if (firstEditor == null)
						firstEditor = editor;
				}
				
				r++;
			}
			table.ShowAll ();
			Focus = firstEditor;
			Default = buttonOk;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:58,代码来源:CredentialsDialog.cs

示例7: CreateURI

		private static URIish CreateURI(Session session)
		{
			URIish uri = new URIish();
			uri = uri.SetScheme("ssh");
			uri = uri.SetUser(session.GetUserName());
			uri = uri.SetHost(session.GetHost());
			uri = uri.SetPort(session.GetPort());
			return uri;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:CredentialsProviderUserInfo.cs

示例8: IsUrlValid

		public override bool IsUrlValid (string url)
		{
			try {
				NGit.Transport.URIish u = new NGit.Transport.URIish (url);
				return true;
			} catch {
				return false;
			}
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:9,代码来源:GitRepository.cs

示例9: CanHandle

			public override bool CanHandle(URIish uri, Repository local, string remoteName)
			{
				if (uri.GetPath() == null || uri.GetPort() > 0 || uri.GetUser() != null || uri.GetPass
					() != null || uri.GetHost() != null || (uri.GetScheme() != null && !this.GetSchemes
					().Contains(uri.GetScheme())))
				{
					return false;
				}
				return true;
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:TransportBundleFile.cs

示例10: IsUrlValid

		public override bool IsUrlValid (string url)
		{
			try {
				NGit.Transport.URIish u = new NGit.Transport.URIish (url);
				if (!string.IsNullOrEmpty (u.GetHost ()))
					return true;
			} catch {
			}
			return base.IsUrlValid (url);
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:10,代码来源:GitRepository.cs

示例11: Get

		public override bool Get (URIish uri, params CredentialItem[] items)
		{
			bool result = false;
			DispatchService.GuiSyncDispatch (delegate {
				CredentialsDialog dlg = new CredentialsDialog (uri, items);
				try {
					result = MessageService.ShowCustomDialog (dlg) == (int)Gtk.ResponseType.Ok;
				} finally {
					dlg.Destroy ();
				}
			});
			return result;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:13,代码来源:GitCredentials.cs

示例12: CanHandle

		internal static bool CanHandle(URIish uri, FS fs)
		{
			if (uri.GetHost() != null || uri.GetPort() > 0 || uri.GetUser() != null || uri.GetPass
				() != null || uri.GetPath() == null)
			{
				return false;
			}
			if ("file".Equals(uri.GetScheme()) || uri.GetScheme() == null)
			{
				FilePath f = fs.Resolve(new FilePath("."), uri.GetPath());
				return f.IsFile() || f.GetName().EndsWith(".bundle");
			}
			return false;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:14,代码来源:TransportBundleFile.cs

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

示例14: SshTransport

		/// <summary>Create a new transport instance.</summary>
		/// <remarks>Create a new transport instance.</remarks>
		/// <param name="local">
		/// the repository this instance will fetch into, or push out of.
		/// This must be the repository passed to
		/// <see cref="Transport.Open(NGit.Repository, URIish)">Transport.Open(NGit.Repository, URIish)
		/// 	</see>
		/// .
		/// </param>
		/// <param name="uri">
		/// the URI used to access the remote repository. This must be the
		/// URI passed to
		/// <see cref="Transport.Open(NGit.Repository, URIish)">Transport.Open(NGit.Repository, URIish)
		/// 	</see>
		/// .
		/// </param>
		protected internal SshTransport(Repository local, URIish uri) : base(local, uri)
		{
			sch = SshSessionFactory.GetInstance();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:20,代码来源:SshTransport.cs

示例15: PackProtocolException

		/// <summary>
		/// Constructs an PackProtocolException with the specified detail message
		/// prefixed with provided URI.
		/// </summary>
		/// <remarks>
		/// Constructs an PackProtocolException with the specified detail message
		/// prefixed with provided URI.
		/// </remarks>
		/// <param name="uri">URI used for transport</param>
		/// <param name="s">message</param>
		/// <param name="cause">root cause exception</param>
		public PackProtocolException(URIish uri, string s, Exception cause) : this(uri + 
			": " + s, cause)
		{
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:15,代码来源:PackProtocolException.cs


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