/// <exception cref="NGit.Errors.TransportException"></exception>
			public SshPushConnection(TransportGitSsh _enclosing) : base(_enclosing)
			{
				this._enclosing = _enclosing;
				try
				{
					this.process = this._enclosing.GetSession().Exec(this._enclosing.CommandFor(this.
						_enclosing.GetOptionReceivePack()), this._enclosing.GetTimeout());
					MessageWriter msg = new MessageWriter();
					this.SetMessageWriter(msg);
					InputStream rpErr = this.process.GetErrorStream();
					this.errorThread = new StreamCopyThread(rpErr, msg.GetRawStream());
					this.errorThread.Start();
					this.Init(this.process.GetInputStream(), this.process.GetOutputStream());
				}
				catch (TransportException err)
				{
					this.Close();
					throw;
				}
				catch (IOException err)
				{
					this.Close();
					throw new TransportException(this.uri, JGitText.Get().remoteHungUpUnexpectedly, err
						);
				}
				try
				{
					this.ReadAdvertisedRefs();
				}
				catch (NoRemoteRepositoryException notFound)
				{
					string msgs = this.GetMessages();
					this._enclosing.CheckExecFailure(this.process.ExitValue(), this._enclosing.GetOptionReceivePack
						(), msgs);
					throw this._enclosing.CleanNotFound(notFound, msgs);
				}
			}
			/// <exception cref="NGit.Errors.TransportException"></exception>
			internal SshPushConnection(TransportGitSsh _enclosing, TransportGitSsh.Connection
				 conn) : base(_enclosing)
			{
				this._enclosing = _enclosing;
				this.conn = conn;
				try
				{
					MessageWriter msg = new MessageWriter();
					this.SetMessageWriter(msg);
					conn.Exec(this._enclosing.GetOptionReceivePack());
					InputStream rpErr = conn.GetErrorStream();
					this.errorThread = new StreamCopyThread(rpErr, msg.GetRawStream());
					this.errorThread.Start();
					this.Init(conn.GetInputStream(), conn.GetOutputStream());
					conn.Connect();
				}
				catch (TransportException err)
				{
					this.Close();
					throw;
				}
				catch (IOException err)
				{
					this.Close();
					throw new TransportException(this.uri, JGitText.Get().remoteHungUpUnexpectedly, err
						);
				}
				try
				{
					this.ReadAdvertisedRefs();
				}
				catch (NoRemoteRepositoryException notFound)
				{
					string msgs = this.GetMessages();
					this._enclosing.CheckExecFailure(conn.GetExitStatus(), this._enclosing.GetOptionReceivePack
						(), msgs);
					throw this._enclosing.CleanNotFound(notFound, msgs);
				}
			}
Exemple #3
0
 /// <exception cref="NGit.Errors.TransportException"></exception>
 public ForkLocalPushConnection(TransportLocal _enclosing)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
     MessageWriter msg = new MessageWriter();
     this.SetMessageWriter(msg);
     this.receivePack = this._enclosing.Spawn(this._enclosing.GetOptionReceivePack());
     InputStream rpErr = this.receivePack.GetErrorStream();
     this.errorReaderThread = new StreamCopyThread(rpErr, msg.GetRawStream());
     this.errorReaderThread.Start();
     InputStream rpIn = this.receivePack.GetInputStream();
     OutputStream rpOut = this.receivePack.GetOutputStream();
     rpIn = new BufferedInputStream(rpIn);
     rpOut = new SafeBufferedOutputStream(rpOut);
     this.Init(rpIn, rpOut);
     this.ReadAdvertisedRefs();
 }
Exemple #4
0
 /// <exception cref="NGit.Errors.TransportException"></exception>
 public ForkLocalFetchConnection(TransportLocal _enclosing)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
     MessageWriter msg = new MessageWriter();
     this.SetMessageWriter(msg);
     this.uploadPack = this._enclosing.Spawn(this._enclosing.GetOptionUploadPack());
     InputStream upErr = this.uploadPack.GetErrorStream();
     this.errorReaderThread = new StreamCopyThread(upErr, msg.GetRawStream());
     this.errorReaderThread.Start();
     InputStream upIn = this.uploadPack.GetInputStream();
     OutputStream upOut = this.uploadPack.GetOutputStream();
     upIn = new BufferedInputStream(upIn);
     upOut = new BufferedOutputStream(upOut);
     this.Init(upIn, upOut);
     this.ReadAdvertisedRefs();
 }