RunCmd() private method

private RunCmd ( string cmd, string arguments, Encoding encoding = null, byte stdInput = null ) : string
cmd string
arguments string
encoding Encoding
stdInput byte
return string
Exemplo n.º 1
0
        /// <summary>
        /// Gets the commit info for submodule.
        /// </summary>
        public static void UpdateCommitMessage(CommitData data, GitModule module, string sha1, ref string error)
        {
            if (module == null)
                throw new ArgumentNullException("module");
            if (sha1 == null)
                throw new ArgumentNullException("sha1");

            //Do not cache this command, since notes can be added
            string arguments = string.Format(CultureInfo.InvariantCulture,
                    "log -1 --pretty=\"format:" + ShortLogFormat + "\" {0}", sha1);
            var info =
                module.RunCmd(
                    Settings.GitCommand,
                    arguments,
                    GitModule.LosslessEncoding
                    );

            if (info.Trim().StartsWith("fatal"))
            {
                error = "Cannot find commit " + sha1;
                return;
            }

            int index = info.IndexOf(sha1) + sha1.Length;

            if (index < 0)
            {
                error = "Cannot find commit " + sha1;
                return;
            }
            if (index >= info.Length)
            {
                error = info;
                return;
            }

            UpdateBodyInCommitData(data, info, module);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the commit info for submodule.
        /// </summary>
        public static CommitData GetCommitData(GitModule module, string sha1, ref string error)
        {
            if (module == null)
                throw new ArgumentNullException("module");
            if (sha1 == null)
                throw new ArgumentNullException("sha1");

            //Do not cache this command, since notes can be added
            string arguments = string.Format(CultureInfo.InvariantCulture,
                    "log -1 --pretty=\"format:"+LogFormat+"\" {0}", sha1);
            var info =
                module.RunCmd(
                    Settings.GitCommand,
                    arguments,
                    Settings.LosslessEncoding
                    );

            if (info.Trim().StartsWith("fatal"))
            {
                error = "Cannot find commit " + sha1;
                return null;
            }

            int index = info.IndexOf(sha1) + sha1.Length;

            if (index < 0)
            {
                error = "Cannot find commit " + sha1;
                return null;
            }
            if (index >= info.Length)
            {
                error = info;
                return null;
            }

            CommitData commitInformation = CreateFromFormatedData(info);

            return commitInformation;
        }
 public static string GetConfigSvnRemoteFetch(GitModule aModule)
 {
     return aModule.RunCmd(Settings.GitCommand, "config svn-remote.svn.fetch");
 }