Merge branch 'master' into master
This commit is contained in:
@@ -1,85 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs", "GitTfs\GitTfs.csproj", "{55C169E0-93CC-488C-9885-1D4EAF4EA236}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfsTest", "GitTfsTest\GitTfsTest.csproj", "{DDFB4746-2BCE-4B34-8E45-056324CF140D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2010", "GitTfs.Vs2010\GitTfs.Vs2010.csproj", "{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.VsFake", "GitTfs.VsFake\GitTfs.VsFake.csproj", "{20C411E8-49C7-11E1-A776-3FE84824019B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2012", "GitTfs.Vs2012\GitTfs.Vs2012.csproj", "{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F52EAF74-50FA-495E-8A4A-29F91F4C00C9}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||
.nuget\nuget.targets = .nuget\nuget.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{4A46FEEE-B8A2-4445-B9D1-8160520C7301}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
doc\develop-on-mono.md = doc\develop-on-mono.md
|
||||
doc\release-notes\NEXT.md = doc\release-notes\NEXT.md
|
||||
README.md = README.md
|
||||
doc\running-the-unit-tests.md = doc\running-the-unit-tests.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CDE05FFA-9DDB-4694-8CA6-6DB7B235CD7F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
CI.proj = CI.proj
|
||||
Release.proj = Release.proj
|
||||
Releasing.md = Releasing.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ChocolateyTemplates", "ChocolateyTemplates", "{AC0FE25D-D76B-4EE7-9EA8-470204451C9F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ChocolateyTemplates\chocolateyInstall.ps1 = ChocolateyTemplates\chocolateyInstall.ps1
|
||||
ChocolateyTemplates\gittfs.nuspec = ChocolateyTemplates\gittfs.nuspec
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2013", "GitTfs.Vs2013\GitTfs.Vs2013.csproj", "{101D3C78-27CC-446A-98EC-E2DE88BF0641}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTfs.Vs2015", "GitTfs.Vs2015\GitTfs.Vs2015.csproj", "{A7032F30-2C86-4BAF-8F62-33EB7BA917AF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{55C169E0-93CC-488C-9885-1D4EAF4EA236}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{55C169E0-93CC-488C-9885-1D4EAF4EA236}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DDFB4746-2BCE-4B34-8E45-056324CF140D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DDFB4746-2BCE-4B34-8E45-056324CF140D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5A374D3-A2E1-407C-9D6D-541FDB53BD62}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{20C411E8-49C7-11E1-A776-3FE84824019B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{20C411E8-49C7-11E1-A776-3FE84824019B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20C411E8-49C7-11E1-A776-3FE84824019B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{20C411E8-49C7-11E1-A776-3FE84824019B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{699CE23D-8BBD-4C15-82E9-7A628ACCA4C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{101D3C78-27CC-446A-98EC-E2DE88BF0641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{101D3C78-27CC-446A-98EC-E2DE88BF0641}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{101D3C78-27CC-446A-98EC-E2DE88BF0641}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{101D3C78-27CC-446A-98EC-E2DE88BF0641}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A7032F30-2C86-4BAF-8F62-33EB7BA917AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A7032F30-2C86-4BAF-8F62-33EB7BA917AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A7032F30-2C86-4BAF-8F62-33EB7BA917AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A7032F30-2C86-4BAF-8F62-33EB7BA917AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = GitTfs1.vsmdi
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+57
-19
@@ -76,12 +76,12 @@ namespace Sep.Git.Tfs.Core
|
||||
return new ProcessStdoutReader(this, process);
|
||||
}
|
||||
|
||||
public class ProcessStdoutReader : TextReader
|
||||
class ProcessStdoutReader : TextReader
|
||||
{
|
||||
private readonly Process process;
|
||||
private readonly GitProcess process;
|
||||
private readonly GitHelpers helper;
|
||||
|
||||
public ProcessStdoutReader(GitHelpers helper, Process process)
|
||||
public ProcessStdoutReader(GitHelpers helper, GitProcess process)
|
||||
{
|
||||
this.helper = helper;
|
||||
this.process = process;
|
||||
@@ -193,7 +193,7 @@ namespace Sep.Git.Tfs.Core
|
||||
}
|
||||
}
|
||||
|
||||
private void Close(Process process)
|
||||
private void Close(GitProcess process)
|
||||
{
|
||||
// if caller doesn't read entire stdout to the EOF - it is possible that
|
||||
// child process will hang waiting until there will be free space in stdout
|
||||
@@ -208,7 +208,7 @@ namespace Sep.Git.Tfs.Core
|
||||
if (!process.WaitForExit((int)TimeSpan.FromSeconds(10).TotalMilliseconds))
|
||||
throw new GitCommandException("Command did not terminate.", process);
|
||||
if(process.ExitCode != 0)
|
||||
throw new GitCommandException(string.Format("Command exited with error code: {0}", process.ExitCode), process);
|
||||
throw new GitCommandException(string.Format("Command exited with error code: {0}\n{1}", process.ExitCode, process.StandardErrorString), process);
|
||||
}
|
||||
|
||||
private void RedirectStdout(ProcessStartInfo startInfo)
|
||||
@@ -229,12 +229,12 @@ namespace Sep.Git.Tfs.Core
|
||||
// there is no StandardInputEncoding property, use extension method StreamWriter.WithEncoding instead
|
||||
}
|
||||
|
||||
private Process Start(string[] command)
|
||||
private GitProcess Start(string[] command)
|
||||
{
|
||||
return Start(command, x => {});
|
||||
}
|
||||
|
||||
protected virtual Process Start(string [] command, Action<ProcessStartInfo> initialize)
|
||||
protected virtual GitProcess Start(string [] command, Action<ProcessStartInfo> initialize)
|
||||
{
|
||||
var startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "git";
|
||||
@@ -245,20 +245,11 @@ namespace Sep.Git.Tfs.Core
|
||||
RedirectStderr(startInfo);
|
||||
initialize(startInfo);
|
||||
Trace.WriteLine("Starting process: " + startInfo.FileName + " " + startInfo.Arguments, "git command");
|
||||
var process = Process.Start(startInfo);
|
||||
process.ErrorDataReceived += StdErrReceived;
|
||||
process.BeginErrorReadLine();
|
||||
var process = new GitProcess(Process.Start(startInfo));
|
||||
process.ConsumeStandardError();
|
||||
return process;
|
||||
}
|
||||
|
||||
private void StdErrReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if(e.Data != null && e.Data.Trim() != "")
|
||||
{
|
||||
Trace.WriteLine(e.Data.TrimEnd(), "git stderr");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WrapGitCommandErrors the actions, and if there are any git exceptions, rethrow a new exception with the given message.
|
||||
/// </summary>
|
||||
@@ -287,7 +278,54 @@ namespace Sep.Git.Tfs.Core
|
||||
private static void AssertValidCommand(string[] command)
|
||||
{
|
||||
if(command.Length < 1 || !ValidCommandName.IsMatch(command[0]))
|
||||
throw new Exception("bad command: " + (command.Length == 0 ? "" : command[0]));
|
||||
throw new Exception("bad git command: " + (command.Length == 0 ? "" : command[0]));
|
||||
}
|
||||
|
||||
protected class GitProcess
|
||||
{
|
||||
Process _process;
|
||||
|
||||
public GitProcess(Process process)
|
||||
{
|
||||
_process = process;
|
||||
}
|
||||
|
||||
public static implicit operator Process(GitProcess process)
|
||||
{
|
||||
return process._process;
|
||||
}
|
||||
|
||||
public string StandardErrorString { get; private set; }
|
||||
|
||||
public void ConsumeStandardError()
|
||||
{
|
||||
StandardErrorString = "";
|
||||
_process.ErrorDataReceived += StdErrReceived;
|
||||
_process.BeginErrorReadLine();
|
||||
}
|
||||
|
||||
private void StdErrReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (e.Data != null && e.Data.Trim() != "")
|
||||
{
|
||||
var data = e.Data;
|
||||
Trace.WriteLine(data.TrimEnd(), "git stderr");
|
||||
StandardErrorString += data;
|
||||
}
|
||||
}
|
||||
|
||||
// Delegate a bunch of things to the Process.
|
||||
|
||||
public ProcessStartInfo StartInfo { get { return _process.StartInfo; } }
|
||||
public int ExitCode { get { return _process.ExitCode; } }
|
||||
|
||||
public StreamWriter StandardInput { get { return _process.StandardInput; } }
|
||||
public StreamReader StandardOutput { get { return _process.StandardOutput; } }
|
||||
|
||||
public bool WaitForExit(int milliseconds)
|
||||
{
|
||||
return _process.WaitForExit(milliseconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,11 +61,16 @@ namespace Sep.Git.Tfs.Core
|
||||
return "refs/heads/" + branchName;
|
||||
}
|
||||
|
||||
public static string ShortToTfsRemoteName(string branchName)
|
||||
{
|
||||
return "refs/remotes/tfs/" + branchName;
|
||||
}
|
||||
|
||||
public string GitDir { get; set; }
|
||||
public string WorkingCopyPath { get; set; }
|
||||
public string WorkingCopySubdir { get; set; }
|
||||
|
||||
protected override Process Start(string[] command, Action<ProcessStartInfo> initialize)
|
||||
protected override GitProcess Start(string[] command, Action<ProcessStartInfo> initialize)
|
||||
{
|
||||
return base.Start(command, initialize.And(SetUpPaths));
|
||||
}
|
||||
@@ -508,9 +513,28 @@ namespace Sep.Git.Tfs.Core
|
||||
{
|
||||
if (!Reference.IsValidName(ShortToLocalName(gitBranchName)))
|
||||
throw new GitTfsException("The name specified for the new git branch is not allowed. Choose another one!");
|
||||
while (IsRefNameUsed(gitBranchName))
|
||||
{
|
||||
gitBranchName = "_" + gitBranchName;
|
||||
}
|
||||
return gitBranchName;
|
||||
}
|
||||
|
||||
private bool IsRefNameUsed(string gitBranchName)
|
||||
{
|
||||
var parts = gitBranchName.Split('/');
|
||||
var refName = parts.First();
|
||||
for (int i = 1; i <= parts.Length; i++)
|
||||
{
|
||||
if (HasRef(ShortToLocalName(refName)) || HasRef(ShortToTfsRemoteName(refName)))
|
||||
return true;
|
||||
if (i < parts.Length)
|
||||
refName += '/' + parts[i];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CreateBranch(string gitBranchName, string target)
|
||||
{
|
||||
Reference reference;
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
* Improve vrify command (check all remote option, add exit code, add ignore path case mismatch option) (#853, @pmiossec)
|
||||
* Improve verify command (check all remote option, add exit code, add ignore path case mismatch option) (#853, @pmiossec)
|
||||
* Always display the git errors messages to help git-tfs users (#820, @spraint & @pmiossec)
|
||||
Reference in New Issue
Block a user