本文整理汇总了C#中GitCommands.GitModule.RunCmd方法的典型用法代码示例。如果您正苦于以下问题:C# GitModule.RunCmd方法的具体用法?C# GitModule.RunCmd怎么用?C# GitModule.RunCmd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitCommands.GitModule
的用法示例。
在下文中一共展示了GitModule.RunCmd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCommitMessage
/// <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);
}
示例2: GetCommitData
/// <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;
}
示例3: GetConfigSvnRemoteFetch
public static string GetConfigSvnRemoteFetch(GitModule aModule)
{
return aModule.RunCmd(Settings.GitCommand, "config svn-remote.svn.fetch");
}