Exemplo n.º 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();
            }
        }
Exemplo n.º 2
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   = client.GetDaemon().OpenRepository(client, name);

            if (db == null)
            {
                return;
            }
            try
            {
                if (IsEnabledFor(db))
                {
                    Execute(client, db);
                }
            }
            finally
            {
                db.Close();
            }
        }