Exemplo n.º 1
0
        ObjectId Resolve(string s)
        {
            Core.Repository repo = GitSharp.Commands.Repository;
            ObjectId        r    = repo.Resolve(s);

            if (r == null)
            {
                throw die("Not a revision: " + s);
            }
            return(r);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a command for use including the repository and output support.
        /// </summary>
        /// <param name="repo">Specifies the repository to use.</param>
        /// <param name="path"></param>
        public void Init(Core.Repository repo, DirectoryInfo path)
        {
            try
            {
#if ported
                String outputEncoding = repo != null?repo.Config.getString("i18n", null, "logOutputEncoding") : null;

                if (outputEncoding != null)
                {
                    streamOut = new StreamWriter(Console.OpenStandardOutput(), outputEncoding);
                    Console.SetOut(streamOut);
                }
                else
                {
#endif
                //Initialize the output stream for all console-based messages.
                GitSharp.Commands.OutputStream = new StreamWriter(Console.OpenStandardOutput());
                Console.SetOut(GitSharp.Commands.OutputStream);
            }
            catch (IOException)
            {
                throw die("cannot create output stream");
            }

            // Initialize the repository in use.
            if (repo != null)
            {
                GitRepository = repo;
                GitDirectory  = repo.Directory;
            }
            else
            {
                GitRepository = null;
                GitDirectory  = path;
            }
        }