Пример #1
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
        /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
        internal virtual void Execute(DaemonClient client, string commandLine)
        {
            string     name = Sharpen.Runtime.Substring(commandLine, command.Length + 1);
            Repository db;

            try
            {
                db = client.GetDaemon().OpenRepository(client, name);
            }
            catch (ServiceMayNotContinueException e)
            {
                // An error when opening the repo means the client is expecting a ref
                // advertisement, so use that style of error.
                PacketLineOut pktOut = new PacketLineOut(client.GetOutputStream());
                pktOut.WriteString("ERR " + e.Message + "\n");
                db = null;
            }
            if (db == null)
            {
                return;
            }
            try
            {
                if (IsEnabledFor(db))
                {
                    Execute(client, db);
                }
            }
            finally
            {
                db.Close();
            }
        }
            /// <exception cref="System.IO.IOException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
            internal override void Execute(DaemonClient dc, Repository db)
            {
                ReceivePack  rp   = this._enclosing.receivePackFactory.Create(dc, db);
                InputStream  @in  = dc.GetInputStream();
                OutputStream @out = dc.GetOutputStream();

                rp.Receive(@in, @out, null);
            }
            /// <exception cref="System.IO.IOException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotEnabledException"></exception>
            /// <exception cref="NGit.Transport.Resolver.ServiceNotAuthorizedException"></exception>
            internal override void Execute(DaemonClient dc, Repository db)
            {
                UploadPack   up   = this._enclosing.uploadPackFactory.Create(dc, db);
                InputStream  @in  = dc.GetInputStream();
                OutputStream @out = dc.GetOutputStream();

                up.Upload(@in, @out, null);
            }
Пример #4
0
			/// <exception cref="System.IO.IOException"></exception>
			internal override void Execute(DaemonClient dc, Repository db)
			{
				IPAddress peer = dc.GetRemoteAddress();
				string host = peer.ToString();
				if (host == null)
				{
					host = peer.GetHostAddress();
				}
				ReceivePack rp = new ReceivePack(db);
				InputStream @in = dc.GetInputStream();
				string name = "anonymous";
				string email = name + "@" + host;
				rp.SetRefLogIdent(new PersonIdent(name, email));
				rp.SetTimeout(this._enclosing.GetTimeout());
				rp.Receive(@in, dc.GetOutputStream(), null);
			}
Пример #5
0
			/// <exception cref="System.IO.IOException"></exception>
			internal override void Execute(DaemonClient dc, Repository db)
			{
				UploadPack rp = new UploadPack(db);
				InputStream @in = dc.GetInputStream();
				rp.SetTimeout(this._enclosing.GetTimeout());
				rp.SetPackConfig(this._enclosing.packConfig);
				rp.Upload(@in, dc.GetOutputStream(), null);
			}