本文整理汇总了C#中GitCommands.GitModule类的典型用法代码示例。如果您正苦于以下问题:C# GitModule类的具体用法?C# GitModule怎么用?C# GitModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GitModule类属于GitCommands命名空间,在下文中一共展示了GitModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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.RunGitCmd(arguments, GitModule.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, module);
return commitInformation;
}
开发者ID:Carbenium,项目名称:gitextensions,代码行数:38,代码来源:CommitData.cs
示例2: IsBinaryFile
public static bool IsBinaryFile(GitModule aModule, string fileName)
{
var t = IsBinaryAccordingToGitAttributes(aModule, fileName);
if (t.HasValue)
return t.Value;
return HasMatchingExtension(BinaryExtensions, fileName);
}
开发者ID:Carbenium,项目名称:gitextensions,代码行数:7,代码来源:FileHelper.cs
示例3: GitRef
public GitRef(GitModule module, string guid, string completeName, string remote)
{
Module = module;
Guid = guid;
Selected = false;
CompleteName = completeName;
Remote = remote;
if (CompleteName.StartsWith("refs/heads/"))
{
IsHead = true;
}
else if (CompleteName.StartsWith("refs/tags/"))
{
IsTag = true;
}
else if (CompleteName.StartsWith("refs/remotes/"))
{
IsRemote = true;
}
else if (CompleteName.StartsWith("refs/bisect/"))
{
IsBisect = true;
}
ParseName();
_remoteSettingName = String.Format("branch.{0}.remote", Name);
_mergeSettingName = String.Format("branch.{0}.merge", Name);
}
开发者ID:feinstaub,项目名称:gitextensions,代码行数:29,代码来源:GitRef.cs
示例4: GetSubmoduleNamesFromDiffTest
public void GetSubmoduleNamesFromDiffTest()
{
GitModule testModule = new GitModule("D:\\Test\\SuperProject");
// Submodule name without spaces in the name
string text = "diff --git a/Externals/conemu-inside b/Externals/conemu-inside\nindex a17ea0c..b5a3d51 160000\n--- a/Externals/conemu-inside\n+++ b/Externals/conemu-inside\[email protected]@ -1 +1 @@\n-Subproject commit a17ea0c8ebe9d8cd7e634ba44559adffe633c11d\n+Subproject commit b5a3d51777c85a9aeee534c382b5ccbb86b485d3\n";
string fileName = "Externals/conemu-inside";
GitSubmoduleStatus status = GitCommandHelpers.GetSubmoduleStatus(text, testModule, fileName);
Assert.AreEqual(status.Commit, "b5a3d51777c85a9aeee534c382b5ccbb86b485d3");
Assert.AreEqual(status.Name, fileName);
Assert.AreEqual(status.OldCommit, "a17ea0c8ebe9d8cd7e634ba44559adffe633c11d");
Assert.AreEqual(status.OldName, fileName);
// Submodule name with spaces in the name
text = "diff --git a/Assets/Core/Vehicle Physics core assets b/Assets/Core/Vehicle Physics core assets\nindex 2fb8851..0cc457d 160000\n--- a/Assets/Core/Vehicle Physics core assets\t\n+++ b/Assets/Core/Vehicle Physics core assets\t\[email protected]@ -1 +1 @@\n-Subproject commit 2fb88514cfdc37a2708c24f71eca71c424b8d402\n+Subproject commit 0cc457d030e92f804569407c7cd39893320f9740\n";
fileName = "Assets/Core/Vehicle Physics core assets";
status = GitCommandHelpers.GetSubmoduleStatus(text, testModule, fileName);
Assert.AreEqual(status.Commit, "0cc457d030e92f804569407c7cd39893320f9740");
Assert.AreEqual(status.Name, fileName);
Assert.AreEqual(status.OldCommit, "2fb88514cfdc37a2708c24f71eca71c424b8d402");
Assert.AreEqual(status.OldName, fileName);
}
开发者ID:gitextensions,项目名称:gitextensions,代码行数:28,代码来源:GitCommandHelpersTest.cs
示例5: TryGetGitHosterForModule
public static IRepositoryHostPlugin TryGetGitHosterForModule(GitModule aModule)
{
if (!aModule.ValidWorkingDir())
return null;
return GitHosters.FirstOrDefault(gitHoster => gitHoster.GitModuleIsRelevantToMe(aModule));
}
开发者ID:kunigaku,项目名称:gitextensions,代码行数:7,代码来源:RepoHosts.cs
示例6: GitUICommands
public GitUICommands(GitModule module)
{
Module = module;
RepoChangedNotifier = new ActionNotifier(
() => InvokeEvent(null, PostRepositoryChanged));
Notifications = NotificationManager.Get(this);
}
开发者ID:Yasami,项目名称:gitextensions,代码行数:7,代码来源:GitUICommands.cs
示例7: InitClick
private void InitClick(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(Directory.Text))
{
MessageBox.Show(this, _chooseDirectory.Text,_chooseDirectoryCaption.Text);
return;
}
if (File.Exists(Directory.Text))
{
MessageBox.Show(this, _chooseDirectoryNotFile.Text,_chooseDirectoryNotFileCaption.Text);
return;
}
GitModule module = new GitModule(Directory.Text);
if (!System.IO.Directory.Exists(module.WorkingDir))
System.IO.Directory.CreateDirectory(module.WorkingDir);
MessageBox.Show(this, module.Init(Central.Checked, Central.Checked), _initMsgBoxCaption.Text);
if (GitModuleChanged != null)
GitModuleChanged(this, new GitModuleEventArgs(module));
Repositories.AddMostRecentRepository(Directory.Text);
Close();
}
开发者ID:vbjay,项目名称:gitextensions,代码行数:28,代码来源:FormInit.cs
示例8: GetAllBranchesWhichContainGivenCommit
/// <summary>
/// Gets branches which contain the given commit.
/// If both local and remote branches are requested, remote branches are prefixed with "remotes/"
/// (as returned by git branch -a)
/// </summary>
/// <param name="sha1">The sha1.</param>
/// <param name="getLocal">Pass true to include local branches</param>
/// <param name="getRemote">Pass true to include remote branches</param>
/// <returns></returns>
public static IEnumerable<string> GetAllBranchesWhichContainGivenCommit(GitModule module, string sha1, bool getLocal, bool getRemote)
{
string args = "--contains " + sha1;
if (getRemote && getLocal)
args = "-a "+args;
else if (getRemote)
args = "-r "+args;
else if (!getLocal)
return new string[]{};
string info = module.RunGitCmd("branch " + args, GitModule.SystemEncoding);
if (info.Trim().StartsWith("fatal") || info.Trim().StartsWith("error:"))
return new List<string>();
string[] result = info.Split(new[] { '\r', '\n', '*' }, StringSplitOptions.RemoveEmptyEntries);
// Remove symlink targets as in "origin/HEAD -> origin/master"
for (int i = 0; i < result.Length; i++)
{
string item = result[i].Trim();
int idx;
if (getRemote && ((idx = item.IndexOf(" ->")) >= 0))
{
item = item.Substring(0, idx);
}
result[i] = item;
}
return result;
}
开发者ID:semi836,项目名称:gitextensions,代码行数:38,代码来源:CommitInformation.cs
示例9: GetSubmoduleText
public static string GetSubmoduleText(GitModule superproject, string name, string hash)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Submodule " + name);
sb.AppendLine();
GitModule module = superproject.GetSubmodule(name);
if (module.IsValidGitWorkingDir())
{
string error = "";
CommitData data = CommitData.GetCommitData(module, hash, ref error);
if (data == null)
{
sb.AppendLine("Commit hash:\t" + hash);
return sb.ToString();
}
string header = data.GetHeaderPlain();
string body = "\n" + data.Body.Trim();
sb.AppendLine(header);
sb.Append(body);
}
else
sb.AppendLine("Commit hash:\t" + hash);
return sb.ToString();
}
开发者ID:Carbenium,项目名称:gitextensions,代码行数:25,代码来源:LocalizationHelpers.cs
示例10: RunScript
public static bool RunScript(IWin32Window owner, GitModule aModule, string script, RevisionGrid revisionGrid)
{
if (string.IsNullOrEmpty(script))
return false;
ScriptInfo scriptInfo = ScriptManager.GetScript(script);
if (scriptInfo == null)
{
MessageBox.Show(owner, "Cannot find script: " + script, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
if (string.IsNullOrEmpty(scriptInfo.Command))
return false;
string argument = scriptInfo.Arguments;
foreach (string option in Options)
{
if (string.IsNullOrEmpty(argument) || !argument.Contains(option))
continue;
if (!option.StartsWith("{s"))
continue;
if (revisionGrid != null)
continue;
MessageBox.Show(owner,
string.Format("Option {0} is only supported when started from revision grid.", option),
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
return RunScript(owner, aModule, scriptInfo, revisionGrid);
}
开发者ID:rooflz,项目名称:gitextensions,代码行数:32,代码来源:ScriptRunner.cs
示例11: Execute
public void Execute(GitModule module)
{
if (Dto.Amend)
Dto.Result = module.RunGitCmd("commit --amend -m \"" + Dto.Message + "\"");
else
Dto.Result = module.RunGitCmd("commit -m \"" + Dto.Message + "\"");
}
开发者ID:Carbenium,项目名称:gitextensions,代码行数:7,代码来源:CommitHelper.cs
示例12: CommonLogic
public CommonLogic(GitModule aModule)
{
Module = aModule;
if (aModule != null)
{
var repoDistGlobalSettings = RepoDistSettings.CreateGlobal(false);
var repoDistPulledSettings = RepoDistSettings.CreateDistributed(Module, false);
var repoDistLocalSettings = RepoDistSettings.CreateLocal(Module, false);
var repoDistEffectiveSettings = new RepoDistSettings(
new RepoDistSettings(repoDistGlobalSettings, repoDistPulledSettings.SettingsCache),
repoDistLocalSettings.SettingsCache);
var configFileGlobalSettings = ConfigFileSettings.CreateGlobal(false);
var configFileLocalSettings = ConfigFileSettings.CreateLocal(Module, false);
var configFileEffectiveSettings = new ConfigFileSettings(configFileGlobalSettings, configFileLocalSettings.SettingsCache);
RepoDistSettingsSet = new RepoDistSettingsSet(
repoDistEffectiveSettings,
repoDistLocalSettings,
repoDistPulledSettings,
repoDistGlobalSettings);
ConfigFileSettingsSet = new ConfigFileSettingsSet(
configFileEffectiveSettings,
configFileLocalSettings,
configFileGlobalSettings);
}
}
开发者ID:renpan,项目名称:gitextensions,代码行数:29,代码来源:CommonLogic.cs
示例13: FormDiff
public FormDiff(GitModule module)
{
InitializeComponent();
Translate();
module_ = module;
diffViewer.ExtraDiffArgumentsChanged += DiffViewerExtraDiffArgumentsChanged;
}
开发者ID:Nehle,项目名称:gitextensions,代码行数:8,代码来源:FormDiff.cs
示例14: CheckIsCommitNewer
public void CheckIsCommitNewer(GitModule submodule)
{
if (submodule == null || !submodule.ValidWorkingDir())
return;
string baseCommit = submodule.GetMergeBase(Commit, OldCommit);
IsCommitNewer = baseCommit == OldCommit;
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:8,代码来源:GitSubmoduleStatus.cs
示例15: GetAllBranchesWhichContainGivenCommitTestReturnsEmptyList
public void GetAllBranchesWhichContainGivenCommitTestReturnsEmptyList()
{
var module = new GitModule("");
var actualResult = module.GetAllBranchesWhichContainGivenCommit("fakesha1", false, false);
Assert.IsNotNull(actualResult);
Assert.IsTrue(!actualResult.Any());
}
开发者ID:HuChundong,项目名称:gitextensions,代码行数:8,代码来源:CommitInformationTest.cs
示例16: CheckSubmoduleStatus
public void CheckSubmoduleStatus(GitModule submodule)
{
Status = SubmoduleStatus.NewSubmodule;
if (submodule == null)
return;
Status = submodule.CheckSubmoduleStatus(Commit, OldCommit);
}
开发者ID:bergerjac,项目名称:gitextensions,代码行数:8,代码来源:GitSubmoduleStatus.cs
示例17: GetOldCommitData
public CommitData GetOldCommitData(GitModule submodule)
{
if (submodule == null || !submodule.ValidWorkingDir())
return null;
string error = "";
return CommitData.GetCommitData(submodule, OldCommit, ref error);
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:8,代码来源:GitSubmoduleStatus.cs
示例18: ShowDialog
public static new bool ShowDialog(IWin32Window owner, GitModule module, string arguments)
{
using (var formRemoteProcess = new FormRemoteProcess(module, arguments))
{
formRemoteProcess.ShowDialog(owner);
return !formRemoteProcess.ErrorOccurred();
}
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:8,代码来源:FormRemoteProcess.cs
示例19: CheckWorkingDir
private static void CheckWorkingDir(string path)
{
GitModule module = new GitModule(path);
//Should not contain double slashes -> \\
Assert.IsFalse(module.WorkingDir.Contains("\\\\"), "WorkingDir" + module.WorkingDir + "\n" + GetCurrentDir());
//Should end with slash
Assert.IsTrue(module.WorkingDir.EndsWith("\\"), "WorkingDir" + module.WorkingDir + "\n" + GetCurrentDir());
}
开发者ID:robin521111,项目名称:gitextensions,代码行数:9,代码来源:FindValidworkingDirTest.cs
示例20: LoadModule
public void LoadModule(GitModule module)
{
if (UICommands != null && UICommands.Module == module)
{
return;
}
UICommands = new GitUICommands(module);
}
开发者ID:akrisiun,项目名称:gitextensions,代码行数:9,代码来源:ResetFormTest.cs
注:本文中的GitCommands.GitModule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论